Home

MPIGetelements

MPI_Get_elements is a function in the MPI (Message Passing Interface) standard used to determine the number of basic elements received in a message, according to a specified datatype. It is typically called after a successful probe operation (MPI_Probe or MPI_Iprobe) to learn how much data was received without performing the actual receive.

In C, the function signature is: int MPI_Get_elements(MPI_Status *status, MPI_Datatype datatype, int *elements). The status argument

The value returned in elements represents the number of basic elements contained in the received message, not

A variant for large counts is MPI_Get_elements_x, which uses MPI_Count for the elements parameter to avoid overflow

See also MPI_Probe, MPI_Iprobe, and MPI_Get_count for related mechanisms to query message size and contents before

is
the
status
object
from
a
prior
probe
or
nonblocking
probe,
datatype
is
the
datatype
used
in
the
corresponding
receive,
and
elements
is
an
output
parameter
that
receives
the
number
of
basic
elements
in
the
message.
For
Fortran,
the
interface
is
MPI_GET_ELEMENTS(STATUS,
DATATYPE,
ELEMENTS,
IERROR).
the
number
of
datatype
instances.
For
example,
receiving
five
doubles
yields
5;
receiving
three
blocks
of
MPI_2INT
yields
6
basic
elements
(two
integers
per
block).
If
a
derived
datatype
is
used,
the
count
reflects
the
total
count
of
its
basic
elements.
on
very
large
messages;
this
is
available
in
MPI-3
and
later.
or
during
receipt.