[MPIWG Fortran] Data type of F08 subarray

Jeff Squyres (jsquyres) jsquyres at cisco.com
Wed May 14 12:58:19 CDT 2014


On May 14, 2014, at 1:50 PM, Junchao Zhang <jczhang at mcs.anl.gov> wrote:

> The root reason is that subarray and the count/datatype argument contain the same kind of information, and MPI allows mismatch between them. 

Offhand, I can think of several (additional) reasons why we didn't impose compile-time restrictions of the buffer type matching the MPI datatype:

1. The C bindings don't impose this restriction.  

2. The C++ bindings didn't do this, either.  They're defunct, but still.

3. If we did impose such a restriction, then there'd be no reason to have a datatype dummy argument.  That would be a further digression from the C and language neutral bindings, which was not desirable.

4. The MPI datatypes section specifically states that the exact MPI datatypes don't have to match on the sender/receiver -- only the type maps have to agree.

5. There are legitimate use cases for using an MPI datatype that does not match the type of the buffer.  For example, a C code could receive some MPI_INTEGERs sent from a Fortran sender.  It then should really use MPI_INTEGER to send that buffer to a Fortran receiver (not MPI_INT).  I.e., the C receiver acted like a middleman -- it received a blob that it didn't understand, and then re-sent that blob back to someone who could understand it.  This is a simplistic example that is representative of some manager/worker codes out in the wild.

Plus, I'm not sure how you could implement such a compile-time check.

-- 
Jeff Squyres
jsquyres at cisco.com
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/




More information about the mpiwg-fortran mailing list