[Mpi3-rma] RMA examples
Pavan Balaji
balaji at mcs.anl.gov
Thu Nov 11 20:55:46 CST 2010
As discussed during the last telecon, I'm sending the three RMA examples
to the complete list. Assume that all puts/gets/load/stores happen to
disjoint locations. The question is whether these examples are correct,
as in they will not corrupt data.
Reminder of the semantics of the new calls:
1. Win_flush flushes all outstanding RMA operations to the public copy
of the target window.
2. Win_membar synchronizes the public and private copies of the windows.
Example 1:
A process locks its local window, does put/get operations followed by
load/store. After the put/get, the flush pushes everything to the public
window, and the membar synchronizes the public and private windows, so
the load/store after that should be valid.
MPI_Win_lock(local_window);
MPI_Put();
MPI_Get();
MPI_Win_flush();
MPI_Win_membar();
/* store to local window */
/* load from local window */
MPI_Win_unlock(local_window);
Straw vote: Unanimously correct
Example 2:
Two processes (P0 and P1) lock the window of P0 (shared mode), and do
put/get operations. The flushall followed by MPI_Barrier ensures that
all the puts/gets have completed with respect to P0's public window. The
membar synchronizes the public and private windows.
Process 0 Process 1
MPI_Win_lock(P0, shared); MPI_Win_lock(P0, shared);
MPI_Put(); MPI_Put();
MPI_Get(); MPI_Get();
MPI_Win_flush(); MPI_Win_flush();
MPI_Barrier(); MPI_Barrier();
MPI_Win_membar();
/* store to local window */
/* load from local window */
MPI_Win_unlock(); MPI_Win_unlock();
Straw vote: Unanimously correct
Example 3:
This is similar to example 2, except: (a) it's only for the unified
window case and (b) there is no win_flush and membar, as there is only
one window so the public/private windows are trivially synchronized.
if (MPI_UNIFIED_WINDOW)
MPI_Abort();
Process 0 Process 1
MPI_Win_lock(P0, shared); MPI_Win_lock(P0, shared);
MPI_Put(); MPI_Put();
MPI_Get(); MPI_Get();
/* store to local window */
/* load from local window */
MPI_Win_unlock(); MPI_Win_unlock();
Straw vote:
The main concern raised was that allowing this program to be correct
means that non-cache coherent architectures can never claim a unified
public/private window.
Correct: Most folks
Not correct: No one
Abstain: Bill
Torsten was somewhere between abstain and correct.
-- Pavan
--
Pavan Balaji
http://www.mcs.anl.gov/~balaji
More information about the mpiwg-rma
mailing list