MPI_COMM_SET_ERRHANDLER(3)
π MPI_COMM_SET_ERRHANDLER π
okay bestie, this is a page from the Open MPI manual, and it's about MPI_Comm_set_errhandler β aka the glow-up where you give a communicator a whole new error handler. it's giving "new phone, who dis" but for error handling. π
β¨ NAME β¨
MPI_Comm_set_errhandler β attaches a new error handler to a communicator.
πΈ SYNTAX πΈ
C Syntax
#include <mpi.h>
int MPI_Comm_set_errhandler(MPI_Comm comm,
MPI_Errhandler errhandler)
Fortran Syntax
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_COMM_SET_ERRHANDLER(COMM, ERRHANDLER, IERROR)
INTEGER COMM, ERRHANDLER, IERROR
Fortran 2008 Syntax
USE mpi_f08
MPI_Comm_set_errhandler(comm, errhandler, ierror)
TYPE(MPI_Comm), INTENT(IN) :: comm
TYPE(MPI_Errhandler), INTENT(IN) :: errhandler
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
π¦ INPUT/OUTPUT PARAMETER π¦
commβ the communicator in question, a handle. π
π OUTPUT PARAMETERS π
errhandlerβ the new error handler for your communicator, also a handle. this is the whole point of the call, no cap.ierrorβ Fortran only: error status, and it's an integer. π€
π₯ DESCRIPTION π₯
So MPI_Comm_set_errhandler attaches a new error handler to a communicator. that's it, that's the vibe. but bestie, hear me out on the fine print:
the error handler you pass in has to be either a predefined error handler or one you made yourself by calling MPI_Comm_create_errhandler. those are the only two options, don't get creative.
and listen β this call is identical to MPI_Errhandler_set, and using that one is deprecated. so like, use this one, mkay? π«Ά
π ERRORS π
ngl, almost every MPI routine returns an error value: C routines hand it back as the return result of the function, and Fortran routines put it in that last argument. iconic behavior.
Before the error value gets returned, the current MPI error handler associated with the communication object (think: communicator, window, file) is called. If there's no communication object associated with the MPI call, then the call counts as attached to MPI_COMM_SELF and it'll call the associated MPI error handler. And when MPI_COMM_SELF isn't initialized β meaning before MPI_Init/MPI_Init_thread, after MPI_Finalize, or when you're using the Sessions Model exclusively β the error raises the initial error handler. π
that initial error handler can be changed by:
- calling
MPI_Comm_set_errhandleronMPI_COMM_SELFwhen you're using the World model, or - the
mpi_initial_errhandlerCLI argument tompiexec, or - the info key to
MPI_Comm_spawn/MPI_Comm_spawn_multiple.
and if no other appropriate error handler has been set? then MPI_ERRORS_RETURN gets called for MPI I/O functions, and MPI_ERRORS_ABORT gets called for all other MPI functions. periodt.
Open MPI ships with three predefined error handlers you can use, slay:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. dramatic, but honest. πMPI_ERRORS_ABORTβ an error handler that can be invoked on a communicator, window, file, or session. when it's called on a communicator, it acts as ifMPI_Abortwas called on that communicator. if called on a window or file, it acts as ifMPI_Abortwas called on a communicator containing the group of processes in the corresponding window or file. and if called on a session, it aborts only the local process.MPI_ERRORS_RETURNβ returns an error code to the application. chillest of the three, honestly.
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
build-your-own error handler era, we love to see it. β¨
β οΈ Note that MPI does not guarantee that an MPI program can continue past an error. so like, don't count on it, bestie.
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_Comm_create_errhandlerMPI_Comm_get_errhandler
π Copyright π
2003-2026, The Open MPI Community
and that's the whole page, bestie!! π source is the Open MPI man page for MPI_COMM_SET_ERRHANDLER(3), dated Sep 10, 2026, and it was written by the Open MPI Community (2003-2026). go forth and set those error handlers. π
β¨π¦
π¦ 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