Close menu Resources for... William & Mary
W&M menu close William & Mary

Multiple serial jobs on one node

Users that run many sets of serial/single-processor jobs may want to combine them into groups of jobs that each use a full compute node.  This way single serial jobs don't get distributed throughout the cluster and end up sharing nodes with other users and potentially causing conflicts.  

It is straightforward to create a batch script which runs a series of serial jobs. Let's take a Vortex node as an example. Each Vortex node has twelve processors. Therefore a user with many serial jobs could run twelve at a time with each batch script.

This is an example of a batch script that runs on one node and launches a series of single processor jobs:


#!/bin/tcsh
#PBS -N JobSet
#PBS -l nodes=1:vortex:ppn=12
#PBS -l walltime=12:00:00
#PBS -j oe

setenv OMP_NUM_THREADS 1
# don't let serial jobs grab all processors if OpenMP available
cd $PBS_O_WORKDIR ./myscript1 >& outscript1 & ./myscript2 >& outscript2 & ./myscript3 >& outscript3 & ./myscript4 >& outscript4 & ./myscript5 >& outscript5 & ./myscript6 >& outscript6 & ./myscript7 >& outscript7 & ./myscript8 >& outscript8 & ./myscript9 >& outscript9 & ./myscript10 >& outscript10 & ./myscript11 >& outscript11 & ./myscript12 >& outscript12 & wait

In this example, myscriptXX is a script/job/executable, and outscriptXX collects the output from the script/job/executable.

The & is important and must be at the end of each line. The final wait command must also be included so that the batch script exits only when all twelve jobs are done.

Please send questions to hpc-help@wm.edu