[mpich-discuss] beginner for remote mem access (sufeng)

Jim Dinan james.dinan at gmail.com
Fri Jul 5 10:43:29 CDT 2013

On Fri, Jul 5, 2013 at 11:28 AM, Sufeng Niu <sniu at hawk.iit.edu> wrote:

> 1.
> MPI_Win_fence is not similar to MPI_Barrier in some cases.  The
> MPICH implementation can turn some calls into no-ops and others into
> MPI_Reduce_scatter.
> I am not quite sure about "turn some calls into no-ops and others into
> MPI_Reduce_scatter" Could you please give an example if possible? Another
> thing is if a process create a window for other process, but the data
> access is available after some operations. Should I use MPI_Win_fence or
> MPI_Barrier to sync? or other methods?

When you call MPI_Win_fence, the MPI implementation does not need to wait
for all processes to call the function before proceeding.  It does require
that all RMA operations in a given process' access epoch are complete, and
that all RMA accesses in its exposure epoch (i.e., targeting the given
process) are also complete.  If, for example, there is no preceding epoch,
the call to MPI_Win_fence is a no op.

Generally speaking, you should synchronize all accesses to data exposed in
a window using RMA synchronization operations.  Barrier does not provide
any consistency for RMA operations.

> 2.
> Regarding "use MPI window as thread level", I really don't
> understand your thinking at all.  MPI RMA is not shared memory nor is
> MPI a threading model.
> Sorry for uncleared statements, right now I would like to do multithreads
> and MPI hybrid programming. let me give an example: I have 3 processes,
> each one has 8 threads. thread 0 in process 0 creates a RMA window. if I
> would like all other threads to access it, should I use thread 0 in process
> 1, thread 0 in process 2 to MPI_Get the data from window, then use shared
> memory for internal threads to load the data? i am not sure what is the
> proper way for RMA in hybrid model.

The threads can all access the data in the window, provided that the MPI
process synchronizes accesses by threads in the process correctly with
respect to what other processes are doing.  Note that data consistency
across threads is outside of the MPI specification, and you should use e.g.
Pthreads or OpenMP primitives to ensure that data is consistent across

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpich.org/pipermail/discuss/attachments/20130705/d2064a55/attachment.html>

More information about the discuss mailing list