[MPICH] Semantic question re: one-sided communications

William Gropp gropp at mcs.anl.gov
Tue Feb 7 09:44:05 CST 2006


At 08:38 AM 2/7/2006, David Minor wrote:
>I'm planning an addition to my system using one sided communications.
>
>Each process will asynchronously be putting data into windows on other 
>processes.
>This data requires no synchronization or ordering, each process will only 
>read the latest data in
>It's local memory and put data into other processes memory whenever it 
>desires to. There are no global communications, one process can put to 
>none or all of the other processes and it doesn't matter if one of them 
>reads the new data before the other.
>
>The question is, do I still need to use a fence?

You need to use some synchronization mechanism.  MPI_Put, MPI_Get, and 
MPI_Accumulate are all non-blocking and must be completed with another MPI 
call (from a specific set).  MPI_Win_fence is the simplest model, but there 
are two others.  You may need the "passive" target model, which uses 
MPI_Win_lock and MPI_Win_unlock to begin and complete the RMA operation.

Note that there are some examples, both tutorials and published papers, 
that got this wrong.  For example, you can't use the value retrieved by 
MPI_Get until after the window synchronization (e.g., the MPI_Win_fence or 
MPI_Win_unlock).

>
>If so, is one fence at the beginning and one at the end of each session 
>enough?
>
>Are there any issues re: reading the local data I need to be aware of? 
>(such as do I need to issue a fence before each local read).
>
>Do I need to issue the same number of fences on each process in the 
>communicator?

Yes, if you use MPI_Win_fence, it is a collective operation over the 
processes that created the window.  There are some examples in Using MPI-2 
that cover the various RMA synchronization modes.

Bill
>
>Thanks,
>David Minor

William Gropp
http://www.mcs.anl.gov/~gropp 




More information about the mpich-discuss mailing list