matlab

MATLAB (MATrix LABoratory) and is a numerical computing environment. You can find more information on the origins of Matlab here.

To use matlab for the batch job we will demonstrate we need to load the required module. You can do this by modifying your `$HOME/.bashrc`

file to include the current Matlab module.

module load matlab/r2017a

In your `$HOME`

directory create another directory to run the Matlab jobs, and add the example job from Matlab that we will modify.

razor-l1:jokinsey:~$ mkdir MATLAB-JOBS razor-l1:jokinsey:~$ cp /share/apps/matlab/R2017a/examples/matlab_featured/MultiplePlotsExample.m MATLAB-JOBS/

To get output an output from the job we need to modify the example. At the top of the file where figure is defined set figure equal to a value so we can save it to a file later.

f = figure;

At any point after a plot is created you can save the figure to a pdf file `test`

which will export the figure so we can view it later. You can find documentation on this here.

saveas(f,'test','pdf');

Once the example has been prepared, create a `PBS`

script named `matlabTest.pbs`

which looks like the script below to run the job.

#!/bin/bash #PBS -N matlab #PBS -q tiny12core #PBS -j oe #PBS -o matlab.$PBS_JOBID #PBS -l nodes=1:ppn=12 #PBS -l walltime=1:00:00 cd $PBS_O_WORKDIR cp MultiplePlotsExample.m /scratch/$PBS_JOBID cd /scratch/$PBS_JOBID matlab -nodesktop -nosplash < MultiplePlotsExample.m cp /scratch/$PBS_JOBID/test.pdf $PBS_O_WORKDIR

All that's left to do is submit the job.

razor-l1:jokinsey:~/MATLAB-JOBS$ qsub matlab.pbs

matlab.txt · Last modified: 2017/11/02 21:08 by jokinsey