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 withMPI_Imrecvto 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 thisMPI_Imrecvis 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 ifMPI_Abortwas called on that communicator. if called on a window or file, acts as ifMPI_Abortwas 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_errhandlerthenMPI_Comm_set_errhandlerMPI_File_create_errhandlerthenMPI_File_set_errhandlerMPI_Session_create_errhandlerthenMPI_Session_set_errhandleror atMPI_Session_initMPI_Win_create_errhandlerthenMPI_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 byMPI_Imrecvdo not set thestatus.MPI_ERRORfield 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 ofMPI_Imrecvif the back-end error handler returns it. the pre-defined MPI error handlerMPI_ERRORS_RETURNexhibits this behavior, for example. so the status field stays quiet about it. mysterious queen.
see also:
MPI_MprobeMPI_ImprobeMPI_ProbeMPI_IprobeMPI_ImrecvMPI_Cancel
π Copyright π
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
- ubuntu stonking: openmpi-doc 5.0.10-6 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms