MPI_T_source_get_num(3)
π MPI_T_source_get_num(3) π
okay bestie, welcome to the MPI manual, page for MPI_T_source_get_num π«Ά this one's short and sweet, we love a low-effort bop.
β¨ NAME β¨
MPI_T_source_get_num β bestie, this one queries the number of event sources π¦ it's literally just a headcount. a census. a roll call for event sources.
β¨ SYNOPSIS β¨
int MPI_T_source_get_num(int *num_sources)
that's it, that's the whole signature, she's compact π
β¨ OUTPUT PARAMETERS β¨
num_sourcesβ returns number of event sources (integer) π so you hand her a pointer and she fills it with how many event sources there are. iconic behavior.
β¨ THREAD AND INTERRUPT SAFETY β¨
okay so, the tea β: this routine is thread-safe. that means multiple threads can all use this routine at the same time, and you do not need to bring your own user-provided thread locks. no gatekeeping, she's fine with the whole group chat showing up at once π
BUT. and it's a big but π β she is NOT interrupt safe. typically this is because of memory allocation routines like malloc or other non-MPICH runtime routines, which are themselves not interrupt-safe. so like, don't interrupt her mid-glow-up, she will not recover gracefully. β
β¨ ERRORS β¨
so like, every single MPI routine (except MPI_Wtime and MPI_Wtick, they're the rebels π) returns an error value. C routines return it as the value of the function, and Fortran routines put it in the 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 β not a drill, the whole thing goes down π
you can swap the error handler out 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 ngl, its use is deprecated β it's giving legacy, we don't stan π©
if you want errors to come back as error values instead of nuking your job, use the predefined error handler MPI_ERRORS_RETURN. also important: MPI does not guarantee that an MPI program can continue past an error πΈ however, MPI implementations will attempt to continue whenever possible. so like, they'll try their best, but no promises, bestie.
The error codes, get ready:
MPI_SUCCESSβ No error; MPI routine completed successfully. ate and left no crumbs βMPI_T_ERR_INVALIDβ Invalid use of the interface or bad parameter values(s). πMPI_T_ERR_NOT_INITIALIZEDβ The MPI tool information interface is not initialized. you forgot to turn her on, bestie πMPI_ERR_OTHERβ Other error; useMPI_Error_stringto get more information about this error code. mystery vibe, go read up π
and that's the whole page, periodt π
sign-off time: this lil masterpiece is dated 4/10/2026, from the MPI manual family, and she's filed under MPI_T_source_get_num(3) π mwah, go forth and count your event sources. iykyk πβ¨
π¦ 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