SLURM Job Submission

To submit a batch job for later execution, run the sbatch command followed by the path to the script file on a login node.

$ sbatch script.cmd
submitted batch 2021

Upon successful submission of a job, a unique job ID ( i.e. 2021 in this example) is assigned by SLURM, which may be referred to for job management such as job status checking and cancellation.

By default, SLURM directs both standard output and standard error during job execution to a single file, named slurm-%j.out and slurm-%A_%a.out for standalone and array jobs respectively. The default path may be override with –output=%x_%j.out and –error=%x_%j.err for path to standard output and standard error respectively. User may compose a path using any combination of replacement symbols (% followed by a letter).

Replacement symbols

Replacement Symbol Description
%A Job array’s master job allocation number
%a Job array ID (index) number
%J JobID.stepid of the running job (e.g. “128.0”)
%j JobID of the running job
%x Job name

Besides putting SLURM directives inside a script file, they may be supplied to job submission commands like sbatch, srun and salloc as command-line arguments, which will take precedence over any specified values inside a script file.

e.g. Request 1 compute node with 32 cores per task and 4GB RAM, where any specified value for -N, -c, and --mem inside script.cmd are ignored.

$ sbatch -N1 -c32 --mem=4G script.cmd