MPI_IMRECV(3)

πŸ’Œ MPI_IMRECV(3) β€” Open MPI

okay bestie, welcome to the Open MPI section of the manual, and no bc this one is actually so cute. it's MPI_IMRECV(3) and she is the non-blocking receive for a matched message ✨ like she literally receives the message that a probe already matched. so demure. so mindful. πŸŽ€


✨ NAME ✨

MPI_Imrecv β€” Non-blocking receive for a matched message πŸ’…


πŸ¦‹ SYNTAX πŸ¦‹

C Syntax

#include <mpi.h>

int MPI_Imrecv(void *buf, int count, MPI_Datatype type,
     MPI_Message *message, MPI_Request *request)

Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_IMRECV(BUF, COUNT, DATATYPE, MESSAGE, REQUEST, IERROR)
     <type>  BUF(*)
     INTEGER COUNT, DATATYPE, MESSAGE, REQUEST, IERROR

Fortran 2008 Syntax

USE mpi_f08
MPI_Imrecv(buf, count, datatype, message, request, ierror)
     TYPE(*), DIMENSION(..), ASYNCHRONOUS :: buf
     INTEGER, INTENT(IN) :: count
     TYPE(MPI_Datatype), INTENT(IN) :: datatype
     TYPE(MPI_Message), INTENT(INOUT) :: message
     TYPE(MPI_Request), INTENT(OUT) :: request
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror

🌸 INPUT PARAMETERS 🌸

  • count β€” number of elements to receive (nonnegative integer). not a single one more, not a single one less, bestie.
  • datatype β€” datatype of each send buffer element (handle).
  • message β€” message (handle).

πŸŽ€ OUTPUT PARAMETERS πŸŽ€

  • buf β€” initial address of receive buffer (choice).
  • request β€” request (handle).
  • ierror β€” Fortran only: error status (integer).

πŸ’– DESCRIPTION πŸ’–

so. the functions MPI_Mrecv and MPI_Imrecv receive messages that have already been matched by a matching probe. like the probe did the flirting, and these two handle the actual talking. periodt. 🌈

the request that MPI_Imrecv hands back? you can use it with any of the MPI_Test and MPI_Wait variants, like any non-blocking receive request. she is literally just a normal request bestie, nothing weird going on, iykyk. πŸ’…

now if you call MPI_Imrecv with MPI_MESSAGE_NULL as the message argument, then a call to one of the MPI_Test or MPI_Wait variants will return immediately with the status object set to source = MPI_PROC_NULL, tag = MPI_ANY_TAG, and count = 0, as if a receive from MPI_PROC_NULL was issued. ✨ iconic behaviour honestly.

if reception of a matched message is started with MPI_Imrecv, then it is possible to cancel the returned request with MPI_Cancel. and if MPI_Cancel succeeds, the matched message must be found by a subsequent message probe (MPI_Probe, MPI_Iprobe, MPI_Mprobe, or MPI_Improbe), received by a subsequent receive operation or canceled by the sender. so like, someone has to go pick her up, okay? she can't just be left there. 😭

note, however, that it is possible for the cancellation of operations initiated with MPI_Imrecv to fail. lowkey the worst. an example of a failing case is when canceling the matched message receive would violate MPI message ordering rules (e.g., if another message matching the same message signature has matched β€” and possibly received β€” before this MPI_Imrecv is canceled). so like, the queue said no. πŸ’€

if your application does not need to examine the status field, you can save resources by using the predefined constant MPI_STATUS_IGNORE as a special value for the status argument. self care is saving resources, bestie. 🫢


πŸ”₯ ERRORS πŸ”₯

almost all MPI routines return an error value β€” C routines as the return result of the function and Fortran routines in the last argument. yes, even the Fortran girlies get a value. πŸ’œ

before the error value is returned, the current MPI error handler associated with the communication object (e.g., communicator, window, file) is called. if no communication object is associated with the MPI call, then the call is considered attached to MPI_COMM_SELF and will call the associated MPI error handler. when MPI_COMM_SELF is not initialized (i.e., before MPI_Init/MPI_Init_thread, after MPI_Finalize, or when using the Sessions Model exclusively) the error raises the initial error handler. the initial error handler can be changed by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when using the World model, or the mpi_initial_errhandler CLI argument to mpiexec or info key to MPI_Comm_spawn/MPI_Comm_spawn_multiple. if no other appropriate error handler has been set, then the MPI_ERRORS_RETURN error handler is called for MPI I/O functions and the MPI_ERRORS_ABORT error handler is called for all other MPI functions.

Open MPI includes three predefined error handlers that can be used:

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. she's dramatic and she means it. πŸ’€
  • MPI_ERRORS_ABORT β€” an error handler that can be invoked on a communicator, window, file, or session. when called on a communicator, it acts as if MPI_Abort was called on that communicator. if called on a window or file, acts as if MPI_Abort was called on a communicator containing the group of processes in the corresponding window or file. if called on a session, aborts only the local process. very "it depends on the context" of her, we respect it.
  • MPI_ERRORS_RETURN β€” returns an error code to the application. the chill one. πŸ¦‹

MPI applications can also implement their own error handlers by calling:

  • MPI_Comm_create_errhandler then MPI_Comm_set_errhandler
  • MPI_File_create_errhandler then MPI_File_set_errhandler
  • MPI_Session_create_errhandler then MPI_Session_set_errhandler or at MPI_Session_init
  • MPI_Win_create_errhandler then MPI_Win_set_errhandler

note that MPI does not guarantee that an MPI program can continue past an error. fr fr. do not assume she's fine. 😭

see the MPI man page for a full list of MPI error codes.

see the Error Handling section of the MPI-3.1 standard for more information.

note that per the β€œReturn Status” section in the β€œPoint-to-Point Communication” chapter in the MPI Standard (https://www.mpi-forum.org/docs/), MPI errors on messages received by MPI_Imrecv do not set the status.MPI_ERROR field in the returned status. the error code is always passed to the back-end error handler and may be passed back to the caller through the return value of MPI_Imrecv if the back-end error handler returns it. the pre-defined MPI error handler MPI_ERRORS_RETURN exhibits this behavior, for example. so the status field stays quiet about it. mysterious queen.

see also:

  • MPI_Mprobe
  • MPI_Improbe
  • MPI_Probe
  • MPI_Iprobe
  • MPI_Imrecv
  • MPI_Cancel

2003-2026, The Open MPI Community


and that's the whole page, bestie πŸ’– she was written by The Open MPI Community, copyright 2003-2026, and this version is dated Sep 10, 2026 ✨ go forth and receive non-blockingly, you ate, no cap πŸŒΈπŸ¦‹πŸŽ€

πŸ“¦ where this page comes from