Difference between revisions of "MATLAB"
From Montana Tech High Performance Computing
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | MATLAB and the Parallel Computing Toolbox is installed. The Distributed Computing Server is not | + | MATLAB (R2022b) and the Parallel Computing Toolbox is installed. The Distributed Computing Server is not supported, so calculations are limited to single compute nodes. |
==Submitting MATLAB jobs== | ==Submitting MATLAB jobs== | ||
− | MATLAB jobs that do and do not use the Parallel Computing Toolbox can be submitted to [[ | + | MATLAB jobs that do and do not use the Parallel Computing Toolbox can be submitted to [[Slurm]] via a script containing: |
+ | : <code style=display:block>#!/bin/sh<br>#SBATCH -J MatlabJob #Name of the computation<br>#SBATCH -N 1 # Total number of nodes requested <br>#SBATCH -n 4 # Total number of tasks per node requested<br>#SBATCH -t 01:00:00 # Total run time requested - 1 hour<br>#SBATCH -p normal # compute nodes partition requested <br><br>module load MATLAB<br>matlab -nodesktop -nosplash -r "your_matlab_program(input_parameters);quit;"</code> | ||
− | + | Since MATLAB is multithreaded, you can request 12 ppn even if you are not using the Parallel Computing Toolbox. For parallel MATLAB jobs, the matlabpool is limited to the physical cores only, that is 16 workers per compute node.. | |
− | + | Use msub to submit your job script to Slurm. | |
− | + | : <code>sbatch matlabjob.sh</code> | |
− | Use msub to submit your job script to | ||
− | : <code> | ||
where matlabjob contains the above script updated with your program and username info. | where matlabjob contains the above script updated with your program and username info. | ||
==Running MATLAB interactively in command line== | ==Running MATLAB interactively in command line== | ||
If you wish to run MATLAB interactively without the Desktop GUI, start an interactive job on a compute node with: | If you wish to run MATLAB interactively without the Desktop GUI, start an interactive job on a compute node with: | ||
− | :<code> | + | :<code>srun -N 1 -n 12 --pty /bin/bash</code> |
This will return with a command prompt on a compute node, for example: | This will return with a command prompt on a compute node, for example: | ||
− | :<code style=display:block>[ | + | :<code style=display:block>[USER@oredigger ~]$ srun -N 1 -n 12 --pty /bin/bash<br>[USER@cn0 ~]$</code> |
+ | |||
+ | Then you can start the MATLAB GUI with the commands: | ||
+ | :<code style=display:block>module load MATLAB<br>matlab</code> | ||
− | ==MATLAB | + | ==MATLAB desktop on headnode== |
− | The MATLAB Desktop GUI is currently limited to the management node | + | The MATLAB Desktop GUI is currently limited to the management node. Please respect other users and avoid long computational runs on the management node if other users are on the system. |
Latest revision as of 10:03, 18 April 2023
MATLAB (R2022b) and the Parallel Computing Toolbox is installed. The Distributed Computing Server is not supported, so calculations are limited to single compute nodes.
Submitting MATLAB jobs
MATLAB jobs that do and do not use the Parallel Computing Toolbox can be submitted to Slurm via a script containing:
-
#!/bin/sh
#SBATCH -J MatlabJob #Name of the computation
#SBATCH -N 1 # Total number of nodes requested
#SBATCH -n 4 # Total number of tasks per node requested
#SBATCH -t 01:00:00 # Total run time requested - 1 hour
#SBATCH -p normal # compute nodes partition requested
module load MATLAB
matlab -nodesktop -nosplash -r "your_matlab_program(input_parameters);quit;"
Since MATLAB is multithreaded, you can request 12 ppn even if you are not using the Parallel Computing Toolbox. For parallel MATLAB jobs, the matlabpool is limited to the physical cores only, that is 16 workers per compute node..
Use msub to submit your job script to Slurm.
-
sbatch matlabjob.sh
where matlabjob contains the above script updated with your program and username info.
Running MATLAB interactively in command line
If you wish to run MATLAB interactively without the Desktop GUI, start an interactive job on a compute node with:
srun -N 1 -n 12 --pty /bin/bash
This will return with a command prompt on a compute node, for example:
[USER@oredigger ~]$ srun -N 1 -n 12 --pty /bin/bash
[USER@cn0 ~]$
Then you can start the MATLAB GUI with the commands:
module load MATLAB
matlab
MATLAB desktop on headnode
The MATLAB Desktop GUI is currently limited to the management node. Please respect other users and avoid long computational runs on the management node if other users are on the system.