MPI_ERRHANDLER_GET(3)

πŸ’– MPI_ERRHANDLER_GET πŸ’–

okay bestie, welcome to the Open MPI manual, section three β€” library routines only, we're fancy. this one's a classic but also kind of a "we don't do that anymore" situation, so let's get into it. 🫢


πŸ“› NAME

MPI_Errhandler_get β€” gets the error handler for a communicator β€” and heads up, this routine is deprecated in favor of MPI_Comm_get_errhandler. no cap. πŸ’…


✨ SYNTAX

C Syntax

#include <mpi.h>

int MPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler *errhandler)

Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'

MPI_ERRHANDLER_GET(COMM, ERRHANDLER, IERROR)
     INTEGER COMM, ERRHANDLER, IERROR

πŸŽ€ INPUT PARAMETER

  • comm β€” the communicator you want to pull the error handler out of (a handle, bestie).

πŸ’Œ OUTPUT PARAMETERS

  • errhandler β€” the MPI error handler that's currently associated with that communicator (a handle). this is the one you came for. ✨
  • ierror β€” Fortran only: the error status (integer).

πŸ“ DESCRIPTION

so like β€” real talk β€” using this routine is deprecated as of MPI-2. it's giving legacy. please use MPI_Comm_get_errhandler instead. truly, she's the upgrade. 🌸


πŸ’€ ERRORS

okay so basically almost every MPI routine hands back an error value; C routines return it as the return result of the function, and Fortran routines put it in the last argument.

before that error value gets returned, the current MPI error handler associated with the communication object (like a communicator, window, or file) gets called. and if there's no communication object associated with the MPI call at all, then the call counts as attached to MPI_COMM_SELF and it'll call the error handler associated with that. now if MPI_COMM_SELF isn't initialized (i.e., 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. and you can change that initial error handler by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when you're using the World model, or with the mpi_initial_errhandler CLI argument to mpiexec, 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. 😭

Open MPI includes three predefined error handlers you can use, and honestly? iconic lineup:

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. all of them. she does not do half measures. πŸ”₯
  • 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. polite. 🫢

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
lowkey crucial: MPI does not guarantee that an MPI program can continue past an error. like, at all. periodt. don't be surprised when things go sideways. 🚨

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 β€” that's where the deep lore lives. πŸ“š

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 πŸ’œ this one came from Open MPI and it's dated Sep 10, 2026, page MPI_ERRHANDLER_GET(3) β€” go forth and use the non-deprecated version, i'm begging. πŸ¦‹βœ¨

πŸ“¦ where this page comes from