Skip to content

Submission Script Templates

The scripts below can be run on the platform as is. You can expand them with parameters from Slurm Parameters and your own workflows!

All Scripts are also available on GitHub here.

If you want to download a specific script you can right click the link below the script of choice and choose "Save link as" to download on your local device, or choose "Copy link" and then download it from a login node using wget followed by the link:

wget <copied-link>

Important

When you use the templates below please do not increase the values of --nodes, –ntasks, --cpus-per-task or --ntasks-per-node randomly to any value >1, especially if your job can’t run in parallel. Your job may wait longer in the queue for resources you don’t need, also your priority factor will decrease, affecting the start time of your future jobs.

Info

You can comment out (adding another #) or just remove any #SBATCH line you don’t need as long as it’s not mandatory, then the default values will apply.

CPU Job

#!/bin/bash -l

############# SLURM SETTINGS #############
#SBATCH --job-name=myjob        # some descriptive job name of your choice
#SBATCH --partition=cpu         # which partition to use, default "cpu"
#SBATCH --time=0-01:00:00       # time limit for the whole run, in the form of d-hh:mm:ss
#SBATCH --mem=1G                # memory required per node, in the form of [num][M|G|T]
#SBATCH --nodes=1               # number of nodes to allocate, default is 1
#SBATCH --ntasks=1              # number of Slurm tasks to be launched, increase for multi-process runs ex. MPI
#SBATCH --cpus-per-task=1       # number of processor cores to be assigned for each task, default is 1, increase for multi-threaded runs
#SBATCH --ntasks-per-node=1     # number of tasks to be launched on each allocated node

############# SOFTWARE SETUP #############
#module load xxx
#export PATH="$PATH:/mnt/home/guid/software/xxx/bin"

############# MY CODE #############
echo "Hello from $SLURM_JOB_NODELIST"

Download

#!/bin/bash -l

############# SLURM SETTINGS #############
#SBATCH --job-name=myjob        # some descriptive job name of your choice
#SBATCH --partition=cpu         # which partition to use, default "cpu"
#SBATCH --time=0-01:00:00       # time limit for the whole run, in the form of d-hh:mm:ss
#SBATCH --mem=1G                # memory required per node, in the form of [num][M|G|T]
#SBATCH --nodes=1               # number of nodes to allocate, default is 1
#SBATCH --ntasks=1              # number of Slurm tasks to be launched, increase for multi-process runs ex. MPI
#SBATCH --cpus-per-task=1       # number of processor cores to be assigned for each task, default is 1, increase for multi-threaded runs
#SBATCH --ntasks-per-node=1     # number of tasks to be launched on each allocated node

############# SOFTWARE SETUP #############
#module load xxx
#export PATH="$PATH:/mnt/home/guid/software/xxx/bin"

############# MY CODE #############
echo "Hello from $SLURM_JOB_NODELIST"

Download

#!/bin/bash -l

############# SLURM SETTINGS #############
#SBATCH --account=project1234   # account name (mandatory), if the job runs under a project then it'll be the project name, if not then it should =none
#SBATCH --job-name=myjob        # some descriptive job name of your choice
#SBATCH --output=%x-%j.out      # output file name will contain job name + job ID
#SBATCH --error=%x-%j.err       # error file name will contain job name + job ID
#SBATCH --partition=gpu         # which partition to use, default on MARS is “nodes", "gpu" partition is for A40 GPUs, "gpuplus" is for A100 GPUs (if you've got access to)
#SBATCH --gres=gpu
#SBATCH --time=0-01:00:00       # time limit for the whole run, in the form of d-hh:mm:ss, also accepts mm, mm:ss, hh:mm:ss, d-hh, d-hh:mm
#SBATCH --mem=1G                # memory required per node, in the form of [num][M|G|T]
#SBATCH --nodes=1               # number of nodes to allocate, default is 1
#SBATCH --ntasks=1              # number of Slurm tasks to be launched, increase for multi-process runs ex. MPI
#SBATCH --cpus-per-task=1       # number of processor cores to be assigned for each task, default is 1, increase for multi-threaded runs
#SBATCH --ntasks-per-node=1     # number of tasks to be launched on each allocated node

############# LOADING MODULES (optional) #############
#module load apps/xxx
#module load libs/xxx

############# MY CODE #############
echo "Hello from $SLURM_JOB_NODELIST"

Download

GPU Job

#!/bin/bash -l

############# SLURM SETTINGS #############
#SBATCH --job-name=myjob        # some descriptive job name of your choice
#SBATCH --partition=gpu         # which partition to use, default "cpu"
#SBATCH --time=0-01:00:00       # time limit for the whole run, in the form of d-hh:mm:ss
#SBATCH --mem=1G                # memory required per node, in the form of [num][M|G|T]
#SBATCH --nodes=1               # number of nodes to allocate, default is 1
#SBATCH --ntasks=1              # number of Slurm tasks to be launched, increase for multi-process runs ex. MPI
#SBATCH --cpus-per-task=1       # number of processor cores to be assigned for each task, default is 1, increase for multi-threaded runs
#SBATCH --ntasks-per-node=1     # number of tasks to be launched on each allocated node
#SBATCH --gres=gpu:gtx1080:1    # type and number of GPU, in the format gpu:[type]:[num]

############# SOFTWARE SETUP #############
#module load xxx
#export PATH="$PATH:/mnt/home/guid/software/xxx/bin"

############# MY CODE #############
echo "Hello from $SLURM_JOB_NODELIST"
nvidia-smi

Download

#!/bin/bash -l

############# SLURM SETTINGS #############
#SBATCH --job-name=myjob        # some descriptive job name of your choice
#SBATCH --partition=gpu         # which partition to use, default "cpu"
#SBATCH --time=0-01:00:00       # time limit for the whole run, in the form of d-hh:mm:ss
#SBATCH --mem=1G                # memory required per node, in the form of [num][M|G|T]
#SBATCH --nodes=1               # number of nodes to allocate, default is 1
#SBATCH --ntasks=1              # number of Slurm tasks to be launched, increase for multi-process runs ex. MPI
#SBATCH --cpus-per-task=1       # number of processor cores to be assigned for each task, default is 1, increase for multi-threaded runs
#SBATCH --ntasks-per-node=1     # number of tasks to be launched on each allocated node
#SBATCH --gres=gpu:rtx6000:1    # type and number of GPU, in the format gpu:[type]:[num]

############# SOFTWARE SETUP #############
#module load xxx
#export PATH="$PATH:/mnt/home/guid/software/xxx/bin"

############# MY CODE #############
echo "Hello from $SLURM_JOB_NODELIST"
nvidia-smi

Download

#!/bin/bash -l

############# SLURM SETTINGS #############
#SBATCH --account=project1234   # account name (mandatory), if the job runs under a project then it'll be the project name, if not then it should =none
#SBATCH --job-name=myjob        # some descriptive job name of your choice
#SBATCH --output=%x-%j.out      # output file name will contain job name + job ID
#SBATCH --error=%x-%j.err       # error file name will contain job name + job ID
#SBATCH --partition=gpu         # which partition to use, default on MARS is “nodes", "gpu" partition is for A40 GPUs, "gpuplus" is for A100 GPUs (if you've got access to)
#SBATCH --gres=gpu
#SBATCH --time=0-01:00:00       # time limit for the whole run, in the form of d-hh:mm:ss, also accepts mm, mm:ss, hh:mm:ss, d-hh, d-hh:mm
#SBATCH --mem=1G                # memory required per node, in the form of [num][M|G|T]
#SBATCH --nodes=1               # number of nodes to allocate, default is 1
#SBATCH --ntasks=1              # number of Slurm tasks to be launched, increase for multi-process runs ex. MPI
#SBATCH --cpus-per-task=1       # number of processor cores to be assigned for each task, default is 1, increase for multi-threaded runs
#SBATCH --ntasks-per-node=1     # number of tasks to be launched on each allocated node

############# LOADING MODULES (optional) #############
#module load apps/xxx
#module load libs/xxx

############# MY CODE #############
echo "Hello from $SLURM_JOB_NODELIST"

Download

Array Job

#!/bin/bash -l

############# SLURM SETTINGS #############
#SBATCH --job-name=myjob        # some descriptive job name of your choice
#SBATCH --partition=cpu         # which partition to use, default "cpu"
#SBATCH --time=0-01:00:00       # time limit for the whole run, in the form of d-hh:mm:ss
#SBATCH --mem=1G                # memory required per node, in the form of [num][M|G|T]
#SBATCH --nodes=1               # number of nodes to allocate, default is 1
#SBATCH --ntasks=1              # number of Slurm tasks to be launched, increase for multi-process runs ex. MPI
#SBATCH --cpus-per-task=1       # number of processor cores to be assigned for each task, default is 1, increase for multi-threaded runs
#SBATCH --ntasks-per-node=1     # number of tasks to be launched on each allocated node
#SBATCH --array=1-10            # create job array of 10 tasks numbered 1 through 10

############# SOFTWARE SETUP #############
#module load xxx
#export PATH="$PATH:/mnt/home/guid/software/xxx/bin"

############# MY CODE #############
echo "Hello from $SLURM_JOB_NODELIST"
echo "This is task $SLURM_ARRAY_TASK_ID out of $SLURM_ARRAY_TASK_COUNT"
echo "Jobs are between $SLURM_ARRAY_TASK_MIN and $SLURM_ARRAY_TASK_MAX"

Download

#!/bin/bash -l

############# SLURM SETTINGS #############
#SBATCH --job-name=myjob        # some descriptive job name of your choice
#SBATCH --partition=cpu         # which partition to use, default "cpu"
#SBATCH --time=0-01:00:00       # time limit for the whole run, in the form of d-hh:mm:ss
#SBATCH --mem=1G                # memory required per node, in the form of [num][M|G|T]
#SBATCH --nodes=1               # number of nodes to allocate, default is 1
#SBATCH --ntasks=1              # number of Slurm tasks to be launched, increase for multi-process runs ex. MPI
#SBATCH --cpus-per-task=1       # number of processor cores to be assigned for each task, default is 1, increase for multi-threaded runs
#SBATCH --ntasks-per-node=1     # number of tasks to be launched on each allocated node
#SBATCH --array=1-10            # create job array of 10 tasks numbered 1 through 10

############# SOFTWARE SETUP #############
#module load xxx
#export PATH="$PATH:/mnt/home/guid/software/xxx/bin"

############# MY CODE #############
echo "Hello from $SLURM_JOB_NODELIST"
echo "This is task $SLURM_ARRAY_TASK_ID out of $SLURM_ARRAY_TASK_COUNT"
echo "Jobs are between $SLURM_ARRAY_TASK_MIN and $SLURM_ARRAY_TASK_MAX"

Download

#!/bin/bash -l

############# SLURM SETTINGS #############
#SBATCH --account=project1234   # account name (mandatory), if the job runs under a project then it'll be the project name, if not then it should =none
#SBATCH --job-name=myjob        # some descriptive job name of your choice
#SBATCH --output=%x-%J.out      # output file name will contain job name + job ID
#SBATCH --error=%x-%J.err       # error file name will contain job name + job ID
#SBATCH --time=0-01:00:00       # time limit for the whole run, in the form of d-hh:mm:ss, also accepts mm, mm:ss, hh:mm:ss, d-hh, d-hh:mm
#SBATCH --mem=1G                # memory required per node, in the form of [num][M|G|T]
#SBATCH --ntasks=1              # number of Slurm tasks to be launched, increase for multi-process runs ex. MPI
#SBATCH --cpus-per-task=1       # number of processor cores to be assigned for each task, default is 1, increase for multi-threaded runs
#SBATCH --ntasks-per-node=1     # number of tasks to be launched on each allocated node
#SBATCH --array=1-10            # create job array of 10 tasks numbered 1 through 10

############# LOADING MODULES (optional) #############
#module load apps/xxx
#module load libs/xxx

############# MY CODE #############
echo "This is array ID no $SLURM_ARRAY_TASK_ID"

Download