MPI_T_category_get_num_events(3)
β¨ NAME β¨
MPI_T_category_get_num_events β bestie, this one tells you how many event types are chillin' inside the category you just queried. That's it, that's the whole job. π
(also hi, this is the MPI manual, page MPI_T_category_get_num_events(3), and we're about to get you fluent in it π«Ά)
πΈ SYNOPSIS πΈ
int MPI_T_category_get_num_events(int cat_index, int *num_events)
π INPUT PARAMETERS π
cat_indexβ the index of the category you wanna query, an integer obvi. It's giving "which one tho" energy π¦
π OUTPUT PARAMETERS π
num_eventsβ out comes the number of event types in that category (also an integer, no cap) β¨
π§ THREAD AND INTERRUPT SAFETY π§
Okay so the good news first: this routine is thread-safe. That means multiple threads can use it at the same time and you do not need to bring your own thread locks. She handles herself. π
But β and I need you to hear this β she is not interrupt safe. π Typically that's because of memory allocation routines like malloc or other non-MPICH runtime routines, which are themselves not interrupt-safe. So like, she's fine in the group chat but don't jump-scare her mid-allocation, periodt.
π ERRORS π
So every MPI routine (except MPI_Wtime and MPI_Wtick, the lucky ones) is gonna hand you back an error value. In C it's the return value of the function; in Fortran it's the last argument. And before that value comes back, the current MPI error handler gets called.
By default, that error handler aborts the whole MPI job. π Yes really. It's dramatic like that.
You can swap the error handler with:
MPI_Comm_set_errhandlerβ for communicatorsMPI_File_set_errhandlerβ for filesMPI_Win_set_errhandlerβ for RMA windows
There's also the MPI-1 routine MPI_Errhandler_set, and you may use it, but its use is deprecated β so like, she's still around but we don't stan. π
If you'd rather get error values returned to you instead of the job getting nuked, use the predefined error handler MPI_ERRORS_RETURN. π«Ά
Heads up: MPI does not guarantee that an MPI program can keep going past an error. However, MPI implementations will attempt to continue whenever possible. So it's a vibe check, not a promise. π
Now the actual error codes, our little roster:
MPI_SUCCESSβ no error, the routine completed successfully. The dream. β¨MPI_T_ERR_INVALIDβ invalid use of the interface or bad parameter value(s). Rude of you tbh.MPI_T_ERR_INVALID_INDEXβ the index is invalid or has been deleted. She's not here anymore, bestie. π»MPI_T_ERR_NOT_INITIALIZEDβ the MPI tool information interface is not initialized. You gotta wake her up first πMPI_ERR_OTHERβ other error; useMPI_Error_stringto get more info about this error code. The catch-all, the mystery box π
π¦ SEE ALSO π¦
Nothing else listed on this page, so I guess it's just us two and this function. Iconic honestly. π
kisses bestie, you're officially fluent in counting event types ππΈπ
This was the MPI manual, page MPI_T_category_get_num_events(3), dated 4/10/2026 β go forth and query those categories, you absolute main character πβ¨
π¦ 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