MPI_T_event_copy(3)

πŸ’– MPI_T_event_copy(3) πŸ’–

okay bestie, welcome to section 3 of the MPI manual β€” yes, that MPI, the Message Passing Interface, the ✨iconic✨ one. this page is about MPI_T_event_copy, and no cap, it's a whole mood: it just copies event data, as a whole, into a buffer you made yourself. 🫢


πŸŽ€ NAME πŸŽ€

MPI_T_event_copy β€” copy event data as a whole into a user-specified buffer

like. the whole thing. into your buffer. that's the assignment, and it ate. πŸ’…


✨ SYNOPSIS ✨

int MPI_T_event_copy(MPI_T_event_instance event_instance, void *buffer)

look at her. one function, two args, zero drama. 🌸


🌸 INPUT PARAMETERS 🌸

  • event_instance β€” the event instance that got handed to your callback function (it's a handle, bestie). it's giving "you already have this, you just have to use it." 😌

πŸ¦‹ OUTPUT PARAMETERS πŸ¦‹

  • buffer β€” a user-allocated buffer for the event data. that's a choice type, so you're the one choosing where all that data goes. allocate it yourself, no one's doing it for you, main character energy only. πŸ’–

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

This routine is thread-safe. slay!! that means multiple threads can use it at the same time and you do not have to bring your own thread locks. no lock, no stress, we love to see it. ✨

but β€” and this is the part where we lower our voices β€” 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 are themselves not interrupt-safe. so yeah. thread-safe: yes. interrupt-safe: absolutely not. periodt.


πŸ’€ ERRORS πŸ’€

okay so this is the standard MPI error lore, and it applies to basically everything, so let's get into it:

all MPI routines (MPI_Wtime and MPI_Wtick are the exceptions, they're built different) return an error value. C routines return it as the value of the function, 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 β€” like, the whole thing, gone, no warning. πŸ™ˆ if you'd rather not live that life, you can change it:

  • MPI_Comm_set_errhandler for communicators
  • MPI_File_set_errhandler for files
  • MPI_Win_set_errhandler for RMA windows

the MPI-1 routine MPI_Errhandler_set may be used but its use is deprecated (ngl, don't). and if you want error values handed back to you instead of the whole job getting cancelled, use the predefined error handler MPI_ERRORS_RETURN.

heads up bestie: MPI does not guarantee that an MPI program can continue past an error. however, MPI implementations will attempt to continue whenever possible. so... maybe it continues, maybe it doesn't. the vibes are 🎲.

and here's the actual error list, every single one, no skips:

  • MPI_SUCCESS β€” no error; the MPI routine did the thing. we love her. πŸ’š
  • MPI_T_ERR_INVALID β€” invalid use of the interface, or bad parameter value(s). you did something funky with the args, bestie. πŸ™ˆ
  • MPI_T_ERR_INVALID_HANDLE β€” the handle is invalid. that handle is not passing the vibe check. πŸ’€
  • MPI_T_ERR_NOT_INITIALIZED β€” the MPI tool information interface isn't initialized. you gotta turn it on before you use it, iykyk. 🌈
  • MPI_ERR_OTHER β€” other error; use MPI_Error_string to get more info about this error code. it's the catch-all bucket, and MPI_Error_string is your bestie for the details. πŸ”

⭐ little reminder: keep your event_instance around from the callback, allocate your own buffer, and remember that thread-safe β‰  interrupt-safe. that's the whole page, you got this. πŸ’œ

written for the MPI manual, section 3, dated 4/10/2026 β€” mwah, go forth and copy those events, bestie πŸŽ€πŸ’…βœ¨

πŸ“¦ where this page comes from