Difference between revisions of "Slurm"
From Systems Group
Systemswiki (Talk | contribs) (→SBATCH) |
Systemswiki (Talk | contribs) (→SBATCH) |
||
Line 11: | Line 11: | ||
== SBATCH == | == SBATCH == | ||
− | Sbatch is a command used to submit batch scripts to | + | Sbatch is a command used to submit jobs via batch scripts to SLURM. |
+ | |||
+ | '''SLURM Directives''' | ||
+ | |||
+ | SLURM directives are job flags that constrain the job to the conditions specified. Directives can be identified by the syntax `#SBATCH <flag>'. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |+ Flags | ||
+ | |- | ||
+ | ! Resource !! Syntax !! Description | ||
+ | |- | ||
+ | | Account || --account=slurmgeneral || entity which resources are charged to. available accounts | ||
+ | |- | ||
+ | | Partition || --partition=slurm-general-01 || where job resources are allocated. available partitions | ||
+ | |- | ||
+ | | Job Name || --job-name=testprogram || name of job to be queued | ||
+ | |} | ||
+ | |||
'''batch script example''' | '''batch script example''' |
Revision as of 18:06, 4 August 2022
Slurm is an open-source job scheduler for Linux and Unix-like kernels.
SRUN
srun is used to submit jobs for execution in real time. Also used to create job steps.
srun example
srun --pty /bin/bash # shell on compute job / default account is used when not specified
srun -p slurm-general-01 --account=slurmgeneral --pty /bin/bash # shell on compute job / specifying which partition and account (applicable if user is assigned multiple accounts)
SBATCH
Sbatch is a command used to submit jobs via batch scripts to SLURM.
SLURM Directives
SLURM directives are job flags that constrain the job to the conditions specified. Directives can be identified by the syntax `#SBATCH <flag>'.
Resource | Syntax | Description |
---|---|---|
Account | --account=slurmgeneral | entity which resources are charged to. available accounts |
Partition | --partition=slurm-general-01 | where job resources are allocated. available partitions |
Job Name | --job-name=testprogram | name of job to be queued |
batch script example
#!/bin/bash -l # login shell (required for lmod) #SBATCH --job-name=testprogram # job name #SBATCH --partition=slurm-general-01 # specifying which partition to run job on #SBATCH --account=slurmgeneral # only applicable if user is assigned multiple accounts #SBATCH --ntasks=1 # request 1 CPU #SBATCH --mem=1gb # request 1gb of memory #SBATCH --output=testprogram.lob # output and error log date sleep 10 module use /mnt/lmod_modules/Linux/ module load miniconda3 someProgram.py date
submitting a job using sbatch
sbatch myprogram.sh # queue job using a batch script
sbatch -p slurm-general-01 --account=slurmgeneral myprogram.sh # batch script specifying which partition and account when not specified using a slurm directive within the script