...
If no specific requests regarding the number of tasks has been done, mpirun
defaults to hyperthreading and starts cores*2
processes. If a number of tasks has been specified (either with -n
or with -N
and/or --tasks-per-node
), an (Open) mpirun
honors this via the flag -map-by. For example:
Codeblock |
---|
language | bash |
---|
title | Hyperthreading active, 80/192 Processes per Node will be started |
---|
collapse | true |
---|
|
#!/bin/bash
#SBATCH -N 4
module load gcc/9.23.0 openmpi/gcc.9/34.1.54
cpus_per_node=${SLURM_JOB_CPUS_PER_NODE%\(*}
export OMP_NUM_THREADS=$((
mpirun -map-by ppr:$cpus_per_node*$SLURM_JOB_NUM_NODES))
mpirun node:node ./yourexe |
Codeblock |
---|
language | bash |
---|
title | Hyperthreading disabled, 96 processes per node are started. |
---|
collapse | true |
---|
|
#!/bin/bash
#SBATCH -N 4
#SBATCH --tasks-per-node 96
module load gcc/9.23.0 openmpi/gcc.9/34.1.54
tasks_per_node=${SLURM_TASKS_PER_NODE%\(*}
export OMP_NUM_THREADS=$((
mpirun -map-by ppr:$tasks_per_node*$SLURM_JOB_NUM_NODES))
mpirunnode:node ./yourexe |