User Tools

Site Tools


Submit your OpenMPI job with SLURM

OpenMPI is built on Magi with SLURM support. To use OpenMPI, you must load the correspondig module. Feel free to browse the /softs/modules/compiled/gcc/<gcc_version>/openmpi/ to check available versions of OpenMPI. For example :

 nicolas.greneche@magi3:~$ module load /softs/modules/compiled/gcc/10.2.1/openmpi/4.1.2

Then, you can compile your OpenMPI codes :

 nicolas.greneche@magi3:~$ mpicc -o hellompi hellompi.c

The last step is to write a submission script for slurm (here run.slurm) :

 #SBATCH --job-name=hello
 #SBATCH --output=slurm.out
 #SBATCH --error=slurm.err
 #SBATCH --mail-type=end
 #SBATCH --nodes=2
 #SBATCH --ntasks-per-node=2
 srun ./hellompi

You can refer to this documentation for more informations on job submission. This run an OpenMPI job on two nodes (–nodes=2) with two tasks per node (–ntasks-per-node=2). it leads to a total of four MPI process (or workers).

openmpi.txt · Last modified: 2022/03/25 17:50 by nico