[MPI3 Fortran] Proposing changes to Fortran 2008
Jeff Squyres
jsquyres at cisco.com
Thu Mar 20 12:35:21 CDT 2008
Ok. But the point here is that you do not have to have an
interoperable type to pass it to an MPI function as a choice buffer.
Specifically: if you have a derived type in Fortran and the compiler
re-orders the fields in memory, that's no problem for MPI because the
user application will have had to created an MPI datatype *at run
time* that will have accurate offsets/types of each member. So MPI
has the true memory layout map, regardless of whether the Fortran
compiler re-ordered the members or not.
On Mar 20, 2008, at 12:50 PM, Aleksandar Donev wrote:
> Craig Rasmussen wrote:
>> struct foo {
>> char a;
>> char b;
>> int i;
>> char c;
>> char d;
>> }
>>
>> Don't you have to worry about the C compiler reordering the elements
>> of foo?
> No, the C standard mandates that the order be preserved (with possible
> padding). I don't know the C99 standard well-enough to search it
> efficiently, but I am pretty sure it is so. Fortran does not guarantee
> anything unless it is an interoperable type.
> Aleks
> _______________________________________________
> mpi3-fortran mailing list
> mpi3-fortran at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi3-fortran
--
Jeff Squyres
Cisco Systems
More information about the mpiwg-fortran
mailing list