MATLAB

MATLAB is a universal interactive numerical application system with advanced graphical user interface. MathWorks offers many online beginners tutorials (onramps) to get you started with MATLAB here. This also includes onramps to different, more dedicated topics:

  • MATLAB Onramp
  • Simulink Onramp
  • Machine Learning Onramp
  • Deep Learning Onramp
  • Image Processing Onramp

License

On the HPC resources at GWDG there are 5 network licenses available for Matlab. Also we have the following extensions: Simulink, Optimization Toolbox, Parallel Computing Toolbox and Statistics and Machine Learning Toolbox.

For users from MPG we offer the flat rate License from MPG, which covers all toolboxes including MATLAB Parallel Server (formerly Distributed computing). However, you need to apply for the access to the license. You can do it by writing to hpc-support@gwdg.de. With this license you also have access to additional trainings, e.g.:

Command

First prepare the necessary environment with:

module load matlab/R2020b

The use of Matlab must be be scheduled by the batch system in the interactive queue onto an available node. Therefore the following command to the batch system is necessary:

srun --x11 -c 20 -N 1 -p int --pty bash

after a short time period you will get a Shell prompt and you can call Matlab with the command:

matlab

The current 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 1 hour. 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 higher time limit by specifying the switch -t, see here.

Warning

Due to installation issues X11 forwarding via SLURM does not work correctly. Therefore use instead of above the following approach for the time being: You will need two SSH session simultenously:

  1. Open a first SSH session on the login node:
    • Submit an interactive job using from a first SSH session on the login node: srun --x11 -c 20 -N 1 -p int --pty bash
    • Check the Hostname: hostname
  2. Open a second SSH Session on the login node:
    • SSH into the computenode: ssh -Y {node}
    • Start matlab: matlab

Parallelization

The cluster currently has only Parallel Computing Toolbox for Matlab (without Matlab Distributed Computing Server), it means that the opportunities of parallelization are limited in one node. You can only use multiple processors of a single computing node.

Parallel Computing Toolbox provides following commands and structures for parallel programs:

  • parfor - parallel for loop
  • gpuArray - to work with GPU
  • parfeval
  • spmd
  • tall arrays
Info

MPG users can also use the MATLAB Parallel Server to parallelize your application across multiple nodes. Find all information necessary to get started here.