MPI_MPROBE(3)
π MPI_Mprobe β the blocking matched probe π
okay bestie, we're in the Open MPI manual and today's main character is MPI_Mprobe(3). she's a blocking matched probe for a message, and honestly? she eats. let's get into it π«Ά
β¨ SYNTAX β¨
π C Syntax π
#include <mpi.h>
int MPI_Mprobe(int source, int tag, MPI_Comm comm,
MPI_Message *message, MPI_Status *status)
π Fortran Syntax π
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_MPROBE(SOURCE, TAG, COMM, MESSAGE, STATUS, IERROR)
INTEGER SOURCE, TAG, COMM, MESSAGE
INTEGER STATUS(MPI_STATUS_SIZE), IERROR
π Fortran 2008 Syntax π
USE mpi_f08
MPI_Mprobe(source, tag, comm, message, status, ierror)
INTEGER, INTENT(IN) :: source, tag
TYPE(MPI_Comm), INTENT(IN) :: comm
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 feeling β¨flexibleβ¨ (integer, bestie).tagβ the tag value, orMPI_ANY_TAG(integer).commβ the communicator, obvi (handle).
π¦ OUTPUT PARAMETERS π¦
messageβ a message (handle). yeah it's just called "message". iconic naming, no notes.statusβ a status object (status).ierrorβ Fortran only: the error status (integer).
π DESCRIPTION π
so like MPI_Probe and MPI_Iprobe, right? MPI_Mprobe and MPI_Improbe let you peek at incoming messages without actually receiving them. BUT β and this is the part that's giving very much main character energy β MPI_Mprobe and MPI_Improbe give you a whole mechanism to receive the specific message that got matched, no matter what other probe or receive operations are out there trying to interrupt. it's the message. you got the message. nobody else can claim her. π
and that means the application can literally decide how to receive the message based on the info that came back from the probe. yes bestie, you can allocate memory for the receive buffer based on the length of the probed message. tailored. bespoke. slay. π₯
a matching probe with MPI_PROC_NULL as source returns message = MPI_MESSAGE_NO_PROC, and the status object gives you back source = MPI_PROC_NULL, tag = MPI_ANY_TAG, and count = 0. no cap. π«‘
when MPI_Mprobe returns (from a non-MPI_PROC_NULL source, just to be clear), you can then receive that matched message by handing the message handle over to the MPI_Mrecv or MPI_Imrecv functions. that's the whole arc, bestie. β¨
π ERRORS π
ngl, almost every MPI routine returns an error value β the C routines hand it back as the return result of the function, and the Fortran routines put it in the last argument.
before that error value comes back, the current MPI error handler that's associated with the communication object (think communicator, window, file) gets called. and if there's no communication object attached to the MPI call, then the call is considered attached to MPI_COMM_SELF and will call the associated MPI error handler. π«Ά
now here's the messy part. when MPI_COMM_SELF is not initialized (aka 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_errhandleronMPI_COMM_SELFwhen you're using the World model, or - the
mpi_initial_errhandlerCLI argument tompiexec, or - the info key to
MPI_Comm_spawn/MPI_Comm_spawn_multiple.
and if no other appropriate error handler has been set? then the MPI_ERRORS_RETURN error handler gets called for MPI I/O functions, and the MPI_ERRORS_ABORT error handler gets called for all other MPI functions. every time. fr fr.
π the three predefined error handlers π
Open MPI ships with three predefined error handlers you can use:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. like, everyone. gone. π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. and if it's called on a session, it aborts only the local process (respectful of everyone else's vibe, honestly).MPI_ERRORS_RETURNβ returns an error code to the application. lowkey the chill one.
π§ roll your own, bestie π§
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_errhandler, or atMPI_Session_initMPI_Win_create_errhandlerthenMPI_Win_set_errhandler
β οΈ note that MPI does not guarantee that an MPI program can continue past an error. so like... don't assume survivability, bestie.
see the MPI man page for a full list of MPI error codes, and see the Error Handling section of the MPI-3.1 standard for more information. π
π see also π
MPI_ImprobeMPI_ProbeMPI_IprobeMPI_MrecvMPI_ImrecvMPI_Cancel
π Copyright π
2003-2026, The Open MPI Community
aaaand that's the whole page, bestie!! ππ this was MPI_Mprobe(3) from Open MPI, and the footer is giving Sep 10, 2026 energy. go probe something safely, ily, periodt. β¨π«Άπ
π¦ 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