Installation/HowTo Pstream

From OpenFOAMWiki

All OpenFOAM applications do parallel communication through the Pstream library only so using any underlying message passing library (MPI, GAMMA) is just a matter of replacing Pstream. One can have multiple versions and just change the LD_LIBRARY_PATH to pick up the wanted one.

- in your ~/.OpenFOAM-1.XXX/bashrc define (or uncomment) WM_MPLIB to be the name of your message passing library. E.g.


- in the central OpenFOAM/OpenFOAM-1.XXX/.bashrc set all the additional settings for your WM_MPLIB. The only non-optional setting is


which is the place where the Pstream library will be put.

- in your rules directory ($WM_DIR/rules/$WM_ARCH) make a mplib${WM_MPLIB} file. In my example: mplibMPIGAMMA. Usually easiest to start from e.g. the OpenMPI one.

- go to $FOAM_SRC/Pstream


- this will have made a $FOAM_MPI_LIBBIN/

That is all. Now all of OpenFOAM will use your communication library.

If you are investigating higher performance replacements for e.g. OpenMPI,LAM, have a look at Open-MX or MPI-GAMMA (

Pstream for HPMPI

Linking the proprietary HP-MPI is slightly more tricky than the standard method described above. In addition to the steps outlined, a symbol needs to be pre-defined to prevent the inclusion of C++ bindings.

After modifying the OpenFOAM login files, copy mplibOPENMPI to mplibHPMPI in $WM_DIR/rules/$WM_ARCH$WM_COMPILER and edit it as follows:

 PINC = -I$(HPMPI_PATH)/include
 PLIBS = -L$(HPMPI_PATH)/lib/linux_amd64 -lmpi

Pre-defining the "_MPICC_H" symbol causes the linker to skip out the section of mpiCC.h that normally causes problems. Why HP have not deigned to include an explicit switch to disable C++ bindings is unclear.

Follow the rest of the steps normally.