By default, Matlab PCT will dump files to
~/.matlab/MATLAB_VERSION. This causes problems when multiple Matlab PCT jobs are running simultaneously. Users should always define the environment variable
MATLAB_PREFDIR so each job uses a unique temporary folder. Files there will be cleaned after the job finishes. For example:
export MATLAB_PREFDIR=$(mktemp -d $SLURM_JOBTMP/matlab-XXXX)
Matlab and SLURM Resource Requests
If you are trying to run Matlab in parallel interactively, you may encounter the following error:
>> Starting parallel pool (parpool) using the 'local' profile ...
Error using parpool (line 149)
You requested a minimum of <n> workers, but the cluster "local" has the NumWorkers property set to allow a maximum of 1 workers. To run a communicating job on more workers than this
(up to a maximum of 512 for the Local cluster), increase the value of the NumWorkers property for the cluster. The default value of NumWorkers for a Local cluster is the number of
physical cores on the local machine.
This is caused by an interaction between SLURM and Matlab. To resolve this issue, when requesting <n> cores for your interactive job, you will need to set SLURM's
--ntasks directive to 1 and
--cpus-per-task to the number of cores you need. For example:
$ salloc --nodes=1 --ntasks=1 --cpus-per-task=6 --mem-per-cpu=5GB --time=01:00:00 --job-name=interactive --account=<GROUP> --partition=standard