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, or MPI_ANY_SOURCE if you're in your "idc who texts me first" era (integer).
  • tag β€” the tag value, or MPI_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 if MPI_Abort was called on that communicator. If it's called on a window or file, it acts as if MPI_Abort was 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_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
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_Mprobe
  • MPI_Probe
  • MPI_Iprobe
  • MPI_Mrecv
  • MPI_Imrecv
  • MPI_Cancel

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