MPI_Session_call_errhandler(3)

πŸ’– NAME πŸ’–

MPI_Session_call_errhandler β€” bestie, this is the one that goes "hey, error handler that's attached to my MPI session? do your thing, right now, for this error code." It literally calls the error handler that's installed on a MPI session. No cap. 🫢

This lives in the MPI manual, section 3, so you already know it's a library routine and not some command you type into your shell. πŸ’…


✨ SYNOPSIS ✨

int MPI_Session_call_errhandler(MPI_Session session, int errorcode)

That's the whole signature, character for character, don't @ me. 🌸


πŸŽ€ INPUT PARAMETERS πŸŽ€

  • session β€” the session with the error handler on it, and yes it's a handle. It's giving "which session are we even talking about" energy. πŸ”₯
  • errorcode β€” the error code, and it's an integer. This is the number you're handing over to the handler so it knows what went down. 😭

🧚 THREAD AND INTERRUPT SAFETY 🧚

Okay so here's the tea, and it matters:

This routine is thread and interrupt safe only if no MPI routine that updates or frees the same MPI object may be called concurrently with this routine. Read that twice. πŸ‘‘

The MPI standard defined a thread-safe interface, but β€” and this is the part everyone skips β€” that does not mean that all routines may be called without any thread locks. Literally not what it means. For example, two threads must not attempt to change the contents of the same MPI_Info object concurrently. Not even a little. πŸ’€

So in that case, bestie, you (the user) are responsible for using some mechanism β€” such as thread locks β€” to make sure only one thread at a time makes use of this routine. That's on you, not on MPI. πŸ™ˆ

This is the "you brought this on yourself" clause. Lock it or regret it.

🌈 NOTES FOR FORTRAN 🌈

  • All MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK) have an additional argument ierr at the end of the argument list. Yes, at the end. 🫢
  • ierr is an integer and has the same meaning as the return value of the routine in C. Same vibe, different language. ✨
  • In Fortran, MPI routines are subroutines, and are invoked with the call statement. So you call it. That's the move. πŸ’…
  • All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. Everything. All of them. INTEGER. No cap. 🌸

😭 ERRORS 😭

All MPI routines (except MPI_Wtime and MPI_Wtick) return an error value; C routines as the value of the function and Fortran routines in the last argument. Before the value is returned, the current MPI error handler is called. πŸ“£

By default, this error handler aborts the MPI job. Yeah. The whole job. Gone. πŸ’€

The error handler may be changed with:

  • MPI_Comm_set_errhandler β€” for communicators
  • MPI_File_set_errhandler β€” for files
  • MPI_Win_set_errhandler β€” for RMA windows

The MPI-1 routine MPI_Errhandler_set may be used but its use is deprecated. Old and busted, respectfully. πŸ™ˆ

The predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Iconic behaviour: instead of nuking the job, it hands you back a value. πŸŽ€

Note that MPI does not guarantee that an MPI program can continue past an error; however, MPI implementations will attempt to continue whenever possible. So like… they'll try. That's the promise. πŸ¦‹

Here are the error values:

  • MPI_SUCCESS β€” No error; MPI routine completed successfully. Ate. πŸ‘‘
  • MPI_ERR_SESSION β€” Invalid session handle. You handed over a fake one, bestie. 😭
  • MPI_ERR_OTHER β€” Other error; use MPI_Error_string to get more information about this error code. The catch-all. The "it's giving mystery" one. πŸ”₯

okay that's the whole page, every flag, every caveat, every error code, nothing skipped, periodt πŸ’–

This was MPI_Session_call_errhandler(3) from the MPI manual, dated 4/10/2026 β€” mwah, thanks for reading, love u, go lock your threads. πŸ«ΆπŸŽ€βœ¨

πŸ“¦ where this page comes from