MPI_Session_get_errhandler(3)
π MPI_Session_get_errhandler β bestie, let's go get that error handler π
okay so this is the tea: MPI_Session_get_errhandler is an MPI routine, it lives in the MPI manual (section 3, we love a classic), and it does literally exactly what it says on the tin β it fetches the error handler that's currently vibing with your MPI session. that's it. that's the whole plot. β¨
πΈ NAME πΈ
MPI_Session_get_errhandler β get the error handler for the MPI session π«Ά
β¨ SYNOPSIS β¨
int MPI_Session_get_errhandler(MPI_Session session, MPI_Errhandler *errhandler)
π INPUT PARAMETERS π
sessionβ the session. a handle. that's her π
π¦ OUTPUT PARAMETERS π¦
errhandlerβ the error handler that's currently associated withsession(a handle). this is where she gets written to, bestie π
π₯ THREAD AND INTERRUPT SAFETY π₯
okay listen up because this part is important and not in a cute way π
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.
The MPI standard defined a thread-safe interface but this does not mean that all routines may be called without any thread locks. fr fr. for example, two threads must not attempt to change the contents of the same MPI_Info object concurrently. in that case the user is responsible for using some mechanism β like thread locks β to make sure that only one thread at a time makes use of this routine. no cap, that one's on you π
β οΈ tl;dr: thread-safe interface β do whatever you want with no locks. do not touch the same MPI object from two threads at once. protect yourself. π
π NOTES FOR FORTRAN π
- All MPI routines in Fortran (except for
MPI_WTIMEandMPI_WTICK) have an additional argumentierrat the end of the argument list. ierris an integer and has the same meaning as the return value of the routine in C.- In Fortran, MPI routines are subroutines, and are invoked with the
callstatement. periodt. - All MPI objects (e.g.,
MPI_Datatype,MPI_Comm) are of typeINTEGERin Fortran.
so yes, Fortran besties, y'all get a little ierr bonus at the end π
π 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 π so yeah, she's dramatic by default.
The error handler may be changed with MPI_Comm_set_errhandler (for communicators), MPI_File_set_errhandler (for files), and MPI_Win_set_errhandler (for RMA windows). The MPI-1 routine MPI_Errhandler_set may be used but its use is deprecated (bestie. let her go. π©).
The predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error; however, MPI implementations will attempt to continue whenever possible. iconic of them honestly.
here's the error lineup:
MPI_SUCCESSβ no error; MPI routine completed successfully. slay. β¨MPI_ERR_ARGβ invalid argument. some argument is invalid and is not identified by a specific error class (e.g.,MPI_ERR_RANK). πMPI_ERR_SESSIONβ invalid session handle. she's not real, bestie πMPI_ERR_OTHERβ other error; useMPI_Error_stringto get more information about this error code. the catch-all. the "it's giving mystery" option π΅οΈ
π one more time for the cheap seats: this routine grabs the error handler attached to your MPI_Session. pass in the session, get the handler back through the pointer. that's the whole thing. iykyk π
okay that's the page!! this was MPI_Session_get_errhandler(3) from the MPI manual, dated 4/10/2026 β go forth and get those errhandlers, my little main characters ππ¦πβ¨π
π¦ 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