In order to cope with changes to the MPI standard, there are both compile-time and run-time ways to determine which version of the standard is in use in the environment one is using.
The ``version'' will be represented by two separate integers, for the version and subversion: In C,
in Fortran,
For runtime determination,
MPI_GET_VERSION(version, subversion) | |
OUT version | version number (integer) |
OUT subversion | subversion number (integer) |
MPI_GET_VERSION can be called at any time in an MPI program. This function must always be thread-safe, as defined in Section MPI and Threads. Valid ( MPI_VERSION, MPI_SUBVERSION) pairs in this and previous versions of the MPI standard are (4,1), (4,0), (3,1), (3,0), (2,2), (2,1), (2,0), and (1,2).
MPI_GET_LIBRARY_VERSION(version, resultlen) | |
OUT version | version number (string) |
OUT resultlen | Length (in printable characters) of the result returned in version (integer) |
This routine returns a string representing the version of the MPI library. The version argument is a character string for maximum flexibility.
Advice
to implementors.
An implementation of MPI should return a different
string for every change to its source code or build that could be visible
to the user.
( End of advice to implementors.)
The argument version must represent storage that is MPI_MAX_LIBRARY_VERSION_STRING characters
long. MPI_GET_LIBRARY_VERSION may write up
to this many characters into version.
The number of characters actually written is returned in the output argument, resultlen. In C, a null character is additionally stored at version[resultlen]. The value of resultlen cannot be larger than MPI_MAX_LIBRARY_VERSION_STRING - 1. In Fortran, version is padded on the right with blank characters. The value of resultlen cannot be larger than MPI_MAX_LIBRARY_VERSION_STRING.
MPI_GET_LIBRARY_VERSION can be called at any time in an MPI program. This function must always be thread-safe, as defined in Section MPI and Threads.