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_WTIMEandMPI_WTICK) have an additional argumentierrat the end of the argument list. Yes, at the end. π«Ά ierris 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
callstatement. So youcallit. That's the move. π - All MPI objects (e.g.,
MPI_Datatype,MPI_Comm) are of typeINTEGERin 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 communicatorsMPI_File_set_errhandlerβ for filesMPI_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; useMPI_Error_stringto 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
- nixos 26.05: mpich 5.0.1
- ubuntu stonking: mpich-doc 5.0.1-9 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms