Course


Slurm job submission

How to submit a Slurm job, hands-on.

Submit jobs with sbatch

Submitting a job in SLURM is performed by running sbatch command and specifying a job script. A simple example of a Slurm job submission script (slurm_test.job):

#!/bin/bash

#SBATCH --job-name=SLURM_TEST
#SBATCH --output=/data/SLURM_TEST.out
#SBATCH --error=SLURM_TEST.err
#SBATCH --partition=normal

srun hostname | sort

First let's check how many nodes we have:

Now let's run our job (slurm_test.job) on all the availble nodes (c1 and c2).

The job will remain in the PD pending state until it runs when the resources get available. Let's now check the output, which should list the hostnames of the c1 and c2 compute nodes:

Jobs status

To check all your running/pending jobs:

squeue -u [USERID]

If you want to check the status of a single job:

scontrol show job [JOBID]

Cancel jobs

To cancel a job:

scancel [JOBID]

To cancel all jobs for a specific user: