Do It YourselfThere 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 No Format |
---|
#!/bin/bash
#PBS -c s
#PBS -j oe
#PBS -m ae
#PBS -N jobname
#PBS -M your.name@jcu.edu.au
#PBS -l walltime=1000:00:00
#PBS -l nodes=1:ppn=8
#PBS -l pmem=3gb
ncpu=`wc -l $PBS_NODEFILE`
echo "------------------------------------------------------"
echo " This job is allocated "$ncpu" CPU cores on "
cat $PBS_NODEFILE | uniq
echo "------------------------------------------------------"
echo "PBS: Submitted to $PBS_QUEUE@$PBS_O_HOST"
echo "PBS: Working directory is $PBS_O_WORKDIR"
echo "PBS: Job identifier is $PBS_JOBID"
echo "PBS: Job name is $PBS_JOBNAME"
echo "------------------------------------------------------"
cd $PBS_O_WORKDIR
source /etc/profile.d/modules.sh
module load matlab
matlab -r myjob1 &
matlab -r myjob2 &
matlab -r myjob3 &
matlab -r myjob4 &
matlab -r myjob5 &
matlab -r myjob6 &
matlab -r myjob7 &
matlab -r myjob8 &
wait # Wait for background jobs to finish.
|
To submit the job for execution on a HPRC compute node simply enter the command:Note that the above job would be allocated 8 CPU cores and 24GB of memory.To submit the job for execution on a HPRC compute node simply enter the command: Note: The echo commands in the PBS script example above are informational only. Using Job ArraysUsers 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 No Format |
---|
#!/bin/bash
#PBS -c s
#PBS -j oe
#PBS -m ae
#PBS -N jobarray
#PBS -M your.name@jcu.edu.au
#PBS -l pmem=2gb
#PBS -l walltime=9:00:00
cd $PBS_O_WORKDIR
source /etc/profile.d/modules.sh
module load matlab
matlab -r myjob$PBS_ARRAYID
|
Issuing the command No Format |
---|
qsub -S /bin/bash -t 1-8 pbsjob |
will see 8 jobs run under one major identifier. The above example is identical (in terms of what jobs would be executed) to the one in the "Do It Yourself" section above. 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. |