## How to run MATLAB jobs on the TIGRESS clusters

#### Running MATLAB (Nobel)

Please note the following requirements when running MATLAB on the Nobel clusters:

- To run MATLAB interactively with its graphic interface, invoke it with the
**-singleCompThread**command-line argument to prevent the creation of multiple threads. - To run MATLAB in command line mode, invoke it with the
**-singleCompThread****-nodisplay -nosplash -nojvm**command-line arguments to prevent the use of X Windows, and the creation of multiple threads:- For example, if your MATLAB script file is 'myscript.m', then the command would be:

**/usr/licensed/bin/matlab -singleCompThread -nodisplay -nosplash -nojvm -r myscrip**t

- For example, if your MATLAB script file is 'myscript.m', then the command would be:
**NOTE:**In the spirit of fairness to all users sharing these servers, running MATLAB in multi-threaded mode on Nobel is**not**permitted.

#### Running MATLAB (Adroit or Della)

Please note the following requirements when running MATLAB on the Adroit or Della clusters:

- Invoke MATLAB with the
**-singleCompThread****-nodisplay -nosplash -nojvm**options to prevent the use of X Windows, and the creation of multiple threads. - If your MATLAB script file is 'myscript.m', your SLURM script file must include the following lines:
- #SBATCH -N 1
- #SBATCH -n 1
- cd <directory_containing_matlab_script>

*(Replace <directory_containing_matlab_script> with the name of the directory. If the script is in your home directory, just use the 'cd' command with no argumen*t.) - /usr/licensed/bin/matlab -singleCompThread -nodisplay -nosplash -nojvm -r myscript

#### Running MATLAB in multi-threaded mode (Adroit and Della only)

Most of the time, running MATLAB in single-threaded mode (as described above) will meet your needs. But if you have very mathematically intense computations that might benefit from the built-in multi-threading provided by MATLAB's BLAS implementation, then you can experiment with running in multi-threaded mode as follows:

- You will need to invoke MATLAB as above, but without the
**-singleCompThread**option. - Your *.m script must include the following line:

- maxNumCompThreads(
**T**)

*(Note that you'll probably get a deprecation warning, which you can ignore.)*

- maxNumCompThreads(
- If your MATLAB script is in 'myscript.m', then your SLURM script must include the following lines:
- #SBATCH -N 1
- #SBATCH -n 1
- #SBATCH -c
**T** - cd <directory_containing_m_script>

*(Replace <directory_containing_matlab_script> with the name of the directory. If the script is in your home directory, just use the 'cd' command with no argument.)* - /usr/licensed/bin/matlab -nodisplay -nosplash -nojvm -r myscript

**NOTE: **Both in your *.m script and in your SLURM script, '**T**' must be a number from 2 to the maximum number of cores per node on the cluster you are running. Use the **smallest **'**T**' that gives you a significant performance boost.