As described above, MPI defines types (e.g., MPI_Aint) to address locations within memory and other types (e.g., MPI_Offset) to address locations within files. In addition, some MPI procedures use count arguments that represent a number of MPI datatypes on which to operate. Furthermore, timestamps in the context of the MPI Tool Information Interface are a count of clock ticks elapsed since some time in the past. At times, one needs a single type that can be used to address locations within either memory or files as well as express count values, and that type is MPI_Count in C and INTEGER(KIND=MPI_COUNT_KIND) in Fortran. These types must have the same width and encode values in the same manner such that count values in one language may be passed directly to another language without conversion. The size of the MPI_Count type is determined by the MPI implementation with the restriction that it must be minimally capable of encoding any value that may be stored in a variable of type int, MPI_Aint, or MPI_Offset in C and of type INTEGER, INTEGER(KIND=MPI_ADDRESS_KIND) , or INTEGER(KIND=MPI_OFFSET_KIND) in Fortran. Even though the MPI_Count type is large enough to encode address locations, the MPI_Count type shall not be used to represent an absolute address.
Rationale.
Count values need to be large enough to encode any value used for expressing
element counts, strides, offsets, indexes, displacements,
typemaps in memory, typemaps in file views, etc.
Prior to MPI-4.0, many MPI routines used
int in C and INTEGER in Fortran
as the type for count arguments.
To avoid breaking backward compatibility,
this version of the standard continues to support
int in C as well as INTEGER in Fortran
in such routines. In addition,
this version of the standard supports using
MPI_Count in C
(via separate ``_c'' suffixed procedures)
as well as
INTEGER(KIND=MPI_COUNT_KIND) in Fortran
(via polymorphic interfaces in newer MPI Fortran bindings
(USE mpi_f08))
in such routines.
See Section Support for Large Count and Large Byte Displacement in MPI Language Bindings for a full explanation.
( End of rationale.)
The phrase large count refers
to the use of MPI_Count and INTEGER(KIND=MPI_COUNT_KIND)
parameter types.
There are cases where MPI_UNDEFINED can be returned in a large count OUT parameter. Per Table Defined Constants (page Defined Constants), the MPI_UNDEFINED constant is defined to be a C int (or unnamed enum) and a Fortran INTEGER. Implementations shall therefore choose the underlying types for MPI_Count and INTEGER(KIND=MPI_COUNT_KIND) such that they can be compared to MPI_UNDEFINED.
Advice
to implementors.
The comparison of MPI_UNDEFINED to an MPI_Count or
INTEGER(KIND=MPI_COUNT_KIND) may need to be via a casting
operation.
( End of advice to implementors.)