Single-Node Matlab Jobs on Guillimin


IMPORTANT: Due to licensing issues, the installations of Matlab in the /software directory are available for McGill University users only.

Running Matlab interactively

We currently have the 2012a, 2014a, 2016a, and 2016b versions. They are located in the following directories:

  • /software/applications/matlab-2012a
  • /software/CentOS-6/applications/matlab-2014a
  • /software/CentOS-6/applications/matlab-2016a
  • /software/CentOS-6/applications/matlab-2016b

Matlab is not added to module environment, so you need to add one of the paths, given above, to your PATH variable in .bashrc file:

export PATH=$PATH:/software/CentOS-6/applications/matlab-2016b/bin

After that, Matlab can be started by issuing a standard "matlab" command:

user@guillimin> matlab

Be aware that in order to have access to Matlab GUI, you need to login to Guillimin using the "-X" ssh option.

IMPORTANT: All computationally intensive Matlab jobs MUST be submitted to the queuing system to be executed on the cluster nodes. Because Matlab is aggressive at consuming computing resources, Matlab use on the login nodes ( is discouraged. Please, use Matlab on the login nodes ONLY for short duration tasks which consume a small amount of CPU and memory resources.

To run an interactive matlab job on a worker node through the batch system, use qsub with the -I (minus capital i) and -X options, where RAPID needs to be replaced by your RAP id, generally of the form xyz-123-ab:

$ qsub -I -X -l walltime=1:00:00 -A RAPID
qsub: waiting for job to start
qsub: job ready

Begin PBS Prologue Date Time 1374779123
Job ID:
Username:	user
Group:		user
Nodes:		sw-2r14-n45
End PBS Prologue Date Time 1374779194
$ matlab

Submitting single-core Matlab jobs

All computationally intensive Matlab jobs must be submitted to the queuing system. Before submitting your job make sure that the path to Matlab distribution is added to your .bashrc file, as described in the previous section.

The following batch file can be used to submit your Matlab job:

#PBS -l nodes=1:ppn=1
#PBS -N matlab_job

cd your_matlab_project_directory

matlab -nodisplay < your_matlab_code.m > output

After that, you submit your batch file to the queuing system using qsub command (see submitting jobs)

Submitting multicore Matlab jobs

You can use Matlab Parallel Toolbox, and do parallel computations with Matlab within one computing node. Parallel Toolbox allows you to use the number of workers up to the number of cores in the node. You use this feature in the same way you do it on your desktop, except that the job must be packed with submission script and sent to the scheduler for execution. The submission of this type of jobs is similar to that of OpenMP parallel jobs. Here is a submission script template:

#PBS -l nodes=1:ppn=12
#PBS -N parallel_matlab_job

cd your_matlab_project_directory

matlab -nodisplay < your_matlab_code.m > output

In this script you are reserving 12 cores on one node, so you can open maximum 12 workers in your matlab code. This is normally done with the 'matlabpool 12' command in Matlab. Do not forget to change "ppn" property according to the number of workers you are opening in your code. Also, do not forget that you can NOT reserve more than 1 node for your matlab job, even parallelized with Parallel Toolbox. For multi-node computations, please see our MDCS documentation.