...
Beyond the different compiler flavours in offer, we can also choose different MPI implementations for our MPI parallel programs. On the Atos HPCF and ECS, we can choose from the following implementations:
Implementation | Module | Description |
---|---|---|
OpenMPI | openmpi | Standard OpenMPI implementation provided by Atos |
Intel MPI | intel-mpi | Intel's MPI implementation based on MPICH. Part of part of the Intel OneAPI distribution |
HPC-X OpenMPI | hpcx-openmpi | NVIDIA's optimised flavour of OpenMPI. This is the recommended option |
For the next exercise, we will use this adapted hello world code for MPI.
...
Reset your environment with:
No Format module reset
With your favourite editor, create the file
mpiversions.c
with the code above, and compile it into the executablempiversions
. Hint: You may use the modulehpcx-openmpi
.Expand title Solution In order to compile MPI parallel programs, we need to use the MPI wrappers such as
mpicc
for C,mpicxx
/mpic++
for C++ ormpif77
/mpif90
/mpifort
for Fortran code. They will in turn call the corresponding compiler loaded in your environment, and will make sure all the necessary flags to compile and link agains the MPI library are set.These wrappers are made available when you load one of the MPI modules in the system. We will use the default
hpcx-openmpi
.Since we are building a C program, we will use
mpicc
:No Format module load hpcx-openmpi mpicc -o mpiversions mpiversions.c
Write a small batch job that will compile and run the program using 2 processors and submit it to the batch system:
Expand title Solution You may write a job script similar to the following
Code Block language bash title mpiversions.sh #!/bin/bash #SBATCH -J mpiversions #SBATCH -o %x.out #SBATCH -n 2 module load hpcx-openmpi mpicc -o mpiversions mpiversions.c srun ./mpiversions
You may then submit it to the batch system with
sbatch
:No Format sbatch mpiversions.sh
Inspect the output to check what versions of Compiler and MPI are reported
Tweak the previous job to build and run the
mpiversions
program with as many combinations of compiler families and MPI implementations as you can.Expand title Solution You may amend your existing
mpiversions.sh
script with a couple of loops on the prgenvs and MPI implementations:Code Block language bash title mpiversions.sh #!/bin/bash #SBATCH -J mpiversions #SBATCH -o %x.out #SBATCH -n 2 for pe in gnu intel intel-llvm amd; do for mpi in hpcx-openmpi intel-mpi openmpi; do module load prgenv/$pe $mpi module list mpicc -o mpiversions mpiversions.c srun ./mpiversions echo "******************" done done
You may then submit it to the batch system with
sbatch
:No Format sbatch mpiversions.sh
Inspect again the output to check what versions of Compiler and MPI are reported.
...