MPIX_Stream_irecv(3)

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

πŸ’Œ MPIX_Stream_irecv β€” from the MPI manual, section 3

okay bestie, listen up, this one is lowkey iconic ✨

🌸 NAME 🌸

MPIX_Stream_irecv β€” start a nonblocking receive from a specific source stream to a specific local stream. yes, streams. we're being ✨fancy✨ with it.


πŸŽ€ SYNOPSIS πŸŽ€

int MPIX_Stream_irecv(void *buf, int count, MPI_Datatype datatype, int source,
int tag, MPI_Comm comm, int source_stream_index,
int dest_stream_index, MPI_Request *request)

int MPIX_Stream_irecv_c(void *buf, MPI_Count count, MPI_Datatype datatype,
int source, int tag, MPI_Comm comm,
int source_stream_index, int dest_stream_index,
MPI_Request *request)

two flavors, both slay: the regular one takes an int count, and the _c version takes an MPI_Count count. no cap. πŸ’…


🫢 INPUT PARAMETERS 🫢

  • count β€” how many elements are chillin' in the receive buffer (non-negative integer, so zero and up only, bestie).
  • datatype β€” the datatype of each receive buffer element (handle).
  • source β€” the rank of the source, or MPI_ANY_SOURCE if you're feeling open-minded (integer).
  • tag β€” the message tag, or MPI_ANY_TAG if you're playing it chill (integer).
  • comm β€” the communicator (handle).
  • source_stream_index β€” the source stream index (integer). yes it's literally just that.
  • dest_stream_index β€” the destination stream index (integer). and that.

πŸ’– OUTPUT PARAMETERS πŸ’–

  • buf β€” the initial address of the receive buffer (choice).
  • request β€” the communication request (handle). you WILL be needing this later to check on it. it's giving "don't leave me on read".

🧡 THREAD AND INTERRUPT SAFETY 🧡

this routine is thread-safe, periodt. that means multiple threads can use it at the same time and you do NOT have to bring your own thread locks, you can just go off. πŸŽ‰

BUT β€” and this is the important part, so pay attention β€” it is not interrupt safe. typically that's because of memory allocation routines like malloc, or other non-MPICH runtime routines that aren't interrupt-safe themselves. so no interrupting, babe. πŸ™ˆ


πŸ¦‹ NOTES FOR FORTRAN πŸ¦‹

all MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK) get an extra argument called ierr stuck on the end of the argument list. ierr is an integer and means exactly the same thing as the return value of the routine in C. In Fortran, MPI routines are subroutines, and you invoke them with the call statement. so cute, so retro. πŸ’œ

also: all MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. yes, all of them. fr fr.


πŸ’€ ERRORS πŸ’€

okay so, every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value β€” C routines as the return value of the function, and Fortran routines in that last argument. before the value comes back to you, the current MPI error handler gets called. by default, that error handler aborts the MPI job. 😭 so yeah. dramatic.

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

the MPI-1 routine MPI_Errhandler_set may also be used, but its use is deprecated (we don't do that anymore, bestie). and the predefined error handler MPI_ERRORS_RETURN can 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. the implementations will try to continue whenever possible, but like… no promises. 🫠

here's the error code menu:

  • MPI_SUCCESS β€” no error! the MPI routine completed successfully. we love to see it. πŸ‘‘
  • MPI_ERR_ARG β€” invalid argument. some argument is invalid and isn't identified by a specific error class (e.g., MPI_ERR_RANK).
  • MPI_ERR_BUFFER β€” invalid buffer pointer. usually a null buffer where a null buffer is not valid.
  • MPI_ERR_COMM β€” invalid communicator. a very common oopsie is using a null communicator in a call (which is 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 attribute MPI_TAG_UB.
  • MPI_ERR_TYPE β€” invalid datatype argument. also, this error can happen if an uncommitted MPI_Datatype (see MPI_Type_commit) is used in a communication call. commit your types, bestie.
  • MPI_ERR_OTHER β€” other error; use MPI_Error_string to get more information about this error code.

and that's the whole page, angel πŸ’–

this was MPIX_Stream_irecv(3) from the MPI manual, dated 4/10/2026. go forth and receive nonblockingly, my love. mwah. πŸ’…βœ¨

πŸ“¦ where this page comes from