MPI_Status_get_tag(3)

โœจ MPI_Status_get_tag(3) โœจ

okay bestie, you're in the MPI part of the man pages, and today's main character is MPI_Status_get_tag. ๐Ÿ’…


๐ŸŒธ NAME ๐ŸŒธ

MPI_Status_get_tag โ€” get the MPI_TAG field out of the status ๐ŸŽ€


๐Ÿซถ SYNOPSIS ๐Ÿซถ

int MPI_Status_get_tag(const MPI_Status *status, int *tag)

๐Ÿ’– INPUT PARAMETERS ๐Ÿ’–

  • status โ€” the status you're pulling from, aka the one whose source rank we're retrieving (Status) ๐Ÿ‘‘

โญ OUTPUT PARAMETERS โญ

  • tag โ€” the tag that's sitting in the MPI_TAG field (integer) โœจ

๐Ÿงต THREAD AND INTERRUPT SAFETY ๐Ÿงต

This routine is thread-safe, no cap. Which means multiple threads can run it at the same time and you do not need to bring your own thread locks โ€” she handles herself ๐Ÿ’…

But โ€” and this is the part where we all gasp โ€” 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. Not her fault, she's just built different (derogatory). ๐Ÿ˜ญ


๐Ÿ”ฎ NOTES FOR FORTRAN ๐Ÿ”ฎ

Every single MPI routine in Fortran โ€” except for MPI_WTIME and MPI_WTICK , those two are the rebels โ€” gets an extra argument called ierr tacked onto the very 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. ๐Ÿงš

Also, in Fortran, MPI routines are subroutines, and you invoke them with the call statement. Periodt.

And all MPI objects (e.g., MPI_Datatype , MPI_Comm ) are of type INTEGER in Fortran. That's just the vibe over there. ๐Ÿ‘‘


๐Ÿ’€ ERRORS ๐Ÿ’€

Every MPI routine (again โ€” except MPI_Wtime and MPI_Wtick , the two exceptions that live rent free) returns an error value: C routines as the value of the function, and Fortran routines in that last argument we just talked about. Before the value comes back to you, the current MPI error handler gets called. ๐Ÿ˜ณ

By default, that error handler aborts the MPI job. Like, whole thing, gone. So maybe pay attention here.

You can swap the error handler with:

  • 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 its use is deprecated โ€” so like, technically allowed but we're all side-eyeing it. ๐Ÿ™ˆ

The predefined error handler MPI_ERRORS_RETURN may be used to make error values actually get returned to you instead.

Heads up: MPI does not guarantee that an MPI program can continue past an error. That said, MPI implementations will attempt to continue whenever possible. So it's giving "we'll try" energy, not "we promise" energy. ๐Ÿซถ

Here's the error code list:

  • MPI_SUCCESS โ€” no error at all, the MPI routine completed successfully. Slay. โœจ
  • MPI_ERR_OTHER โ€” other error; hit up MPI_Error_string to get more info about this error code. ๐Ÿ”

aaaand that's the whole page, bestie!! this one was served up by MPI and it's dated 4/10/2026 โ€” go forth and read your status tags responsibly ๐Ÿ’–โœจ๐ŸŽ€๐Ÿฆ‹ no cap.

๐Ÿ“ฆ where this page comes from