Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Using MATLAB in O2

If you are primarily interested in using the interactive graphical version of MATLAB on O2, it is easiest and most performant to use O2’s web interface, known as O2 Portal.

Otherwise, to use MATLAB via the command line, please continue reading:

MATLAB is a resource-intensive application, and MUST ALWAYS be run on O2's computing nodes, not the login nodes. This can be done submitting a job through the SLURM scheduler as explained in detailed below.

...

Code Block
#-----------------------------------------------------
#SBATCH -p short
#SBATCH  -t 1:00:00
#SBATCH --mem=8000
#SBATCH -c 1

module load matlab/2019a2021b
matlab -batch "myfunction(my_inputs)"
#-----------------------------------------------------

...

To ensure that the outcome of a MATLAB job is captured by the scheduler you can use the MATLAB try catch exit(1) end construct as shown in the example below:

...

It is possible to run MATLAB parallel jobs++ on the O2 cluster using either the local cluster profile or the O2 cluster profile 

(++ in order to run parallel the MATLAB scripts must contain parallel commands, such as parfor or spmd)

...

This approach can be used on any of the O2 partition with the exception of the mpi partition

Note 1: Several complex operations in MATLAB are already parallelized (intrinsic parallelization of libraries), if your script is serial but uses intensively these parallelized libraries you might still want to request at least 2 or 3 cores using this approach in order to retain the associated speedup performance.

...

It is possible to configure MATLAB so that it interacts with the SLURM scheduler. This allows MATLAB to directly submit parallel jobs to the SLURM scheduler and enables it to leverage CPU and memory resources across different nodes (distributed memory). You can find detailed information on how to set and use the O2 MATLAB cluster profile here

Displaying MATLAB graphics from O2

...

Using MATLAB Desktop (GUI) in O2

It is now possible to run MATLAB in O2 with its Desktop GUI interface using our O2 Portal MATLAB applications. For more information please check our O2Portal wiki