Running MATLAB on Strelka

MATLAB is installed on the Strelka Computer Cluster.  To make full use of the cluster, you may need to use the MATLAB Parallel Computing Toolbox to take advantage of parallel execution and GPU capabilities.  

Loading MATLAB module

To run MATLAB code, first load the module:

Run this after logging in to Strelka
module load matlab

Running with a Graphical User Interface

If you want to run the MATLAB graphical user interface (as opposed to the command line), connect to Strelka with X11.

macOS and Linux Users

Connect to Strelka using the following command on your computer (replace "username" with your Swarthmore username).  

ssh -XYC username@strelka.swarthmore.edu

On a Mac, you may need to install XQuartz if it isn't already on your system: https://www.xquartz.org/

Windows

Setting up X11 forwarding for Windows

Starting MATLAB

To start MATLAB, make sure to load the MATLAB module (see above) and then type:

matlab

The graphical user interface will load on your computer.

Testing MATLAB Code

On login node, use this command to run a .m file.  Only run small, short jobs on the login node because it is shared with all the other Strelka users.  To run a MATLAB script with the filename matlab_test.m, use the following command:

matlab -batch "matlab_test"

If the script requires command line arguments, use the following syntax:

MATLAB reference for command line options

Submission Script Example

For larger jobs, submit a MATLAB job to Slurm. Example job submission script:

See the main Strelka page for more details about how to configure a the Slurm submission script.  

Parallel Computing Toolbox 

Some tips:

MATLAB Parallel Computing Toolbox will save files to a default location in your home folder (~/.matlab/MATLAB_VERSION).  This can cause problems if multiple jobs are running at once because more than one process may attempt to modify preference files at the same time.  To avoid problems, specify a directory with the job id using the MATLAB_PREFDIR environmental variable.  For example, add this line to the job submission script before the command to execute your code.  



Ways you can contact ITS or find information:

ITS Support Portal: https://support.swarthmore.edu
Email: support@swarthmore.edu
Phone: x4357 (HELP) or 610-328-8513
Check out our remote resources at https://swatkb.atlassian.net/wiki/spaces/remote/overview
Check our homepage at https://swarthmore.edu/its