MPI_Session_get_num_psets(3)

πŸ’– MPI_Session_get_num_psets β€” bestie, let's count your process sets πŸ’–

okay so this is the MPI_Session_get_num_psets page from the MPI manual (section 3, we love a library call), and it's literally just here to tell you how many process sets your session has. that's it. that's the whole vibe. ✨


🌸 NAME 🌸

MPI_Session_get_num_psets β€” get the number of available process sets πŸ’…

no cap, that's the entire job description.


πŸ¦‹ SYNOPSIS πŸ¦‹

int MPI_Session_get_num_psets(MPI_Session session, MPI_Info info,
int *npset_names)

look at her. so short. so iconic. πŸŽ€


πŸ’œ INPUT PARAMETERS πŸ’œ

  • session β€” the session, which is a handle (yes, a handle, we love a handle) 🫢
  • info β€” an info object, also a handle ✨

🌈 OUTPUT PARAMETERS 🌈

  • npset_names β€” the number of available process sets. it's a non-negative integer, so like, zero is fine, negative is NOT the move πŸ’€

πŸ”₯ THREAD AND INTERRUPT SAFETY πŸ”₯

good news first: this routine is thread-safe. that means multiple threads can use it at the same time and you do not have to bring your own thread locks. she handles herself. main character energy fr fr πŸ‘‘

but 😭 β€” she is not interrupt safe. typically that's because of memory allocation routines like malloc, or other non-MPICH runtime routines that are themselves not interrupt-safe. so like, keep that in mind, bestie.


✨ NOTES FOR FORTRAN ✨

  • every MPI routine in Fortran (except MPI_WTIME and MPI_WTICK) gets an extra argument called ierr tacked onto the end of the argument list. ierr is an integer, and it means the exact same thing as the return value of the routine in C. 🧠
  • in Fortran, MPI routines are subroutines, and you invoke them with the call statement. periodt.
  • all MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. yes, all of them. even the fancy ones. πŸ’…

πŸ’€ ERRORS πŸ’€

so every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value β€” C routines hand it back as the value of the function, and Fortran routines put it in that last argument. before that value comes back to you, the current MPI error handler gets called. by default, that error handler aborts the MPI job 😭 so yeah, know that going in.

you can change the error handler 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 β€” so like, maybe don't. πŸ™ˆ

the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned instead. note that MPI does not guarantee that an MPI program can continue past an error; however, MPI implementations will attempt to continue whenever possible. 🫢

here's the error code lineup:

  • MPI_SUCCESS β€” no error; the 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_INFO β€” invalid Info
  • MPI_ERR_SESSION β€” invalid session handle
  • MPI_ERR_OTHER β€” other error; use MPI_Error_string to get more information about this error code. iykyk πŸ”

okay that's the whole page, you ate it, go get your npset_names queen πŸ’–

this was MPI_Session_get_num_psets(3) from the MPI manual, and the footer says it's dated 4/10/2026 β€” so yeah, mark your calendar, bestie. πŸŽ€βœ¨

πŸ“¦ where this page comes from