Toon
Toon

Reputation: 187

RMA MPI window access latency

I use Fortran (with gfortran) and MPI 2 (OpenMPI). Through MPI_Win_lock and MPI_Win_unlock together with put and get operations (in non-overlapping regions of memory) all processes update a variable on my master process, which is exposed through a window.

In a test case I have noticed, however, that the unlock operations from processes that are not the master do not return until the master has finished some task, in this case sleeping for some seconds.

If instead of sleeping the master, I make it wait for some seconds using a while loop and a timer, and in the meantime I make the master lock and unlock the window, everything goes much faster:

call start_time(time_left)
do while (time_left .gt. 0)
    call MPI_Win_lock(...)
    call MPI_Win_unlock(...)
    call update_time(time_left)
end do

However, in my real code the master performs operations just as the other processes, so it is impossible for it to continuously lock and unlock the window. Also, it seems to me rather wasteful.

My question is therefore how to decrease this latency?

Do I really need to sprinkle my code with locks and unlocks for the master? Or is there another solution? Is this compiler / implementation dependent?

Upvotes: 0

Views: 141

Answers (1)

Hristo Iliev
Hristo Iliev

Reputation: 74385

The behaviour is implementation-dependent. Most MPI libraries do not perform asynchronous progression of the operations and progression only happens while the execution control is explicitly transferred to the library by calling MPI_Something. A relatively lightweight and portable hack is to call MPI_Iprobe periodically, which should enable the library to process any outstanding non-blocking send and receive operations used to implement the RMA.

Upvotes: 2

Related Questions