From NA-Wiki

Jump to: navigation, search

OpenMPI is a recent MPI 2.0 implementation. It works very nicely on a multi-core workstation as well as on a big cluster. OpenMPI has a communication layer for shared memory so it may run on the memory bus instead of across the network. Note that MPI 2.0 provides C++ and F90 bindings as well as C and F77.

Installing on Ubuntu

There are packages available:

> sudo apt-get install 'openmpi-*'

Building MPI applications

See the OpenMPI FAQ section for compiling. Link

The following compiler wrappers are available (for the indicated languages):

  • mpicc
  • mpic++
  • mpif77
  • mpif90

These will by default invoke GNU compilers. To get other compilers simply set the following environment variables as e.g.:

Intel ifort for F77 setenv OMPI_MPIF77 "ifort"
Intel ifort for F90 setenv OMPI_MPIFC "ifort"
Intel icc for C setenv OMPI_MPICC "icc"
Intel icc for C++ setenv OMPI_MPICXX "icc"

Running your MPI program

See the OpenMPI FAQ section for running. Link

As usual, the launcher command is mpirun.

> mpirun -np 2 ./a.out

However, mpirun may attempt to use the Infiniband transport layer (resulting in an annoying runtime warning). The solution is to specify the shared memory (sm) bit transport layer (btl) and to run on localhost:

> mpirun -np 2 --host localhost --mca btl sm ./a.out
Personal tools