Skip to content

Matlab#

MATLAB is a commercial software developed by MathWorks. It is used to solve mathematical problems and to visualize the results. It is mainly used for numerical calculations based on matrices.

Licensing#

Please note that the clusters do not come with any license. It also cannot be used with a personal license via the Matlab Campusvertrag. If you want to use Matlab, network licenses have to be activated for your chair.

Availability / Target HPC systems#

Matlab can run either on a single CPU or on a single node by using multi-threading. Runs with more than one node (via Matlab Parallel Server) are currently not supported.

For standalone-simulations, the following HPC systems are best suited:

  • JupyterHub: best suited for interactive use (only for Tier3 HPC accounts)
  • Woody: best suited for smaller calculations
  • TinyFat: for calculations with large memory requirements

However, the best choice for a target HPC systems depends also on the location of your input data. For example, if you want to analyze large datasets which were generated by another simulation on Fritz and are stored on its parallel file system, you should also use Fritz for your Matlab simulations to avoid copying data.

Different versions of Matlab are available via environment modules. They may also vary between the clusters. If you can't see the modules but want to use them, please contact HPC Support for activation.

Notes#

  • If possible, run your calculation as a batch job (see example script below).
  • MATLAB can also be run interactively via GUI or command line. You can use JupyterHub or an interactive job on the compute nodes for this.
  • Please do not use login nodes for production jobs!

Sample job scripts#

serial job on Woody#

The following scripts starts Matlab in batch mode on 4 CPUs on one Woody node.

#!/bin/bash -l

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=4
#SBATCH --time=10:00:00 
#SBATCH --job-name=matlab 
#SBATCH --export=NONE 
unset SLURM_EXPORT_ENV

module load matlab/R201xx
matlab -nojvm -nodisplay -nosplash < my_matlab_script.m

Matlab on JupyterHub#

Interactive usage of Matlab is also available via JupyterHub. The following steps are necessary:

  1. Access JupyterHub according to this guide.
  2. Select MATLAB from the job profiles. Matlab can either run locally on JupyterHub or as a Slurm job on a compute node.

    JupyterHub-job-profile

  3. You can choose between running a MATLAB Kernel in a Jupyter Notebook or Open Matlab in GUI mode.

    JupyterHub-Matlab

  4. When you start Matlab for the first time on a node, it will ask for licensing information. Select Existing License and then Start MATLAB.

    JupyterHub-Matlab-license

  5. You can now use Matlab.

  6. After you finished your work, remember to stop your instance manually by going back to the hub control panel (File > Hub Control Panel) and selecting Stop My Server. Closing the browser or logging out from JupyterHub will NOT free the resources!

JupyterHub-stop-server