Re: [AMBER-Developers] MPI struct passing

From: <dcerutti.rci.rutgers.edu>
Date: Sun, 25 Sep 2011 20:13:03 -0400 (EDT)

OK, thanks Bob and Dave for your help; I'm getting a handle on
asynchronous communication, and making what I believe is good progress on
the parallel implementation. I don't have any long doubles in mdgx, but I
noticed that if you do add one then the struct becomes aligned on 16-byte
boundaries. I will think some more and try to implement a robust
(although perhaps not so elegant) procedure to define and pass structs.
For now I am checking all my defined types to make sure that the length of
the defined MPI type equals the result of sizeof().

Dave

> On Sun, Sep 25, 2011, dcerutti.rci.rutgers.edu wrote:
>
>> However, it seems that a struct like
>>
>> struct iddd {
>> int it1;
>> double db1;
>> double db2;
>> double db3;
>> };
>> typedef struct iddd id3;
>>
>> will show up as 32 bytes if I do sizeof(id3) even though
>
> Exactly: doubles (and structs themselves) have be aligned on 8-byte
> boundaries, so the compiler has to add padding after the first int so that
> the double that follows it is properly aligned.
>
> ...dac
>
>
> _______________________________________________
> AMBER-Developers mailing list
> AMBER-Developers.ambermd.org
> http://lists.ambermd.org/mailman/listinfo/amber-developers
>


_______________________________________________
AMBER-Developers mailing list
AMBER-Developers.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber-developers
Received on Sun Sep 25 2011 - 17:30:02 PDT
Custom Search