Project

General

Profile

SLURM batch example

Single task, 32 cores/thread reserved, CPU bound process

We are giving here the example of a single task with 32 cores/thread allocated. The task will be enqueued to the queue called "all". We are also asking SLURM to send us a mail when the task starts, when the task completes and when a task is killed by an error. Finally, we are suggesting to SLURM that the task is mainly CPU bound.
After these directives, we are calling our bash script (which will execute the tasks).

#!/bin/bash
#
#SBATCH --job-name=test-job
#SBATCH --partition=all
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=32
#SBATCH --mail-user=your@email.address
#SBATCH --cpu_bind=rank
#SBATCH --mail-type=ALL
#SBATCH --hint=compute_bound

srun ./my_task_script.sh

We will name this script my_batch_script.sh and will launch it with a

sbatch my_batch_script.sh
.

Mr Bayes MPI (mpich2) task, 44 tasks total, 2 nodes, 22 tasks per node

Write the following batch file (e.g. named my_batch_script.sh)

#!/bin/bash
#
#SBATCH --job-name=MB_vulgaris
#SBATCH --partition=all
#SBATCH --nodes=2
#SBATCH --ntasks=44
#SBATCH --tasks-per-node=22
#SBATCH --mail-user=your@email.address
#SBATCH --mail-type=ALL
##SBATCH --cpu_bind=rank,verbose
##SBATCH --hint=compute_bound

module load mpi/mpich2-slurm
srun /opt/bin/mb_mpich ./linsi_new_candidates.falnt.alter.nex

Now submit your task to the queue with the command:

sbatch my_batch_script.sh