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:
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).
On a Mac, you may need to install XQuartz if it isn't already on your system: https://www.xquartz.org/
To start MATLAB, make sure to load the MATLAB module (see above) and then type:
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:
If the script requires command line arguments, use the following syntax:
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
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.