MPI_Group_from_session_pset(3)
π MPI_Group_from_session_pset(3) β the MPI manual, but make it bestie-coded β¨
okay so bestie, we're in the MPI section of the manual (section 3, the library-calls girlies) and today's main character is MPI_Group_from_session_pset. It's giving "I make groups out of session process sets" and honestly? Obsessed. π¦
πΈ NAME πΈ
MPI_Group_from_session_pset β get a group from a session processes set π
β¨ SYNOPSIS β¨
int MPI_Group_from_session_pset(MPI_Session session, const char *pset_name,
MPI_Group *newgroup)
π INPUT PARAMETERS π
sessionβ the session, which is a handle. That's it, that's the vibe π«Άpset_nameβ the name of the process set you wanna use to create the new group. It's a string π
π¦ OUTPUT PARAMETERS π¦
newgroupβ your brand new group, derived from the session and process set you handed over. Also a handle. She's fresh, she's new, she's yours β¨
π₯ THREAD AND INTERRUPT SAFETY π₯
This routine is thread-safe. What does that mean fr fr? It means multiple threads can use it at the same time with zero user-provided thread locks needed. No extra safety gear, no chaos. Slay. π
BUT β and this is the important part, no cap β the routine is not interrupt safe. Why? Typically because of memory allocation routines like malloc (or any other non-MPICH runtime routine) being used under the hood, and those little guys aren't interrupt-safe themselves. So don't be out here interrupting her mid-glow-up π
π NOTES FOR FORTRAN π
Every MPI routine in Fortran (except for MPI_WTIME and MPI_WTICK) has one extra argument at the end of the argument list: ierr. It's an integer and it means exactly the same thing as the return value of the routine in C. π―
Also, in Fortran, MPI routines are subroutines, and you invoke them with the call statement. That's just how she operates π
And one more for the notebook: all MPI objects (e.g. MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. Periodt π
π ERRORS π
Okay so every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value. In C routines, that's the value of the function itself; in Fortran routines, it's the last argument. Before that value gets returned, the current MPI error handler gets called. By default? That error handler aborts the MPI job π so like, dramatic.
The error handler can 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 π« (girl, retire her). And the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned instead.
β οΈ Heads up: MPI does not guarantee that an MPI program can continue past an error. However, MPI implementations will attempt to continue whenever possible. So likeβ¦ maybe it works, maybe it doesn't. No promises, bestie π
Here are the error codes, and yes, they're all iconic in their own way:
MPI_SUCCESSβ no error at all! The routine completed successfully. Clean, flawless, ate. β¨MPI_ERR_ARGβ invalid argument. Some argument is invalid and is not identified by a specific error class (e.g.MPI_ERR_RANK). Rude, but ok πMPI_ERR_SESSIONβ invalid session handle π«MPI_ERR_OTHERβ other error. UseMPI_Error_stringto get more info about this error code. The "mystery box" of errors π
That's the whole page, gorgeous. Go forth and build groups responsibly π«Ά
β§ο½₯οΎ: β§ο½₯οΎ: M P I :ο½₯οΎβ§:ο½₯οΎβ§
okay and for the little sign-off: this page came to you from the MPI source/version, dated 4/10/2026 β and it's MPI_Group_from_session_pset(3), obviously, the icon herself ππ bye bestie, go slay some parallel code! π¦β¨
π¦ 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