Description
MPI for Message Passing Interface is a high performance scientific computing tool that allows the use of multiple machines. This tool allows distributed memory parallelization and data exchange is done by “message passing”.
Catalog
MPI is available at MatriCS in different variants. Versions of these variants can be available too.
List of MPI variants
The access to variants and the available versions
- All versions are available with loading the module gnu12
- Useful link : search a module
OpenMPI
ml gnu12
# the same thing as : module load gnu12
ml openmpi4
Available versions :
- 4.1.1 (through compiler/gnu9)
- 4.1.4 (through gnu12)
MPICH
ml gnu12
ml mpich
- Available version : 3.4.3-ofi
MVAPICH2
ml gnu12
ml mvapich2
Available versions :
- 2.3.6 (via compiler/gnu9)
- 2.3.7 (via gnu12)
impi
ml gnu12
ml impi
Available versions :
- 2021.7.1 (default)
- 2021.7.0
- 2021.6.0
Tutorial
For using a MPI code, you will have to compile your program and/or run it with certain commands.
For compilation you can use the command mpicc or mpicxx and for running the command mpirun (or mpiexec).
However, these commands are not present in the default environment.
$ mpicxx
-bash: mpicxx : commande introuvable
$ mpicc
-bash: mpicc : commande introuvable
$ mpirun
-bash: mpirun : commande introuvable
You have to load the appropriate module. For example, openmpi.
$ ml gnu12 openmpi4
$ mpicxx
g++: erreur fatale: pas de fichier à l'entrée
compilation terminée.
$ mpicc
gcc: erreur fatale: pas de fichier à l'entrée
compilation terminée.
$ mpirun
--------------------------------------------------------------------------
mpirun could not find anything to do.
It is possible that you forgot to specify how many processes to run
via the "-np" argument.
--------------------------------------------------------------------------
Nevertheless, you can use other MPI libraries such as mpich2.
# In case the openmpi4 module is already loaded
$ ml swap openmpi4 mpich
$ mpicxx
Error: Command line argument is needed!
$ mpicc
Error: Command line argument is needed!
$ mpirun -n 2 echo Hello World
Hello World
Hello World
Here is an example of usage :
$ mpirun -np 4 hostname -s
login01
login01
login01
login01
Documentation
For a detailed explanation of the mpirun or mpiexec command, you can find more information
- on the openmpi website. For example, for version 4.0.
- on the mpich site. For example, for the mpiexec command.