Table of Contents

Matlab Help

Mathworks Matlab is available on our HPC facilities as part of our University licensing agreement. It is available to all users.

You can run Matlab in several ways on our HPC:

Check Versions

$ module avail MATLAB

--------------------------------------------------------------------------
   MATLAB/2017a    MATLAB/2018b    MATLAB/2020a    MATLAB/2022b    MATLAB/2024a (D)

  Where:
   D:  Default Module
$

The actual versions displayed may vary depending on which HPC facility you are using. Use the module avail command, as above, to determine which versions are present.


Running

Open OnDemand Application

To run the full desktop version of Matlab, visit our Comet HPC Open OnDemand website:

From there you can elect to create a new Matlab Interactive App using the following form:

Ensure that you choose the correct Slurm partition for your Matlab instance. Consult our Comet HPC Resources & Partitions page to understand the difference between the available Slurm partitions.

Once you submit the form the system will schedule your request and shortly create a new dedicated Matlab application for you, this will open in your browser, and you will be able to run normal Matlab code and scripts. Full access to all the regular Comet filesystems is possible, and you can request up to 256 CPU cores for your Matlab session.

The application works as normal, you can load and save files and run code as you would normally, but you have the advantage of being able to use all of the resources of a Comet compute node.

You may close the browser and/or browser tab at any time and reconnect to the running application later - as long as this is within the time limit you set for the session at the point you submitted the form. Runtime limits for interactive sessions are detailed on the Comet HPC Resources & Partitions page.

When you are finished running Matlab, just close the application by clicking the small cross in the upper right of the Matlab window, the session will then automatically close within a few seconds:


Interactive GUI over SSH + X11

Interactive via the Matlab desktop interface (you must have enabled X11 over SSH in your client), to a login node:

$ module load MATLAB
$ matlab 

Matlab will load the desktop interface/window and, assuming you have correctly configured your X11 over SSH settings, this should be displayed on your desktop:

Remember, you should take care to minimise the use of compute-intensive applications on the login nodes - this is intended for quick tests only.

We do not recommend the use of SSH + X11 to run Matlab, as this is restricted to running Matlab on the login nodes. Please instead consider the use of Open OnDemand if you require graphical Matlab display.


Command Line

Run Matlab in command line mode, without the desktop application window:

$ module load MATLAB
$ matlab -nodesktop -nosplash
MATLAB is selecting SOFTWARE rendering.
Opening log file:  /path/to/your/home/java.log.25303

                                                   < M A T L A B (R) >
                                         Copyright 1984-2024 The MathWorks, Inc.
                                    R2024a Update 2 (24.1.0.2578822) 64-bit (glnxa64)
                                                      April 9, 2024

 
To get started, type doc.
For product information, visit www.mathworks.com.
 
>>

This will work on both a login node, as well as an interactive shell on a compute node (see "How do I get an interactive shell on a compute node?"). Using compute intensive applications on the login nodes are strictly limited and should be for simple tests (such as “does it run?” - yes, okay I'll now run it on a compute node to completion) only.

Of course you can also call the Matlab module from an sbatch script and run your code non-interactively.


Tips

Matlab Home Directory Use

When running Matlab on the HPC it will create an entirely new, host-specific preference directory within your .MathWorks/ServiceHost folder in your home directory. Since you may end up running Matlab on many dozens of different hosts via Slurm, this can end up taking up many gigabytes of your home directory space, as well as slow the starting of Matlab on any host/node/system that you launch it on for the first time:

$ cd $HOME
$ cd .MathWorks/ServiceHost
$ du -h -s *
950M	login01/
898M	login02/
1023M	sb085/
1291M	sb090/
1407M	sb091/
789M	sb099/
$

It is safe to delete these directories, as they will be recreated again the next time you run Matlab on another host.

Initial discussion of large, per-host ServiceHost folders reported on the Mathworks support forum:


Back to Advanced Software Index