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

Rajeev Thakur thakur at mcs.anl.gov
Tue Jul 22 12:42:08 CDT 2008


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