The MATLAB installation on the RCS compute service has the Parallel Computing Toolbox enabled. Code developed on your own machine should run unmodified on the RCS system, with one caveat. By default MATLAB will try to use all the processors on the machine on which it is running. In order to respect per-job resource limits MATLAB needs to be told how many processors have been allocated as follows:
- Add
ompthreads
to your job script, matching the value ofncpus
- Use
parpool
to explicitly initialise a parallel pool in MATLAB before using any parallel code (e.g.parfor
)
A full example is available in this MATLAB code and job script.
Note that MATLAB does not work with MPI and should normally only be run on a single node (i.e. select=1
)
Further resources
- The Research Computing Service’s Support pages
- Other MATLAB tips in this series