MPI_Mrecv(3)

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

πŸ’– MPI_Mrecv(3) β€” the MPI manual, bestie edition πŸ’–

okay so real talk, this one is from the MPI manual (like, the whole MPI manual, not some random tiny section) and it's about a blocking receive of a message that was already matched for you by MPI_Mprobe or MPI_Improbe. yes bestie, it's the "I already peeked at it, now gimme the goods" routine. πŸŽ€


✨ NAME ✨

MPI_Mrecv β€” Blocking receive of message matched by MPI_Mprobe or MPI_Improbe. that's it, that's the whole job description. iconic. πŸ’…


πŸ“œ SYNOPSIS πŸ“œ

int MPI_Mrecv(void *buf, int count, MPI_Datatype datatype, MPI_Message *message,
MPI_Status *status)

int MPI_Mrecv_c(void *buf, MPI_Count count, MPI_Datatype datatype,
MPI_Message *message, MPI_Status *status)

🧚 INPUT PARAMETERS 🧚

  • count β€” number of elements in receive buffer (non-negative integer). so, how many lil guys are we expecting, and no, negative numbers are not it. πŸ™ˆ
  • datatype β€” datatype of each receive buffer element (handle). it's giving "what flavour is each element". ⭐

πŸ¦‹ INPUT/OUTPUT PARAMETERS πŸ¦‹

  • message β€” message (handle). yeah it goes in and comes out, it's a main character like that. πŸ‘‘

🌸 OUTPUT PARAMETERS 🌸

  • buf β€” initial address of receive buffer (choice). where the data actually lands, periodt. πŸ’–
  • status β€” status object (Status). all the lore about the message it just received. πŸŽ€

πŸ”₯ THREAD AND INTERRUPT SAFETY πŸ”₯

This routine is thread-safe. lowkey slay. That means it may be safely used by multiple threads without the need for any user-provided thread locks. no cap.

However, bestie, listen β€” it is not interrupt safe. 😭 Typically, this is due to the use of memory allocation routines such as malloc or other non-MPICH runtime routines that are themselves not interrupt-safe. so like, threads yes, interrupts no, it's a vibe check you gotta respect. πŸ’€


πŸ’œ 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 are invoked with the call statement. so extra lil arg, same energy as the C return value. fr fr.

All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. that's just the rules, we don't make them. 🫢


πŸ’€ 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. like, whole job, gone, bye. 😭

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 β€” old news, don't do it. 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. optimistic of them honestly. 🌈

  • MPI_SUCCESS β€” No error; MPI routine completed successfully. ate, no crumbs. ✨
  • MPI_ERR_ARG β€” Invalid argument. Some argument is invalid and is not identified by a specific error class (e.g., MPI_ERR_RANK). vague on purpose, ngl.
  • MPI_ERR_BUFFER β€” Invalid buffer pointer. Usually a null buffer where one is not valid. bestie. that buffer is empty. πŸ™ˆ
  • MPI_ERR_COUNT β€” Invalid count argument. Count arguments must be non-negative; a count of zero is often valid. zero? sometimes fine. negative? absolutely not. πŸ’…
  • MPI_ERR_REQUEST β€” Invalid MPI_Request. Either null or, in the case of a MPI_Start or MPI_Startall, not a persistent request. πŸ“
  • 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. commit your types or it's over. πŸ’€
  • MPI_ERR_OTHER β€” Other error; use MPI_Error_string to get more information about this error code. the catch-all, the miscellaneous, use MPI_Error_string for the tea. πŸ‘‘

and that's the whole page, bestie 🫢 β€” this was MPI_Mrecv(3) from the MPI manual, dated 4/10/2026. go forth, receive your messages, and slay. πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from