How do you check the version of OpenMPI?
openmpi
Solution
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.
Problem
I'm compiling my code on a server that has OpenMPI, but I need to know which version I'm on so I can read the proper documentation. Is there a constant in `<mpi.h>` that I can print to display my current version?