Slurm: Submitting a batch job🔗
Prev: Slurm: Running an interactive job
⚠ This guide requires that you have completed: How to login
The benefits of batch jobs include automation and the ability to have numerous jobs in the queue simultaneously, thanks to Slurm's job scheduling.
#!/bin/bash
#SBATCH --account=C3SE-STAFF
#SBATCH --gpus-per-node=A40:4
#SBATCH --time=01:00:00
module load pytorch
~/my_ml_pytorch_script.py --epochs=12 --mnist_src /mimer/NOBACKUP/Datasets/MNIST/raw
The sbatch
command schedules a job on a compute node.
#!/bin/bash
: A "shebang" indicating which interpreter should run this script.#SBATCH --account=C3SE-STAFF
: Slurm should bill theC3SE-STAFF
account.#SBATCH --gpus-per-node=A40:4
: Requests four (4) A40 GPUs.#SBATCH --time=01:00:00
: Requests a runtime of 1 hour.
The following lines are executed as part of the script on the compute node:
module load pytorch
: Loads the pytorch module from the module system../my_ml_pytorch_script --epochs 12 --mnist-src /mimer/NOBACKUP/Datasets/MNIST/raw
: Starts an application.
For a more comprehensive guide to Slurm and how to script jobs, please see Running jobs.