MPI_ERRHANDLER_SET(3)
π MPI_Errhandler_set π
okay so bestie, welcome to the Open MPI manual, section 3, and yes we are starting with a β οΈ deprecation warning because this one is old old. MPI_Errhandler_set sets the error handler for a communicator β and it's deprecated in favor of MPI_Comm_set_errhandler. She's giving legacy MC energy but we still gotta learn her, so let's go π«Ά
πΈ SYNTAX πΈ
π» C Syntax
#include <mpi.h>
int MPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler)
π§ Fortran Syntax
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_ERRHANDLER_SET(COMM, ERRHANDLER, IERROR)
INTEGER COMM, ERRHANDLER, IERROR
π₯ INPUT PARAMETERS π₯
commβ the communicator you're setting the error handler for. it's a handle bestie, a little handle β¨errhandlerβ the new MPI error handler for that communicator. also a handle π
π€ OUTPUT PARAMETER π€
ierrorβ Fortran only: the error status, and it's an integer. C girlies stay unbothered, y'all get the return value instead π
π DESCRIPTION π
heads up: using this routine is deprecated as of MPI-2. please, for the love of everything, use MPI_Comm_set_errhandler instead π
What she actually does: she associates the new error handler errhandler with communicator comm at the calling process. And here's the lil fact that lives rent free in my head β an error handler is always associated with the communicator. always. she's never not got one π¦
π ERRORS π
Almost every single MPI routine returns an error value, and the delivery method is giving "depends on your language":
- C routines β it comes back as the return result of the function.
- Fortran routines β it lands in the last argument.
Before that error value ever gets returned, the current MPI error handler associated with the communication object is called β and that object could be a communicator, a window, or a file, iykyk.
But what if there's no communication object attached to the MPI call? Then the call is considered attached to MPI_COMM_SELF and it'll call the associated MPI error handler. π«
And when MPI_COMM_SELF is not initialized β meaning 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_errhandleronMPI_COMM_SELFwhen using the World model, or - the
mpi_initial_errhandlerCLI argument tompiexec, or - the info key to
MPI_Comm_spawn/MPI_Comm_spawn_multiple.
If no other appropriate error handler has been set, then:
MPI_ERRORS_RETURNgets called for MPI I/O functions, andMPI_ERRORS_ABORTgets 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. not a drill, not one process, all of them π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, it acts as ifMPI_Abortwas called on a communicator containing the group of processes in the corresponding window or file. If called on a session, it aborts only the local process.MPI_ERRORS_RETURNβ returns an error code to the application. the chill one, the respectful one, the queen of handing you the receipt π§Ύ
β¨ make your own error 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_errhandlerβ or atMPI_Session_initMPI_Win_create_errhandlerthenMPI_Win_set_errhandler
very important, no cap: MPI does not guarantee that an MPI program can continue past an error. like, at all. plan accordingly π
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_errhandlerMPI_Comm_set_errhandler
π Copyright
2003-2026, The Open MPI Community
and that's the whole page bestie, you ate it up π
β¨ this absolute classic is from the Open MPI manual, dated Sep 10, 2026, and she's filed as MPI_ERRHANDLER_SET(3) β go forth and use MPI_Comm_set_errhandler instead, mwah π«Άπ
π¦ 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