Parallelization MPI

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

# Compatible with the Infiniband network
ml openmpi/5.0.8_gcc11.5.0
# Compatible with the Infiniband network and the Omnipath network
ml openmpi/5.0.8_gcc11.5.0_no-ucx

Available versions :

  • 5.0.8 (through gcc 11.5.0)

MPICH (to update)

ml gnu12
ml mpich
  • Available version : 3.4.3-ofi

MVAPICH2 (to update)

ml gnu12
ml mvapich2

Available versions :

  • 2.3.6 (via compiler/gnu9)
  • 2.3.7 (via gnu12)

impi

ml gcc/15.2.0
ml mpi/2021.16

Available versions :

  • 2021.16 (default)

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 openmpi/5.0.8_gcc11.5.0_no-ucx
$ 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.
--------------------------------------------------------------------------

The following of the tutorial is to update

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