197. 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,

    #define MPI_VERSION    3 
    #define MPI_SUBVERSION 1 
in Fortran,
    INTEGER :: MPI_VERSION, MPI_SUBVERSION 
    PARAMETER (MPI_VERSION    = 3) 
    PARAMETER (MPI_SUBVERSION = 1) 

For runtime determination,

MPI_GET_VERSION( version, subversion )
OUT versionversion number (integer)
OUT subversionsubversion number (integer)

int MPI_Get_version(int *version, int *subversion)

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

MPI_GET_VERSION can be called before MPI_INIT and after MPI_FINALIZE. 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 (3,1), (3,0), (2,2), (2,1), (2,0), and (1,2).

MPI_GET_LIBRARY_VERSION( version, resultlen )
OUT versionversion string (string)
OUT resultlenLength (in printable characters) of the result returned in version (integer)

int MPI_Get_library_version(char *version, int *resultlen)

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
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 before MPI_INIT and after MPI_FINALIZE. 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-3.1 Standard Index
Return to MPI Forum Home Page

(Unofficial) MPI-3.1 of June 4, 2015
HTML Generated on June 4, 2015