MPIX_Recv_enqueue(3)
π 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 orMPI_ANY_SOURCE(integer). you can be picky about who you're hearing from, or you can leave the door open πtagβ message tag orMPI_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 inMPI_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 beMPI_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 beMPI_ANY_TAG. the largest tag value is available through the the attributeMPI_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 uncommittedMPI_Datatype(seeMPI_Type_commit) is used in a communication call.MPI_ERR_OTHERβ other error; useMPI_Error_stringto 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
- 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