Questions concerning MPI.Win #360
-
Hi, I have a couple of questions concering the MPI.Win class. I hope you can help me. What is the recommended way to access the memory in a process's own window? Consider for example that a master process ( true_value = np.ones(1, dtype=np_dtype)
win.Lock(rank=1)
win.Put(true_value, target_rank=1, target=(pos, 1, datatype))
win.Unlock(rank=1) Between computations the worker process ( buf = np.zeros(N, dtype=np_dtype)
while ...:
# do some computation
win.Lock(rank=1)
win.Get(buf, target_rank=1)
win.Unlock(rank=1)
# check buf or buf = memoryview(win)
while ...:
# do some computation
# check buf[pos] or buf = np.frombuffer(win, dtype=np_dtype)
while ...:
# do some computation
# check buf[pos] In the last two cases should there be |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 9 replies
-
Let's say the master process should set the flag in multiple worker processes. Is there a broadcast operation or is the following necessary? true_value = np.ones(1, dtype=np_dtype)
for worker_rank in range(1, size):
win.Lock(rank=worker_rank)
win.Put(true_value, target_rank=worker_rank, target=(pos, 1, datatype))
win.Unlock(rank=worker_rank) |
Beta Was this translation helpful? Give feedback.
-
I don't think that buf = np.zeros(N, dtype=np_dtype)
win.Lock(rank=rank)
win.Put(buf, target_rank=rank)
win.Unlock(rank=rank) or just buf = np.frombuffer(win, dtype=np_dtype)
buf.fill(0) Should |
Beta Was this translation helpful? Give feedback.
-
@DirkKuhn Your questions are not really about mpi4py but way more general, about how MPI behaves. Unfortunately, I'm not a guru of MPI RMA, and the whole thing is still sometimes confusing to me. Maybe @jeffhammond can provide us some links or resources to better understand things? Sorry, Jeff, I always end up involving you in mpi4py RMA questions. |
Beta Was this translation helpful? Give feedback.
-
My recommendation for RMA usage is:
// always do these together
{
MPI_Win_allocate
MPI_Win_lock_all
}
// three types of sync
MPI_Win_flush_local // buffer can be reused - like MPI_Send
MPI_Win_flush // operation is completed at the target - stronger than MPI_Ssend
MPI_Win_sync // think memory barrier - before and after load-store access to local window
// always do these together
{
MPI_Win_unlock_all
MPI_Win_free
} |
Beta Was this translation helpful? Give feedback.
-
anything you can do with Fence you can do with the above. PSCW is harder to reproduce with passive target, but it's possible. i just don't recommend it. |
Beta Was this translation helpful? Give feedback.
My recommendation for RMA usage is: