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 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 🚫 (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; use MPI_Error_string to 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