MPI_Session_get_info(3)
π MPI_Session_get_info(3) π
okay bestie pull up a chair because we're reading the <pink>MPI</pink> manual page for MPI_Session_get_info(3) and honestly? it's giving iconic β¨
πΈ NAME πΈ
MPI_Session_get_info β get the info hints associated to the session π
like. it fetches the info hints. that are attached to your session. no cap, that's the whole job.
β¨ SYNOPSIS β¨
int MPI_Session_get_info(MPI_Session session, MPI_Info *info_used)
π INPUT PARAMETERS π
sessionβ your session (a handle, bb π«Ά)
π¦ OUTPUT PARAMETERS π¦
info_usedβ see the explanation below (also a handle π)
π₯ THREAD AND INTERRUPT SAFETY π₯
Good news first: this routine is thread-safe. that means multiple threads can use it at the same time without you needing to hand-roll any user-provided thread locks. she's independent, she doesn't need you hovering π
But β and this is the part where I grab your hand β the routine is not interrupt safe. π typically this is because it uses memory allocation routines like malloc or other non-MPICH runtime routines that are themselves not interrupt-safe. so like, it's not her fault, it's the company she keeps.
π lowkey important: thread-safe β interrupt-safe. do not conflate them, bestie.
π NOTES FOR FORTRAN π
so in Fortran, every single MPI routine (with the exception of MPI_WTIME and MPI_WTICK, and yes those two are the special little exceptions, they always are) has one extra argument tacked on the end: ierr. ierr is an integer and it means exactly the same thing as the return value of the routine in C. same energy, different syntax π«Ά
also: in Fortran, MPI routines are subroutines, and you invoke them with the call statement. so it's call-core, not call-optional π
and one more for the road β all MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. every single one. no matter how fancy they look in C. integer. periodt. π
β ERRORS β
okay so here's the deal with errors, and this applies to basically all of MPI:
All MPI routines (except MPI_Wtime and MPI_Wtick, our forever exceptions π) return an error value. C routines return it as the value of the function, and Fortran routines put it in that last argument we just talked about.
Before that value comes back to you, the current MPI error handler gets called. By default, this error handler aborts the MPI job. π so yeah, default behaviour is dramatic, she's taking the whole thing down with her.
You can change the error handler 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 π« (so like, it works but we don't do that anymore, bestie).
The predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned instead. π
And note: MPI does not guarantee that an MPI program can continue past an error. however, MPI implementations will attempt to continue whenever possible. so, fingers crossed, praying for you π
Now the actual error codes:
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). so it's just... an invalid something. we don't know which. rude tbh πMPI_ERR_SESSIONβ invalid session handle πΈMPI_ERR_OTHERβ other error; useMPI_Error_stringto get more information about this error code. the catch-all bucket, iykyk π«Ά
so yeah! that's the whole page. go forth and get those session info hints, main character ππ
written up all cute for the MPI manual, this version dated 4/10/2026, titled MPI_Session_get_info(3) β mwah, take care of her πβ¨π
π¦ 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