This section contains some example scripts that you can adapt to run your jobs. Always refer to the manual at the bottom of the page for a comprehensive overview of the topic.
EXAMPLE 1
The following example submits a parallel MPI job request to the scheduler, requesting 1 compute node (-N 1), running 48 MPI tasks (--ntasks-per-node=48), with no shared-memory parallelization (--cpus-per-task=1) and no hyperthreading (--threads-per-core=1).
#!/usr/bin/env bash
#SBATCH -N 1
#SBATCH --ntasks-per-node=48
#SBATCH --cpus-per-task=1
#SBATCH --threads-per-core=1
#SBATCH --time 0-00:30:00
#SBATCH --partition=cpu_sapphire
#SBATCH --mail-type=ALL
#SBATCH --mail-user=nome.cognome@polito.it
EXAMPLE 2
The following example submits a parallel MPI job request to the scheduler, requesting 2 compute nodes (-N 2), running 48 MPI tasks per node (--ntasks-per-node=48), with no shared-memory parallelization (--cpus-per-task=1) and no hyperthreading (--threads-per-core=1). Specific compute nodes are explicitly requested for the job (--nodelist=compute-X-Y). The executable is then launched using a total of 96 MPI tasks.
#!/usr/bin/env bash
#SBATCH -N 2
#SBATCH --ntasks-per-node=48
#SBATCH --cpus-per-task=1
#SBATCH --threads-per-core=1
#SBATCH --time 0-00:30:00
#SBATCH --partition=cpu_sapphire
#SBATCH --mail-type=ALL
#SBATCH --mail-user=firstname.lastname@polito.it
#SBATCH --nodelist=compute-X-Y,compute-K-Z
EXAMPLE 3
The following example submits a parallel MPI job request to the scheduler, requesting 2 compute nodes (-N 2), running 48 MPI tasks per node (--ntasks-per-node=48), with no shared-memory parallelization (--cpus-per-task=1) and no hyperthreading (--threads-per-core=1). Specific compute nodes are explicitly excluded from the job (--exclude=compute-X-Y). The executable is then launched using a total of 96 MPI tasks.
#!/usr/bin/env bash
#SBATCH -N 2
#SBATCH --ntasks-per-node=48
#SBATCH --cpus-per-task=1
#SBATCH --threads-per-core=1
#SBATCH --time 0-00:30:00
#SBATCH --partition=cpu_sapphire
#SBATCH --mail-type=ALL
#SBATCH --mail-user=firstname.lastname@polito.it
#SBATCH --exclude=compute-X-Y,compute-K-Z
EXAMPLE 4
The following example submits a hybrid MPI-OpenMP job request to the scheduler (see the manual for further details), requesting 1 compute node (-N 1), running 12 MPI tasks per node (--ntasks-per-node=12), with 4 OpenMP threads per task (--cpus-per-task=4) and no hyperthreading (--threads-per-core=1).
#SBATCH -N 1
#SBATCH --ntasks-per-node=12
#SBATCH --cpus-per-task=4
#SBATCH --threads-per-core=1
#SBATCH --time 0-00:30:00
#SBATCH --partition=cpu_sapphire
#SBATCH --mail-type=ALL
#SBATCH --mail-user=firstname.lastname@polito.it
#SBATCH --exclude=compute-X-Y,compute-K-Z
EXAMPLE 5
The following example submits an MPI job using GPUs, requesting 1 compute node (-N 1), running 4 MPI tasks (--ntasks-per-node=4) across 4 GPUs, with no shared-memory parallelization (--cpus-per-task=1) and no hyperthreading (--threads-per-core=1).
#!/usr/bin/env bash
#SBATCH -N 1
#SBATCH --ntasks-per-node=4
#SBATCH --cpus-per-task=1
#SBATCH --threads-per-core=1
#SBATCH --time 0-00:30:00
#SBATCH --gres=gpu:4
#SBATCH --partition=gpu_a40
#SBATCH --mail-type=ALL
#SBATCH --mail-user=firstname.lastname@polito.it
EXAMPLE 6
The following example illustrates how to use the high-performance BeeGFS file system. It automatically transfers the simulation data to $SCRATCH, runs the parallel simulation, and finally transfers the data back to $HOME.
#!/usr/bin/env bash
#SBATCH -N 1
#SBATCH --ntasks-per-node=48
#SBATCH --cpus-per-task=1
#SBATCH --threads-per-core=1
#SBATCH --time 0-00:30:00
#SBATCH --partition=cpu_sapphire
#SBATCH --mail-type=ALL
#SBATCH --mail-user=firstname.lastname@polito.it
module purge
module load openmpi/5.0.7_gcc12
module load {my_module} ## replace {my_module} with the actual module
bashmkdir $SCRATCH/path-to-simulation-directory cp $HOME/path-to-working-directory/* $SCRATCH/path-to-simulation-directory/ cd $SCRATCH/path-to-simulation-directory
mpirun -np 4 my_module_executable [OTHER PARAMETERS]
rsync $SCRATCH/path-to-simulation-directory/* $HOME/path-to-working-directory/