Skip to content

Running MATLAB on the ORC Clusters

Interactively From Open OnDemand

MATLAB is available as one of the interactive apps that can be launched directly from Open OnDemand.

To use MATLAB on Hopper, the first step is to start an Open OnDemand (OOD)session. In your browser, go to You will need to authenticate with your Mason credentials before you can access the dashboard. Once you authenticate, you should be directed to the OOD dashboard. To launch MATLAB, follow the following steps:

  • Click on the "Interactive Apps" icon to see the apps that are available.

  • Select MATLAB from the listed apps

  • Set your configuration from the given options - number of hours (upto 12) and number of cores (upto 12) and launch.

  • Once your session is ready to start, you can 'Launch MATLAB'

This will start your interactive MATLAB session.

In batch mode using Slurm

The Open OnDemand sessions are limited to 12 hours and are interactive. If you wanted to run longer calculations on the cluster, you need to use Slurm scripts and submit them from a shell session on the head nodes. Ideally, use the interactive session to develop and test your script and once it is ready for a longer production run, use the Slurm job submission method.

Below is an example slurm script (run_matlab.slurm) you can adapt to execute a Matlab script (myscript.m) on Hopper:

#SBATCH   --partition=normal            # submit   to the normal(default) partition
#SBATCH   --job-name=test             # name the job
#SBATCH   --output=test-%j.out        # write stdout/stderr   to named file
#SBATCH   --error=test-%j.err
#SBATCH   --time=0-02:00:00             # Run for max of 02 hrs, 00 mins, 00 secs
#SBATCH   --nodes=1                     # Request N nodes
#SBATCH   --cpus-per-task=1            # Request n   cores per node
#SBATCH   --mem-per-cpu=2GB             # Request nGB RAM per core

#load modules with
module load  matlab/r2021a

#Execute matlab script
matlab -nodisplay  -r myscript
You submit it with
sbatch run_matlab.slurm

and it should run normally from the compute nodes.