MPI_Recv_init(3)

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

πŸ’– MPI_Recv_init β€” bestie edition πŸ’–

okay so this is MPI_Recv_init(3) from the MPI manual, and babes, it's giving setup arc. You're not receiving anything yet β€” you're just building the vibe so you can hit MPI_Start later and actually pop off. ✨


🌸 NAME 🌸

MPI_Recv_init β€” create a persistent request for a receive πŸ’Œ


πŸ¦‹ SYNOPSIS πŸ¦‹

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

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

🌈 INPUT PARAMETERS 🌈

  • count β€” the number of elements received, and bestie it's a non-negative integer, so pls no negatives πŸ™ˆ
  • datatype β€” type of each element (a handle, not a vibe)
  • source β€” rank of source, or MPI_ANY_SOURCE (integer). Yes you can be mysterious and accept from literally anyone πŸ’…
  • tag β€” message tag, or MPI_ANY_TAG (integer)
  • comm β€” communicator (handle)

πŸŽ€ OUTPUT PARAMETERS πŸŽ€

  • buf β€” initial address of receive buffer (choice)
  • request β€” communication request (handle) πŸ‘‘

πŸ’… THREAD AND INTERRUPT SAFETY πŸ’…

So this routine is thread-safe, periodt. That means multiple threads can use it safely with zero user-provided thread locks, no cap. 🫢

BUT β€” and I need you to hear me on this β€” it 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. So like, iconic for threading, not built for interrupting. πŸ’€


🧚 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 are invoked with the call statement.

All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. Fr fr, they're just integers over there. πŸ“


πŸ”₯ 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 the value is returned, the current MPI error handler is called. By default, this error handler aborts the MPI job β€” so yeah, no chill by default 😭. The error handler may 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 (she's old, let her rest πŸ™ˆ). The predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error; however, MPI implementations will attempt to continue whenever possible.

⚠️ reminder bestie: default error handler = the whole job just leaves. Set your handler if you want to survive the drama.
  • MPI_SUCCESS β€” No error; MPI routine completed successfully. she ate. πŸ‘‘
  • 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.
  • 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.
  • 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.

⭐ SEE ALSO ⭐

  • MPI_Start
  • MPI_Startall
  • MPI_Request_free

iykyk β€” init now, start later. the glow-up pipeline. πŸ’œ


okay that's the whole page bestie, mwah 🫢 this was the MPI_Recv_init(3) man page, MPI edition, dated 4/10/2026. go set up those requests and slay responsibly βœ¨πŸŽ€πŸ’…

πŸ“¦ where this page comes from