...
Column |
---|
|
Code Block |
---|
language | bash |
---|
theme | Emacs |
---|
title | Listing 4. A simple Slurm batch script |
---|
linenumbers | true |
---|
| #!/bin/bash -l
# 10 nodes, 32 MPI processes/node, 320 MPI processes total
#SBATCH --job-name="myjob"
#SBATCH --time=02:00:00
#SBATCH --ntasks=320
#SBATCH --ntasks-per-node=32
#SBACTH --cpus-per-task=1
#SBATCH --mem=58G
#SBATCH --output=myjob.%j.o
#SBATCH --error=myjob.%j.e
#SBATCH --account=projectcode
#SBATCH --export=NONE
#======START=====
echo "The current job ID is $SLURM_JOB_ID"
echo "Running on $SLURM_JOB_NUM_NODES nodes"
echo "Using $SLURM_NTASKS_PER_NODE tasks per node"
echo "A total of $SLURM_NTASKS tasks is used"
echo "Node list:"
sacct --format=JobID,NodeList%100 -j $SLURM_JOB_ID
echo "Executing command."
srun -u -N $SLURM_JOB_NUM_NODES -n $SLURM_NTASKS -c $SLURM_CPUS_PER_TASK ./a.out
#=====END==== |
|
...
Line 1 invokes the shell (bash), and line 2 is a comment.
Lines 3 to 10 12 contain the script directives. Line 3 gives the job a name. Line 4 requests 2 hours of walltime. Line 5 requests 240 320 MPI processes, and line 6 requests 24 32 processes per node. Line 7 specifies the number of cores per MPI tasks. Line 8 specifies the amount of memory needed per node. Line 9 specifies the name of the output file (%j
is the job number), and line 8 10 specifies the file to which errors should be written out. Line 9 11 gives the account to which this walltime should be charged.
Line 11 12 is an optional separator between the script directive preamble and the actions in the script.
Lines 1214-17 19 are useful (but optional) diagnostic information that will be printed out.
...