MPIX_Recv_enqueue(3)

πŸ“¦
version 5.0.1 Β· 3 versions
, in nixos 26.05, ubuntu stonking

πŸ’– MPIX_Recv_enqueue β€” bestie, let's queue up a receive πŸ’–

okay so real talk, this one's from the MPI manual, third section, and it's giving "I do GPU stream things and you're just along for the ride" energy. Sit down, grab a lil snack πŸ“, and let's get into it.

✨ NAME ✨

MPIX_Recv_enqueue β€” enqueue a receive operation to a GPU stream that is associated with the local stream πŸ¦‹

like. it doesn't do the receive. it queues the receive. onto a GPU stream. that is tied to the local stream. iykyk.

✨ SYNOPSIS ✨

int MPIX_Recv_enqueue(void *buf, int count, MPI_Datatype datatype, int source,
int tag, MPI_Comm comm, MPI_Status *status)

int MPIX_Recv_enqueue_c(void *buf, MPI_Count count, MPI_Datatype datatype,
int source, int tag, MPI_Comm comm, MPI_Status *status)

two flavors, periodt. there's the regular one with an int count, and then _c with an MPI_Count count for when your counts are absolute units. πŸ‘‘

✨ INPUT PARAMETERS ✨

  • count β€” number of elements in receive buffer (non-negative integer). no, it cannot be negative, don't even try it πŸ’€
  • datatype β€” datatype of each receive buffer element (handle)
  • source β€” rank of source or MPI_ANY_SOURCE (integer). you can be picky about who you're hearing from, or you can leave the door open πŸ’Œ
  • tag β€” message tag or MPI_ANY_TAG (integer)
  • comm β€” communicator (handle)

✨ OUTPUT PARAMETERS ✨

  • buf β€” initial address of receive buffer (choice). yes bestie this is listed as an output parameter, that's just how it is, the data lands here πŸŽ€
  • status β€” status object (Status)

✨ THREAD AND INTERRUPT SAFETY ✨

this routine is thread-safe πŸ’… so you can hit it from multiple threads at once and nobody needs to stand outside the door holding a user-provided thread lock. slay.

BUT. and this is a big but β€” it is not interrupt safe 😭. like, typically that's because it uses memory allocation routines such as malloc or other non-MPICH runtime routines, and those are themselves not interrupt-safe. so. not interrupt safe. noted. πŸ“

✨ NOTES FOR FORTRAN ✨

all MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK) have an additional argument ierr at the end of the argument list. ierr is an integer and has the same meaning as the return value of the routine in C. in Fortran, MPI routines are subroutines, and they're invoked with the call statement. so it's not x = thing() it's call thing(...) 🧚

also, all MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. not handles. integers. iconic behavior tbh.

✨ ERRORS ✨

all MPI routines (except MPI_Wtime and MPI_Wtick) return an error value β€” C routines as the value of the function, and Fortran routines in the last argument. before that value comes back to you, the current MPI error handler gets called. by default, this error handler aborts the MPI job πŸš¨πŸ’€ so like. heads up.

the error handler can be changed 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 its use is deprecated πŸ™ˆ (yes we still have to tell you, no we don't endorse it).

the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned instead of the whole job going poof. note that MPI does not guarantee that an MPI program can continue past an error; however, MPI implementations will attempt to continue whenever possible 🫢

the hits, in order:

  • MPI_SUCCESS β€” no error; MPI routine completed successfully. we love a clean run βœ…
  • MPI_ERR_ARG β€” invalid argument. some argument is invalid and is not identified by a specific error class (e.g., MPI_ERR_RANK).
  • MPI_ERR_BUFFER β€” invalid buffer pointer. usually a null buffer where one is not valid. bestie. give it a real buffer.
  • MPI_ERR_COMM β€” invalid communicator. a common error is to use a null communicator in a call (not even allowed in MPI_Comm_rank). πŸ”₯
  • MPI_ERR_COUNT β€” invalid count argument. count arguments must be non-negative; a count of zero is often valid.
  • MPI_ERR_RANK β€” invalid source or destination rank. ranks must be between zero and the size of the communicator minus one; ranks in a receive (MPI_Recv, MPI_Irecv, MPI_Sendrecv, etc.) may also be MPI_ANY_SOURCE.
  • MPI_ERR_TAG β€” invalid tag argument. tags must be non-negative; tags in a receive (MPI_Recv, MPI_Irecv, MPI_Sendrecv, etc.) may also be MPI_ANY_TAG. the largest tag value is available through the the attribute MPI_TAG_UB. (yes the original says "the the", we are keeping it, no cap πŸ’€)
  • MPI_ERR_TYPE β€” invalid datatype argument. additionally, this error can occur if an uncommitted MPI_Datatype (see MPI_Type_commit) is used in a communication call.
  • MPI_ERR_OTHER β€” other error; use MPI_Error_string to get more information about this error code.

and that's the whole page, bestie πŸŽ€ this one's dated 4/10/2026 and it lives over in the MPI manual as MPIX_Recv_enqueue(3) β€” go forth, enqueue responsibly, and may your local stream always be associated πŸ’œβœ¨πŸ¦‹

πŸ“¦ where this page comes from