Skip to content

Example job scripts

Example job scripts

Serial batch script

#!/bin/bash -l

#SBATCH --job-name=serial # Job name
#SBATCH --partition=cpu # Partition
#SBATCH --nodes=1 # Number of nodes
#SBATCH --ntasks-per-node=1 # Number of cores
#SBATCH --output=job.%j.out # Stdout (%j=jobId)
#SBATCH --error=job.%j.err # Stderr (%j=jobId)
#SBATCH -A ops # Accounting project

# Load any necessary modules
module load GGG/10.2.0

# Launch the executable exe.out
./exe.out

MPI batch script

#!/bin/bash -l

#SBATCH --job-name=serial # Job name
#SBATCH --partition=cpu # Partition
#SBATCH --nodes=6 # Number of nodes
#SBATCH --ntasks-per-node=40 # Number of cores
#SBATCH --output=job.%j.out # Stdout (%j=jobId)
#SBATCH --error=job.%j.err # Stderr (%j=jobId)
#SBATCH --time=24:00:00 # Walltime
#SBATCH -A ops # Accounting project

# Load any necessary modules
module load OpenMPI/4.0.5-GCC-10.2.0

# Launch the executable exe.out
srun ./exe.out

Note: Users can use mpirun instead of srun.

GPU batch script

#!/bin/bash -l

#SBATCH --job-name=serial # Job name
#SBATCH --partition=cpu # Partition
#SBATCH --nodes=1 # Number of nodes
#SBATCH --gres=gpu:4 # Number of GPUs
#SBATCH --ntasks-per-node=4  # Number of tasks
#SBATCH --output=job.%j.out # Stdout (%j=jobId)
#SBATCH --error=job.%j.err # Stderr (%j=jobId)
#SBATCH --time=12:00:00 # Walltime
#SBATCH -A ops # Accounting project

# Load any necessary modules, in this case OpenMPI with CUDA
module load OpenMPI/4.0.5-gcccuda-2020b

# Launch the executable exe.out
srun ./exe.out