MPI_IMPROBE(3)
π¦ NAME
MPI_Improbe β non-blocking matched probe for a message, bestie. Like, it peeks at your mail without opening the envelope πβ¨
β¨ SYNTAX
C Syntax
#include <mpi.h>
int MPI_Improbe(int source, int tag, MPI_Comm comm,
int *flag, MPI_Message *message, MPI_Status *status)
Fortran Syntax
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_IMPROBE(SOURCE, TAG, COMM, FLAG, MESSAGE, STATUS, IERROR)
LOGICAL FLAG
INTEGER SOURCE, TAG, COMM, MESSAGE
INTEGER STATUS(MPI_STATUS_SIZE), IERROR
Fortran 2008 Syntax
USE mpi_f08
MPI_Improbe(source, tag, comm, flag, message, status, ierror)
INTEGER, INTENT(IN) :: source, tag
TYPE(MPI_Comm), INTENT(IN) :: comm
INTEGER, INTENT(OUT) :: flag
TYPE(MPI_Message), INTENT(OUT) :: message
TYPE(MPI_Status) :: status
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
π₯ INPUT PARAMETERS
sourceβ the source rank, orMPI_ANY_SOURCEif you're in your "idc who texts me first" era (integer).tagβ the tag value, orMPI_ANY_TAG(integer).commβ the communicator, aka the group chat (handle).
π€ OUTPUT PARAMETERS
flagβ the flag, a logical. It's giving yes/no energy (logical).messageβ the message handle, so you can slide into it later (handle).statusβ the status object (status).ierrorβ Fortran only: error status (integer).
π DESCRIPTION
Okay so, just like MPI_Probe and MPI_Iprobe, the MPI_Mprobe and MPI_Improbe operations let you check out incoming messages without actually receiving them β except here's the tea: MPI_Mprobe and MPI_Improbe give you a way to receive the specific message that got matched, no matter what other probe or receive operations happen in between. Obsessed. π
That means your app can literally decide how it wants to receive the message based on the info the probe handed back. Lowkey the best part: you can allocate memory for the receive buffer based on the length of the probed message. Main character resource management, fr fr.
A matching probe with MPI_PROC_NULL as source returns flag = true, message = MPI_MESSAGE_NO_PROC, and the status object returns source ^ MPI_PROC_NULL, tag ^ MPI_ANY_TAG, and count ^ 0.
MPI_Iprobe returns a true value in flag if a message has been matched and can be received by passing the message handle to the MPI_Mrecv or MPI_Imrecv functions β provided that the source was not MPI_PROC_NULL. π«Ά
π ERRORS
Almost every MPI routine returns an error value, bestie. C routines return it as the result of the function, and Fortran routines put it in the last argument.
Before the error value comes back, the current MPI error handler associated with the communication object (like a communicator, window, or file) gets called. If there's no communication object associated with the MPI call, then the call counts as attached to MPI_COMM_SELF, and it'll call the associated MPI error handler. And when MPI_COMM_SELF isn't initialized (meaning before MPI_Init/MPI_Init_thread, after MPI_Finalize, or when you're using the Sessions Model exclusively), the error raises the initial error handler. You can change that initial error handler by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when you're using the World model, or via the mpi_initial_errhandler CLI argument to mpiexec, or the info key to MPI_Comm_spawn/MPI_Comm_spawn_multiple. And if no other appropriate error handler has been set, then MPI_ERRORS_RETURN gets called for MPI I/O functions, and MPI_ERRORS_ABORT gets called for all the other MPI functions.
Open MPI ships three predefined error handlers you can use, slay:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. Yeah, it's dramatic. πMPI_ERRORS_ABORTβ an error handler that can be invoked on a communicator, window, file, or session. When it's called on a communicator, it acts as ifMPI_Abortwas called on that communicator. If it's called on a window or file, it acts as ifMPI_Abortwas called on a communicator containing the group of processes in the corresponding window or file. If it's called on a session, it aborts only the local process.MPI_ERRORS_RETURNβ returns an error code to the application.
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
Heads up, queen: note that MPI does not guarantee that an MPI program can continue past an error. Not a vibe, but it's the rules. π
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.
See also:
MPI_MprobeMPI_ProbeMPI_IprobeMPI_MrecvMPI_ImrecvMPI_Cancel
π Copyright
2003-2026, The Open MPI Community
and that's the whole page, bestie!! π this lil icon was brought to you by the Open MPI girlies, dated Sep 10, 2026 β no cap, go probe something iconic. πβ¨
π¦ 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