Building an MPI library : Différence entre versions

De LMDZPedia
Aller à : navigation, rechercher
Ligne 1 : Ligne 1 :
There are a few freely available MPI libraries around; among the most widely spread are the OpenMPI and MPICH libraries
+
There are a few freely available MPI libraries around; among the most widely spread are the OpenMPI https://www.open-mpi.org/ and MPICH https://www.mpich.org/ libraries
  
 
== Checking if you have an Fortran enabled MPI library already installed and at hand ==
 
== Checking if you have an Fortran enabled MPI library already installed and at hand ==
Ligne 32 : Ligne 32 :
 
$PATH_OPENMPI/openmpi-1.10.3/bin/mpif90 -V
 
$PATH_OPENMPI/openmpi-1.10.3/bin/mpif90 -V
 
</syntaxhighlight>
 
</syntaxhighlight>
returns something meaningful
+
returns something meaningful like
 +
<syntaxhighlight lang="bash">
 +
GNU Fortran (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
 +
Copyright (C) 2019 Free Software Foundation, Inc.
 +
This is free software; see the source for copying conditions.  There is NO
 +
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 +
</syntaxhighlight>
  
== Worth knowing about ==
+
== A few things worth knowing about ==
 
* '''mpif90''' is just a wrapper around a given compiler which could be gfortran, ifort, pgfortran, etc. to know more about that run
 
* '''mpif90''' is just a wrapper around a given compiler which could be gfortran, ifort, pgfortran, etc. to know more about that run
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Ligne 42 : Ligne 48 :
 
* It is vital to use the '''mpirun''' command from the same package than the '''mpif90''' compilation wrapper use to compile. Otherwise one can get some really weird results...  
 
* It is vital to use the '''mpirun''' command from the same package than the '''mpif90''' compilation wrapper use to compile. Otherwise one can get some really weird results...  
  
03/01/2022
+
05/01/2022
  
 
[[Category:HowTo]]
 
[[Category:HowTo]]
 
[[Category:WhatIs]]
 
[[Category:WhatIs]]

Version du 5 janvier 2023 à 17:35

There are a few freely available MPI libraries around; among the most widely spread are the OpenMPI https://www.open-mpi.org/ and MPICH https://www.mpich.org/ libraries

Checking if you have an Fortran enabled MPI library already installed and at hand

This can easily be done by checking if the MPI wrapper mpif90 is available, i.e. that

which mpif90

returns something meaningful

using a package manager

If you have sudo privileges and are on an Ubuntu or Linux Mint machine you should be able to install the OpenMPI library with

sudo apt install libopenmpi-dev openmpi-bin

Example of personal installation of the the OpenMPI library

To adapt to fit your onw needs and system specificities, obviously. In the example below the installation is done in the $HOME/LMDZ directory (for convenience this path is stored in the PATH_OPENMPI variable.

PATH_OPENMPI=$HOME/LMDZ/
mkdir -p $PATH_OPENMPI
cd $PATH_OPENMPI
wget https://www.open-mpi.org/software/ompi/v1.10/downloads/openmpi-1.10.3.tar.gz
gunzip openmpi-1.10.3.tar.gz 
tar xvf openmpi-1.10.3.tar 
cd openmpi-1.10.3
./configure --prefix $PATH_OPENMPI/openmpi-1.10.3
make all install

To check that the install went well check that

$PATH_OPENMPI/openmpi-1.10.3/bin/mpif90 -V

returns something meaningful like

GNU Fortran (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

A few things worth knowing about

  • mpif90 is just a wrapper around a given compiler which could be gfortran, ifort, pgfortran, etc. to know more about that run
mpif90 --version
  • in some cases (e.g. with ifort) the Fortran wrapper is called mpiifort , not mpif90
  • It is vital to use the mpirun command from the same package than the mpif90 compilation wrapper use to compile. Otherwise one can get some really weird results...

05/01/2022