10.3.5. Freeing Errorhandlers and Retrieving Error Strings

PreviousUpNext
Up: Error Handling Next: Error Codes and Classes Previous: Error Handlers for Sessions

MPI_ERRHANDLER_FREE(errhandler)
INOUT errhandler MPI error handler (handle)
C binding
int MPI_Errhandler_free(MPI_Errhandler *errhandler)
Fortran 2008 binding
MPI_Errhandler_free(errhandler, ierror)

TYPE(MPI_Errhandler), INTENT(INOUT) :: errhandler
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
Fortran binding
MPI_ERRHANDLER_FREE(ERRHANDLER, IERROR)

INTEGER ERRHANDLER, IERROR

Marks the error handler associated with errhandler for deallocation and sets errhandler to MPI_ERRHANDLER_NULL. The error handler will be deallocated after all the objects associated with it (communicator, window, or file) have been deallocated.

MPI_ERROR_STRING(errorcode, string, resultlen)
IN errorcodeError code returned by an MPI routine
OUT stringText that corresponds to the errorcode
OUT resultlenLength (in printable characters) of the result returned in string
C binding
int MPI_Error_string(int errorcode, char *string, int *resultlen)
Fortran 2008 binding
MPI_Error_string(errorcode, string, resultlen, ierror)

INTEGER, INTENT(IN) :: errorcode
CHARACTER(LEN=MPI_MAX_ERROR_STRING), INTENT(OUT) :: string
INTEGER, INTENT(OUT) :: resultlen
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
Fortran binding
MPI_ERROR_STRING(ERRORCODE, STRING, RESULTLEN, IERROR)

INTEGER ERRORCODE, RESULTLEN, IERROR
CHARACTER*(*) STRING

Returns the error string associated with an error code or class. The argument string must represent storage that is at least MPI_MAX_ERROR_STRING characters long. The number of characters actually written is returned in the output argument, resultlen. This function must always be thread-safe, as defined in Section MPI and Threads. It is one of the few routines that may be called before MPI is initialized or after MPI is finalized.


Rationale.

The form of this function was chosen to make the Fortran and C bindings similar. A version that returns a pointer to a string has two difficulties. First, the return string must be statically allocated and different for each error message (allowing the pointers returned by successive calls to MPI_ERROR_STRING to point to the correct message). Second, in Fortran, a function declared as returning CHARACTER*(*) can not be referenced in, for example, a PRINT statement. ( End of rationale.)


PreviousUpNext
Up: Error Handling Next: Error Codes and Classes Previous: Error Handlers for Sessions


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