MPI_T_event_get_num(3)

πŸ’– MPI_T_event_get_num β€” straight from the MPI manual, bestie πŸ’–

✨ NAME ✨

MPI_T_event_get_num β€” literally just queries how many event types there are. That's it. That's the whole job. πŸ‘‘


🌸 SYNOPSIS 🌸

int MPI_T_event_get_num(int *num_events)

πŸŽ€ OUTPUT PARAMETERS πŸŽ€

  • num_events β€” returns the number of event types (integer). She's giving "here's your count", no cap. πŸ¦‹

πŸ’… THREAD AND INTERRUPT SAFETY πŸ’…

Okay so this routine is thread-safe. Meaning what exactly? Meaning multiple threads can call it at the same time and none of them need you to hand-build a thread lock. It just works. Slay. 🫢

BUT. And this is the important but β€” it is not interrupt safe. The routine is not interrupt safe. Typically that's because it uses memory allocation routines like malloc or other non-MPICH runtime routines, and those bad boys are themselves not interrupt-safe. So like… don't get cute with interrupts, mkay? πŸ’€


😭 ERRORS 😭

So every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value β€” C routines give it back 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. And by default? That error handler aborts your whole MPI job. Yeah. Dramatic. 😳

You can change the error handler though:

  • MPI_Comm_set_errhandler β€” for communicators
  • MPI_File_set_errhandler β€” for files
  • MPI_Win_set_errhandler β€” for RMA windows

There's also the MPI-1 routine MPI_Errhandler_set, which you may use, but heads up β€” its use is deprecated. πŸ‘Ž You can also use the predefined error handler MPI_ERRORS_RETURN to make error values get returned instead of nuking everything.

Fr fr though: MPI does not guarantee that an MPI program can continue past an error. That said, MPI implementations will attempt to continue whenever possible. So… fingers crossed energy. 🀞

Here's the full error roster:

  • MPI_SUCCESS β€” no error, the routine did the thing successfully. periodt. βœ…
  • MPI_T_ERR_INVALID β€” invalid use of the interface, or bad parameter value(s). πŸ™ˆ
  • MPI_T_ERR_NOT_INITIALIZED β€” the MPI tool information interface isn't initialized. bestie. you gotta init it first. 😭
  • MPI_ERR_OTHER β€” other error; use MPI_Error_string to get more info about this error code. πŸ”

That's the whole page, no skips, no summaries, every last flag and error code accounted for. πŸ’œ

Signing off from the MPI manual, page MPI_T_event_get_num(3), dated 4/10/2026 β€” go count those event types, you absolute icon. πŸŒˆβœ¨πŸ‘‘

πŸ“¦ where this page comes from