Breadcrumb Links:

Submitting a Matlab Job

By default, when running Matlab, the program is running interactively on the Head or Login node (Einstein in this case). This is perfectly acceptable when developing programs and/or running short tests. Though, when you wish to execute jobs, especially jobs that run for a reasonable amount of time, you should submit the program to execute on the "Cluster" of compute nodes to be run non-interactively.

If you execute large jobs on the "Head" node, this will slow down usability and will impact other users performance.

The following guide provides details on how to submit a Matlab job to the HPC cluster.

Submitting a Matlab Job to the cluster in non interactive mode

In order to submit a Matlab job to the cluster, you need to write a script file similar to the one below. Lines beginning with "##" represents comments.

The variable $PBS_O_WORKDIR indicates the directory where the PBS script file is located and launched from. Replace the example email address provided to your email address. Change the Matlab Script File Name to the name of the Matlab file that you want to be executed on the cluster.

Note all "[...]" are required variables or definitions that require defining.

###### Select resources #####
#PBS -N [Name of Job]
#PBS -l ncpus=[number of cpu's required, most likely 1]
#PBS -l mem=[amount of memory required]
#PBS -l walltime=[how long the job should run for - you may wish to remove this line]

#### Output File #####
#PBS -o $PBS_O_WORKDIR/[output (standard out) file name]

#### Error File #####
#PBS -e $PBS_O_WORKDIR/[input (standard out) file name]

##### Queue #####
#pbs -q workq

##### Mail Options #####
#PBS -m abe
#PBS -M [your email address]

##### Change to current working directory #####
cd $PBS_O_WORKDIR

##### Execute Program #####
. /etc/profile.d/modules.sh

matlab -nodisplay -nodesktop -nojvm -nosplash < [Matlab Script FileName.m]

Real Example

###### Select resources #####
#PBS -N Matlab-Job1
#PBS -l ncpus=1
#PBS -l mem=1g
#PBS -l walltime=100:00:00

#### Output File #####
#PBS -o $PBS_O_WORKDIR/matlab-job1.out

#### Error File #####
#PBS -e $PBS_O_WORKDIR/matlab-job1.err

##### Queue #####
#pbs -q workq

##### Mail Options #####
#PBS -m abe
#PBS -M j.bell@cqu.edu.au

##### Change to current working directory #####
cd $PBS_O_WORKDIR

##### Execute Program #####
. /etc/profile.d/modules.sh

matlab -nodisplay -nodesktop -nojvm -nosplash < matlab-job1.m

Executing script on the cluster

The Einstein Cluster uses a job scheduler that allows you to schedule and run jobs on the various compute nodes. To submit a job, simply execute the command:

qsub [pbs_script_file]

A handy command, to check if your job is running, queued or completed is by using the command:

qstat -an