Table of Contents
Installation of MPI on Linux
There are 2 main implementations of MPI MPICH and Open MPI.
Below is the installation for open MPI.
For mpich See this link.
Installation
Type in a terminal:
sudo apt-get install libopenmpi-dev openmpi-bin
Small test
Download the file below.
- hello_world.f90
! Fortran example program hello include 'mpif.h' integer rank, size, ierror, tag, status(MPI_STATUS_SIZE) call MPI_INIT(ierror) call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierror) call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierror) print*, 'node', rank, ': Hello world' call MPI_FINALIZE(ierror) end
Type in a terminal:
mpif90 hello_world.f90 -o hello_world
mpiexec -n 4 ./hello_world
It should display:
node 0 : Hello world node 1 : Hello world node 2 : Hello world node 3 : Hello world