MATLAB
MATLAB is a universal interactive numerical application system with an advanced graphical user interface. MathWorks offers many online beginner’s tutorials (onramps) to get you started with MATLAB here. This also includes onramps to different, more specific topics like Simulink, machine learning and image processing with MATLAB.
License
On the HPC systems at GWDG, five concurrent MATLAB network licenses are available to users of the University of Göttingen and GWDG. Two concurrent licenses are available for the Parallel Computing Toolbox.
We also have the following extensions, with one concurrent network license each:
- Simulink
- Optimization Toolbox
- Statistics and Machine Learning Toolbox
For users from the Max Planck Society (MPG), we offer the “flatrate” license from MPG, which covers all toolboxes including the MATLAB Parallel Server for 10.000 concurrent users. With this license, you also have access to additional trainings, e.g.:
- MATLAB Fundamentals (16.5 h)
- Simulink Fundamentals (8 h)
- MATLAB for Data Processing and Visualization (8 h)
- Machine Learning with MATLAB (12 h)
- Deep Learning with MATLAB (8 h)
NHR users do not have access to these licenses, unfortunately, and will have to bring their own license.
Running MATLAB
Via JupyterHPC
The easiest way to run MATLAB with a graphical user interface is via JupyterHPC.
Choose a desktop session, and the default version will be available from the start menu.
MATLAB will take a while to start up, so please be patient before you try again and accidentally start it twice.
If you need to use a specific version, open a terminal and follow the instructions in the next section to load the corresponding module, then just type matlab and hit enter.
Via SSH
MATLAB offers a CLI (command line interface) and a GUI (graphical user interface).
In order to use the GUI, you will need to login to the cluster with ssh -X ... to enable X11-forwarding or use a client that offers similiar functionality, such as MobaXterm on Windows.
For quick tests and very light workloads, you can run Matlab directly on the login nodes, but any heavier tasks must be run on a compute node. You can either do that via a Matlab parallel server workflow, to submit compute jobs from the Matlab UI, though this requires very specific preparation, look out for our courses on that topic. Any other use of Matlab must be scheduled via the batch system. We recommend to use an interactive partition for this, but if there is free capacity and you don’t request too many resources, a non-interactive partition works as well.
Use something like the following command to start your compute job:
srun --x11 -c 20 -N 1 -p jupyter --pty bashAfter a short time, you should get a shell prompt. Prepare the necessary environment with:
module load matlabor see the available versions by first running module avail matlab, followed by module load matlab/R20xxb with your version of choice.
You can then start Matlab by simply typing matlab.
The currently running version can be found on the main matlab screen under ‘Help - About Matlab’.
Note
This example command does not set a time limit, so your job will have the default limit of the partition you chose.
After that time is up, your session will be killed by the batch system.
Make sure to familiarize yourself with the srun command and its parameters and set a fitting time limit by specifying the switch -t, see here.
Parallelization
We offer the Parallel Computing Toolbox for MATLAB, as well as the MATLAB Parallel Server.
Parallel Computing Toolbox provides the following commands and structures for parallel programs:
- parfor - parallel for loop
- gpuArray - to work with GPU
- parfeval
- spmd
- tall arrays
With these, opportunities for parallelization are limited to a single node, meaning you can use multiple CPU cores, but can only scale to the number of cores your compute node has (typically 96 cores, 192 with Hyperthreading). Examples for using these can be found in the official documentation from MathWorks.
To scale up to multiple compute nodes, see MATLAB Parallel Server.