Getting Started

Page Content

Supported Releases of MATLAB and MATLAB Compiler Runtime

MATLAB Release (Patch level)

MATLAB Compiler Runtime

R2025a

> module load matlab/R2025a
> module load matlab-mcr/R2025a
R2025a

R2024b
(Update 3)

> module load matlab/R2024b_Update3
> module load matlab-mcr/R2024b_Update3
R2024b
(Update 3)
Availability

Linux Cluster (CoolMUC-4)

Linux Cluster (CoolMUC-4)
SuperMUC-NG

 
List available modules on command line
> module avail matlab

Useful MATLAB Command-line Options

Run MATLAB via the "matlab" command only or add command-line arguments. Please consider: All MATLAB command-line arguments are case-sensitive!

> matlab arg_1 ... arg_N
Command-line argumentMeaning
no argumentStart MATLAB GUI.
-nodesktop
Start MATLAB without desktop but allow GUI and graphics output (figures).
-nodisplay
Start MATLAB without any GUI support. Graphics output (figures) is also not possible.
-singleCompThread

Many intrinsic MATLAB functions automatically exploit multithreading. MATLAB can be forced to disable this feature. Use this option for any work on the login nodes! 

-r myfunc
Run a MATLAB script or function, e. g. myfunc.m.

Further information:

Interactive MATLAB Jobs

LRZ policies for using MATLAB on Login Nodes

MATLAB is a very resource-hungry application with respect to both memory and CPU resources! Please run MATLAB on login nodes with care! Especially, involving multiple threads (many built-in MATLAB functions/operators use multithreading by default) or multiple processes may cause a high load on the login node, may affect the work of other users or have a negative impact on the general operation of the login nodes!

Those MATLAB applications will be terminated by system administrators! Repeated violation of the restrictions on login nodes might result in a ban of the affected user account and notification to the responsible master user or PI.

In addition to the Policies on the Linux Cluster, please also consider the rules when using MATLAB on the login nodes:

  • Only run a maximum of one MATLAB instance per login node!
  • Disable any kind of parallelization, i.e. multithreading (see command-line options above) or the Parallel Computing Toolbox!
  • Check the load and memory consumption of your own MATLAB session. Usually, you can do this via the "top" command, e.g.:
    top -u $USER

Recommendations:

We recommend NOT to use the graphical user interface (GUI) of MATLAB, as this unnecessarily increases the load (resource consumption). Furthermore, using GUI decreases the overall performance of MATLAB.

  • If the MATLAB GUI is needed, then the CoolMUC Web Portal could be your choice!
  • If the MATLAB GUI is not needed, it is better to run MATLAB via an interactive Slurm job (see next section). This job runs on a compute node. Parallelization is explicitly allowed here!

Typical Usecases

(A) I want to run pure MATLAB computations without any need of the MATLAB GUI or visualization

Interactive MATLAB sessions can be started on compute nodes of CoolMUC-4 by employing interactive Slurm jobs. Please refer to Running interactive jobs on the Linux Cluster. We recommend to start MATLAB via

> matlab -nodisplay

(B) I want to run MATLAB computations without the need of the GUI, but visualization is required

Interactive MATLAB sessions can be started on compute nodes of CoolMUC-4 by employing interactive Slurm jobs. Please refer to Running interactive jobs on the Linux Cluster. We recommend to start MATLAB via

> matlab -nodesktop

As GUIs/windows cannot be opened, the graphics output must be written directly to (image) files (as usually done in batch jobs). Therefore, open MATLAB figures without GUI, e.g.:

>> fig = figure('visible', 'off');

(C) I need the MATLAB GUI, or at least figure windows

We recommend to use the CoolMUC Web Portal. This is a web-based access to the Linux Cluster allowing GUI-based MATLAB jobs on the compute nodes of CoolMUC-4. Do the following steps:

  1. Login to https://ood.hpc.lrz.de using the same credentials you are using on CoolMUC-4.
  2. Select MATLAB from the dashboard.
  3. Now, you can setup the Slurm job specifications of your MATLAB job. Recommended settings:
    1. Select the appropriate partition. That depends on your usecase. Consider the partition limits.
    2. 1 CPU node, as MATLAB usually cannot use more.
    3. CPU flavor: Number of cores depends on the usecase. Multi-threading used? Parallel Computing Toolbox used?
    4. RAM flavor: at least 16 GB. as MATLAB already needs a few GBs after startup.
    5. Total run time in hours: depends on usecase. Consider the partition limits.
  4. Launch the job. You may need to wait, as you are starting a Slurm job, waiting for available resources.
  5. A VNC session will open, automatically starting the MATLAB GUI. Please be patient. The MATLAB startup is quite slow. This is not a problem of the web portal access.

General Considerations

  • Interactive jobs depend on the availability of compute resources. Matlab may not start immediately.
  • An interactive Matlab session should be limited to 1 compute node only.
  • Consider the restrictions on interactive jobs: Job Processing on the Linux-Cluster

Common Batch Jobs

Batch jobs are used for all MATLAB production runs. Usually, the resources, consumed by MATLAB applications, are limited to a single CPU core (pure serial job) or a single compute node (parallel job involving either multithreading or the Parallel Computing Toolbox [PCT]). Following table lists job examples for various cases which can be used on CoolMUC-4.

Slurm job scriptMatlab scriptComment

Serial batch job

matmul_serial.slurm
(updated: 28 July 2025, 19:08)

matmul_serial.m
(updated: 28 July 2025, 19:08)

No parallelization at all, MATLAB is intended to run on a single core.
Please use the "serial" cluster of the Linux Cluster!

Parallel job using multithreading

matmul_mthread.slurm
(updated: 28 July 2025, 19:08)

matmul_mthread.m
(updated: 28 July 2025, 19:08)

MATLAB will run on a single compute node.
Please use the partition "cm4_tiny" in cluster "cm4"! In case of allocating a few cores only, use the "serial" cluster. See Job Processing on the Linux-Cluster.

Parallel batch job using Parallel Computing Toolbox (PCT)

matmul_pct.slurm
(updated: 28 July 2025, 19:08)

matmul_pct.m
(updated: 28 July 2025, 19:08)

MATLAB will run on a single compute node.
Please use the partition "cm4_tiny" in cluster "cm4"! In case of allocating a few cores only, use the "serial" cluster. See Job Processing on the Linux-Cluster.