MPI_ADD_ERROR_STRING(3)
π MPI_Add_error_string β bestie edition π
okay so. you know how MPI errors are like "code 47, good luck lol"? this is the girl who fixes that. it's in the Open MPI manual, and it's lowkey iconic.
β¨ NAME β¨
MPI_Add_error_string β associates a string with an error code or class π
π SYNTAX π
C Syntax
#include <mpi.h>
int MPI_Add_error_string(int errorcode, const char *string)
Fortran Syntax
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_ADD_ERROR_STRING(ERRORCODE, STRING, IERROR)
INTEGER ERRORCODE, IERROR
CHARACTER*(*) STRING
Fortran 2008 Syntax
USE mpi_f08
MPI_Add_error_string(errorcode, string, ierror)
INTEGER, INTENT(IN) :: errorcode
CHARACTER(LEN=*), INTENT(IN) :: string
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
πΈ INPUT PARAMETERS πΈ
errorcodeβ an MPI error class, or an error code that some MPI routine handed back to you (integer). the whole point, fr.stringβ the text that goes with that error code or class (string). your lil label <3
π«Ά OUTPUT PARAMETER π«Ά
ierrorβ Fortran only: error status (integer).
π DESCRIPTION π
this routine associates an error string with an error code or class. that's it. that's the vibe. π¦
if you call MPI_Add_error_string for an error code or class that already has an associated error string, it will replace the old string with the new one. glow-up, essentially. old string out, new string in, no drama.
β οΈ bestie listen. it is erroneous to callMPI_Add_error_stringfor an error value not generated viaMPI_Add_error_classorMPI_Add_error_codeβ like, an error code or class with a value not greater thanMPI_LAST_ERRCODE. that's not a "haha whoops" situation, that's a no. don't do it. π
π ERRORS π
almost all MPI routines return an error value β C routines hand it back as the return result of the function, and Fortran routines put it in the last argument.
before the error value is returned, the current MPI error handler associated with the communication object (e.g., communicator, window, file) is called. if no communication object is associated with the MPI call, then the call is considered attached to MPI_COMM_SELF and will call the associated MPI error handler. when MPI_COMM_SELF is not initialized (i.e., before MPI_Init/MPI_Init_thread, after MPI_Finalize, or when using the Sessions Model exclusively) the error raises the initial error handler. the initial error handler can be changed by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when using the World model, or the mpi_initial_errhandler CLI argument to mpiexec or info key to MPI_Comm_spawn/MPI_Comm_spawn_multiple. if no other appropriate error handler has been set, then the MPI_ERRORS_RETURN error handler is called for MPI I/O functions and the MPI_ERRORS_ABORT error handler is called for all other MPI functions.
π the three predefined error handlers Open MPI ships with π
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. rip to everyone, collectively.MPI_ERRORS_ABORTβ an error handler that can be invoked on a communicator, window, file, or session. when called on a communicator, it acts as ifMPI_Abortwas called on that communicator. if called on a window or file, acts as ifMPI_Abortwas called on a communicator containing the group of processes in the corresponding window or file. if called on a session, aborts only the local process (just you, solo π ).MPI_ERRORS_RETURNβ returns an error code to the application. the chill one.
π roll your own handler π
MPI applications can also implement their own error handlers by calling:
MPI_Comm_create_errhandlerthenMPI_Comm_set_errhandlerMPI_File_create_errhandlerthenMPI_File_set_errhandlerMPI_Session_create_errhandlerthenMPI_Session_set_errhandleror atMPI_Session_initMPI_Win_create_errhandlerthenMPI_Win_set_errhandler
note that MPI does not guarantee that an MPI program can continue past an error. no promises, no cap. π«
see the MPI man page for a full list of MPI error codes.
see the Error Handling section of the MPI-3.1 standard for more information.
π SEE ALSO π
MPI_Add_error_classMPI_Add_error_codeMPI_Error_classMPI_Error_string
β Copyright β
2003-2026, The Open MPI Community
and that's the whole page, bestie π thanks for reading all the way to the end β this one was MPI_ADD_ERROR_STRING(3) from Open MPI, dated Sep 10, 2026. slay, go label your errors. πβ¨π¦
π¦ where this page comes from
- ubuntu stonking: openmpi-doc 5.0.10-6 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms