How do you check the version of OpenMPI?

With OpenMPI, the easiest thing to do is to run ompi_info; the first few lines will give you the information you want. In your own code, if you don't mind something OpenMPI specific, you can look at use OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION, and OMPI_RELEASE_VERSION in mpi.h. That obviously won't work with MPICH2 or other MPI implementations.

More standardly, as part of MPI-3, there is a standard MPI routine called MPI_Get_library_version which gives you detailed library information at run time. This is small enough and useful enough that newer versions of MPI implementations will have this very quickly - for instance it's in the OpenMPI 1.7 development trunk - but it doesn't really help you today.


As explained in this tutorial, you may also check the MPI version running the command:

mpiexec --version

or

mpirun --version

in your terminal.


I am not familier with OpenMPI but MPI has a function MPI_Get_Version, please check your mpi.h for similar functions.


You can also get the version of OpenMPI that the compiler wrapper (e.g. mpicxx/mpic++/mpicc/mpifort) comes from:

mpicxx --showme:version

This can be useful if (for any reason) you have different versions of MPI compiler wrapper and executor.

(Just mpicxx --showme will additionally show you where MPI is installed and which compiler flags uses, see the manual for more.)

Tags:

Openmpi