How to install MPICH
Requirements
- A copy of the distribution, mpich.tar.gz. Download the latest stable version of mpich from: https://www.mpich.org/downloads/
- A C compiler. See how to install gcc.
- A Fortran-77, Fortran-90, and/or C++ compiler if you wish to write MPI programs in any of these languages. See how to install gfortran.
Directions
Linux and macOS
- Make sure you are using bash.
echo $SHELLIf it is not bash, command:
bash - Create a folder for mpich
mkdir /home/you/mpich - Unpack mpich-x-y-z.tar.gz to that folder, where x-y-z is the version
tar xfz mpich-x-y-z.tar.gz - Create 2 other folders
mkdir /home/you/mpich/build mkdir /home/you/mpich/mpich-install - Enter the build directory and run the configuration script. It is important to write the full path in the prefix argument.
cd /home/you/mpich/build ../mpich-x-y-z/configure --with-device=ch4:ofi -prefix=/home/you/mpich/mpich-install 2>&1 | tee c.txt - Build mpich. Run command and go for a coffee:
make 2>&1 | tee m.txt - Install MPICH.
make install 2>&1 | tee mi.txt - Add the bin subdirectory of the installation directory to your path:
export PATH=/home/you/mpich/mpich-install/bin:$PATH - Check if the installation went well:
which mpicc which mpiexec - Test mpi in your machine by using the example file that the building process creates. That simple program computes the value of PI. While still inside the build folder, command:
mpiexe -n NC ./examples/cpiwhere NC is the number of cores of your machine.
Windows
You should install Microsoft MPI instead. See how to install Microsoft MPI.
Leave a comment