Typical Batch Systems on HPC Machines

On a HPC facility, and other high end facilities, a "batch system" takes job requirements from users and, according to some "fairness", runs those jobs on the compute nodes. The batch system is configured by the system administrators. Configuration includes items such as

  • list of compute nodes and their characteristics (#cores, amount of RAM, type of interconnect)
  • list of queue resources: how many nodes a given queue can support, how long a job can run on that queue
  • list of users and which queues they can access (eg some machines may have some nodes bought by specific research groups)
  • a priority scheme (per-queue or per-system): some systems will decrease the priority of a user's jobs when they make heavy use of the system (fairness of access across users), often with a "half life" (so the longer ago one ran big jobs the less effect they have on the current priority); some systems just implement "first submitted, first to run". It is a hard problem to balance user requirements in a manner that everybody agrees is fair

Batch systems may also be able to "cloud burst": take local jobs but run on cloud resources such as AWS or MS Azure.

It is very useful to obtain an architectural diagram of each HPC system you use in order to help understand how best to use the available batch systems. For example, see the architectural diagram of Liverpool system "Barkla"

Popular batch systems (and machines they are available on) include:

  • SGE and SoGE
  • SLURM (as on Archer2)
  • LSF
  • PBS

These batch systems all have similar user commands - as you would expect for submitting jobs, checking queues, and accounting.

SLURM

As with many commands there are a number of approaches one can take with the same result. For the full power of SLURM you should consult
the manual pages available on the system (e.g. man sbatch) and the official documentation available at https://slurm.schedmd.com.

You can find the version of SLURM on your system via sbatch --version. On Barkla, for example (as f July2020):

$ sbatch --version
slurm 17.02.8

so you would need to use the documentation in the 17.02.8 archive.

A subset of SLURM commands suffice to run a job, delete a job and view pending jobs is described here. Comparison with other batch systems is available.

Job Submission

Use sbatch to submit a job to run on one or more compute nodes, when resources available. (You can also set up dependences etc). sbatch typically takes a script name (that controls what to do for the job, such as run an executable on the compute node/s) and some command arguments (e.g. to say how many compute nodes). For each sbatch command argument, there is a corresponding option to use within the batch script via the "#SLURM" prefix. In these examples, we presume you have batch script named "runjob.slurm".

To submit a job you will need to know which "partition" (set of compute nodes, similar to a "job queue") to use. The SLURM command to show you the full list of partitions is sinfo For example, on Barkla (as of July2020):


$ sinfo
PARTITION    AVAIL  TIMELIMIT  NODES  STATE NODELIST
lowpriority     up 1-00:00:00      1  drain node015
lowpriority     up 1-00:00:00      6    mix node[002,018,040,047,056,059]
lowpriority     up 1-00:00:00     69  alloc node[001,003-014,016-017,019-039,041-046,048-055,057-058,060,104-112,130-136]
course          up    2:00:00      1  alloc node060
nodes*          up 3-00:00:00     12    mix node[064,067,079,093,099,101-102,113,115,119,125-126]
nodes*          up 3-00:00:00     46  alloc node[061-063,065-066,068-078,080-092,094-098,100,103,114,116-118,122-124,127-129]
long            up 7-00:00:00      2    mix node[125-126]
long            up 7-00:00:00      6  alloc node[122-124,127-129]
himem           up 6-00:00:00      2   idle himem[01-02]
phi             up 3-00:00:00      4   idle phi[01-04]
gpu             up 3-00:00:00      2    mix gpu[01,03]
covid19gpu02    up 3-00:00:00      1  alloc gpu02

This tells you the names of the "partitions" followed by detail as to whether the nodes are up (or not), the maximum wallclock time for a job (in format days-hrs:mins:secs) and then how many nodes in a given "state" and which actual nodes are in that state. "alloc" means a node is fully allocated (busy), "idle" means it is fully idle, "mix" means some cores have been allocated to a job and "drain" typically indicates a job is finishing on that node.

For typical CPU jobs, you will use the default partition "nodes". For those on Michael Bane's COMP328 / COMP528 courses you may use the "course" partition. To use a partition other than the detault you have to tell sbatch which partitiion to use.

To run your batch script on the default partition you would run

sbatch runjob.slurm

To run your batch script on the non-default "course" partition you would run

sbatch -p course runjob.slurm

Alternatively, you can amend your runjob.slurm script to include the line

#SBATCH -p course

Note that when using "#SBATCH" prefixes they have to appear at the top of the job script before
any executable command.

When the job starts on the given partitiion it will execute the commands in your batch script (much as if you run the batch script interactive). You can check the status of all your jobs by the SLURM command

squeue -u $USER

For example, you may see


$ squeue -u $USER
             JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)
          33739879    course   sbatch   mkbane PD       0:00      1 (Resources)

which shows 1 job with a status "PD" which means it is pending. Note that it has a numerical JOBID, in this case 33739879. When resources (available node/s) are available the job will run and the output may change to


$ squeue -u $USER
             JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)
          33739879    course   sbatch   mkbane  R       1:17      1 node060

where is now see a status "R" (running) and accumulated wall clock time of 1 minute 17 seconds, running on "node060".

The output from a running job is buffered in to an output file whose default name is "slurm-JOBID.out" where JOBID. For the above example this is:


$ ls -lt |head
total 144
-rw-r--r--  1 mkbane clusterusers    12 Jul 24 10:26 slurm-33739879.out

Job Control

As noted above, the SLURM command "squeue" can be used to query all jobs or just a user's jobs. To stop a running job, and to stop a job running, you use "scanel JOBID" where JOBID can be obtained from squeue.

To review resources (e.g. number of nodes, amount of wall clock time) consumed by recent jobs, please see the sacct command