10.1.1. Version Inquiries

PreviousUpNext
Up: Implementation Information Next: Environmental Inquiries Previous: Implementation Information

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,

Image file

in Fortran,

Image file

For runtime determination,

MPI_GET_VERSION(version, subversion)
OUT versionversion number (integer)
OUT subversionsubversion number (integer)
C binding
int MPI_Get_version(int *version, int *subversion)
Fortran 2008 binding
MPI_Get_version(version, subversion, ierror)

INTEGER, INTENT(OUT) :: version, subversion
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
Fortran binding
MPI_GET_VERSION(VERSION, SUBVERSION, IERROR)

INTEGER VERSION, SUBVERSION, IERROR

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 versionversion number (string)
OUT resultlenLength (in printable characters) of the result returned in version (integer)
C binding
int MPI_Get_library_version(char *version, int *resultlen)
Fortran 2008 binding
MPI_Get_library_version(version, resultlen, ierror)

CHARACTER(LEN=MPI_MAX_LIBRARY_VERSION_STRING), INTENT(OUT) :: version
INTEGER, INTENT(OUT) :: resultlen
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
Fortran binding
MPI_GET_LIBRARY_VERSION(VERSION, RESULTLEN, IERROR)

CHARACTER*(*) VERSION
INTEGER RESULTLEN, IERROR

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.


PreviousUpNext
Up: Implementation Information Next: Environmental Inquiries Previous: Implementation Information


Return to MPI-4.1 Standard Index
Return to MPI Forum Home Page

(Unofficial) MPI-4.1 of November 2, 2023
HTML Generated on November 19, 2023