Submitting a Matlab Job to SGE

For more in-depth information, see the Matlab page.

To submit a single core Matlab job the following script may act as a template:

#!/bin/bash
#$ -q long
#$ -pe smp 1

# The MATLABPATH variable is set in the Matlab script to add additional
# directories to the internal search paths.

export MATLABPATH=directory_path_to_your_files.m:other_user_contrib_directory_path
module load matlab

matlab -nodisplay -nosplash -singleCompThread < your_file.m

Depending on your job, you might need to add -nojvm

Here are some notes on submitting Matlab jobs with PCT

#!/bin/bash
#$ -q long
#$ -pe smp 8

export MATLABPATH=path_to_matlab_file

cd path_to_matlab_file

module load matlab

# The MATLABPATH variable is set in the Matlab script to add additional
# directories to the internal search paths.

matlab -nodisplay -nosplash < matlab_file 

The Matlab file above includes the command parpool('local',8), allowing Matalb to use 8 cores on the machine. Note that this number should match the number of cores requested from UGE.

Parallelization is done in a par for loop e.g.

 parpool('local',8);
 parfor i=1:N
 end
 


For further information, please consult the Matlab documentation: http://www.mathworks.com/support/