Using Job Arrays
Users with a knowledge of shell scripting (e.g.,
bash) may choose to take advantage of job arrays. This feature significantly reduces load on our Torque/Maui server (compared to lots of individual job submissions). The example below (assume the file name is
pbsjob), will only be useful as a guide
#!/bin/bash #PBS -c s #PBS -j oe #PBS -m ae #PBS -N jobarray #PBS -M email@example.com #PBS -l walltime=9:00:00 cd $PBS_O_WORKDIR source /etc/profile.d/modules.sh module load matlab matlab -r myjob$PBS_ARRAYID.m
Issuing the command
qsub -S /bin/bash -t 1-8 pbsjob will see 8 jobs run under one major identifier. To view status of individual jobs in the array. The above example is identical to the one in the "Do It Yourself" section below.
Chances are you may need more advanced features of the scripting language than what is shown above. HPRC staff will endeavour to provide assistance with job arrays, if requested.
Do It Yourself
There are several legitimate reasons for wanting to run multiple single processor jobs in parallel within a single PBS script. For example, you may want to run 8 MATLAB jobs which require a toolbox that only has 4 licensed users. Only 1 MATLAB license is checked out if all 8 jobs are run on the same system. An example PBS script to do this task would look like