Reputation: 21
I am building an application using RMA in MPI. I am stuck at how to achieve the following, suppose I have 2 windows win1 and win2, what I want to do is write data into both the windows but I want this to be atomic so that untill both the elements are written into their respective windows no other process accesses the window at same target process.
Is this possible to achieve in MPI? making write on single window atomic is possible with Exclusive Lock but is there any way I can lock multiple windows together?
Upvotes: 1
Views: 179
Reputation: 5662
MPI window locks are not locks and cannot be used this way. The name is unfortunate.
An exclusive lock/unlock epoch is a critical section around the encapsulated RMA operations. It is possible to implement these with no actual locking in at least some cases.
What you want to achieve requires a proper mutex. You can implement a spin-lock using MPI_COMPARE_AND_SWAP
, for example. Other implementations exist, e.g. https://www.mcs.anl.gov/~robl/papers/ross_atomic-mpiio.pdf.
Upvotes: 1