7.3. Error codes and classes

Up: MPI Environmental Management Next: Timers and synchronization Previous: Error handling

The error codes returned by MPI are left entirely to the implementation (with the exception of MPI_SUCCESS). This is done to allow an implementation to provide as much information as possible in the error code (for use with MPI_ERROR_STRING).

To make it possible for an application to interpret an error code, the routine MPI_ERROR_CLASS converts any error code into one of a small set of standard error codes, called error classes. Valid error classes include

MPI_ERR_BUFFERInvalid buffer pointer
MPI_ERR_COUNTInvalid count argument
MPI_ERR_TYPEInvalid datatype argument
MPI_ERR_TAGInvalid tag argument
MPI_ERR_COMMInvalid communicator
MPI_ERR_RANKInvalid rank
MPI_ERR_REQUESTInvalid request (handle)
MPI_ERR_ROOTInvalid root
MPI_ERR_GROUPInvalid group
MPI_ERR_OPInvalid operation
MPI_ERR_TOPOLOGYInvalid topology
MPI_ERR_DIMSInvalid dimension argument
MPI_ERR_ARGInvalid argument of some other kind
MPI_ERR_UNKNOWNUnknown error
MPI_ERR_TRUNCATEMessage truncated on receive
MPI_ERR_OTHERKnown error not in this list
MPI_ERR_INTERNInternal MPI (implementation) error
MPI_ERR_IN_STATUSError code is in status
MPI_ERR_PENDINGPending request
MPI_ERR_LASTCODELast error code

The error classes are a subset of the error codes: an MPI function may return an error class number; and the function MPI_ERROR_STRING can be used to compute the error string associated with an error class.

The error codes satisfy,

0 = constMPI_SUCCESS < constMPI_ERR_... leq constMPI_ERR_LASTCODE.


The difference between MPI_ERR_UNKNOWN and MPI_ERR_OTHER is that MPI_ERROR_STRING can return useful information about MPI_ERR_OTHER.

Note that MPI_SUCCESS = 0 is necessary to be consistent with C practice; the separation of error classes and error codes allows us to define the error classes this way. Having a known LASTCODE is often a nice sanity check as well. ( End of rationale.)
MPI_ERROR_CLASS( errorcode, errorclass )
IN errorcodeError code returned by an MPI routine
OUT errorclassError class associated with errorcode

int MPI_Error_class(int errorcode, int *errorclass)


The function MPI_ERROR_CLASS maps each standard error code (error class) onto itself.

Up: MPI Environmental Management Next: Timers and synchronization Previous: Error handling

Return to MPI 1.1 Standard Index
Return to MPI 2.0 Standard Index
Return to MPI Forum Home Page

MPI-1.1 of June 12, 1995
HTML Generated on November 1, 2000