[mpich-discuss] MPI derived types in one-sided memory

Robert Kubrick robertkubrick at gmail.com
Tue Jul 22 13:07:39 CDT 2008


Thanks!

I had miss the disp_unit parameter in MPI_Win_create.
Also it's good to know that MPI_Alloc_mem and MPI_Type_size work well  
together to build implicit derived data type arrays, just like malloc().

On Jul 22, 2008, at 1:42 PM, Rajeev Thakur wrote:

> Yes, and in MPI_Win_create you need to pass disp_unit as the  
> Type_size of
> MYTYPE. Also, the 2nd parameter to Put should be 1.
>
> Rajeev
>
>> -----Original Message-----
>> From: owner-mpich-discuss at mcs.anl.gov
>> [mailto:owner-mpich-discuss at mcs.anl.gov] On Behalf Of Robert Kubrick
>> Sent: Tuesday, July 22, 2008 12:03 PM
>> To: mpich-discuss at mcs.anl.gov
>> Subject: [mpich-discuss] MPI derived types in one-sided memory
>>
>> Lets say I want to transfer a custom data structure through
>> MPI_Get()/
>> MPI_Put. I want the data to be portable across a number of different
>> architectures, so I have to create a derived data type:
>>
>> MPI_Type_struct(..., &MYTYPE);
>> MPI_Type_commit(&MYTYPE);
>>
>> int elements = 10;
>> MPI_Alloc_mem(elements* MPI_Type_size(MYTYPE), ...);
>> MPI_Win_create(...);
>>
>>
>>
>> Then I want to put an element in the RMA memory:
>>
>> MYTYPE myvar;
>> some work on myvar...
>> MPI_Put(&myvar, 0, MYTYPE, homeRank, 2, 1, MYTYPE, mywin);
>>
>> Is this the correct way to place the contents of myvar at index 2 in
>> an RMA array of size 'elements'?
>>
>>
>




More information about the mpich-discuss mailing list