[mpich-devel] binding a new MPI type with fortran

Dave Goodell goodell at mcs.anl.gov
Tue Apr 2 16:48:01 CDT 2013


On Apr 2, 2013, at 4:34 PM CDT, Larry Baker <baker at usgs.gov> wrote:

> Jeff referred me to the MPI 3.0 spec (http://mpi-forum.org/docs/mpi-3.0/mpi30-report.pdf) for data sizes.  But, even it is contradictory.  For example, in section 3.2.2, it says an MPI_INTEGER is a Fortran (default KIND) INTEGER.  Fortran does not specify the size of a (default KIND) INTEGER.  However, Table 13.2 says it is 4 bytes.  It could just as easily be 8 bytes in a 64-bit execution environment.  In that case, Fortran requires that the size of all the default KIND numeric types in Table 13.2 would double in size.  But, not necessarily pointers; pointers in Fortran do not have a specified size (storage unit).  

Table 13.2 lists sizes for a specific kind of encoding of MPI datatypes known as "external32".  You should not use it as a reference for the actual size of the MPI datatype, which must instead always match the actual language type in the corresponding language binding.

> The MPI 3.0 spec says if you send an MPI_INTEGER, you have to receive an MPI_INTEGER.  I didn't exhaustively search the MPI 3.0 spec, but you might also have to make sure the default KIND INTEGER is the same for the sender and receiver.  This might be beyond the scope of MPI, and I do not know how exhaustive the run-time tests can be to detect violations of the rules.  (A message would have to carry type metadata for the payload data in addition to the payload data itself.)  Section 17 had lots of information about Fortran and C data sizes, including automatically conversions.  I didn't read enough to know if the spec covers the case of exchanging default KIND INTEGERs between two executables with different sizes.  Maybe it is true that MPI mandates something like lexical scoping rules, such that, for example, all members of an MPI application must assign the same semantics to their fundamental data types -- the default KIND INTEGER, etc., in the case of Fortran.

Most users should ignore the rules regarding conversions on heterogeneous systems.  They don't make a lot of sense even if you're an MPI expert, and:

1) almost no MPI implementations properly support this behavior

2) almost no user codes are written correctly to deal with it, even if #1 were true

-Dave


More information about the devel mailing list