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_errhandler on MPI_COMM_SELF when using the World model, or
  • the mpi_initial_errhandler CLI argument to mpiexec, or
  • the info key to MPI_Comm_spawn / MPI_Comm_spawn_multiple.

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.

πŸ‘‘ 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 if MPI_Abort was called on that communicator. If called on a window or file, it acts as if MPI_Abort was 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_errhandler then MPI_Comm_set_errhandler
  • MPI_File_create_errhandler then MPI_File_set_errhandler
  • MPI_Session_create_errhandler then MPI_Session_set_errhandler β€” or at MPI_Session_init
  • MPI_Win_create_errhandler then MPI_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_errhandler
  • MPI_Comm_get_errhandler
  • MPI_Comm_set_errhandler

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