Home

MPIProbe

MPI_Probe is a blocking MPI procedure used to test for the arrival of an incoming message and to obtain information about it without actually receiving the data. It waits until a message matching the specified source, tag, and communicator is available, then returns a status object containing details about the message. This preflight step is useful for planning the subsequent receive operation, such as sizing buffers or handling messages from varying sources and tags.

In C, the function is declared as int MPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status *status). The

After a successful probe, you typically determine how much data will be received and with what datatype.

MPI_Iprobe is a non-blocking variant that checks for a message without blocking, returning a flag to indicate

source
and
tag
can
be
specific
values
or
MPI_ANY_SOURCE
and
MPI_ANY_TAG
to
match
any
incoming
message
from
any
source
or
with
any
tag
within
the
given
communicator.
The
call
blocks
until
a
matching
message
is
available
or
an
error
occurs.
When
successful,
the
status
object
holds
information
about
the
message,
including
the
actual
source
and
tag.
This
is
done
by
calling
MPI_Get_count
with
the
datatype
you
plan
to
receive,
e.g.,
MPI_Get_count(&status,
datatype,
&count).
The
count
indicates
the
number
of
elements
of
the
given
datatype
in
the
incoming
message.
This
enables
you
to
allocate
an
appropriately
sized
receive
buffer
and
then
perform
the
corresponding
MPI_Recv
or
MPI_Irecv
operation.
Note
that
Probe
itself
does
not
carry
the
data;
it
only
prepares
for
the
subsequent
receive.
availability.
MPI_Probe
is
commonly
used
to
implement
flexible,
two-step
communication
patterns
where
the
receiver
decides
how
to
handle
an
incoming
message
based
on
its
source,
tag,
or
size.