Can master thread call MPI_Win_lock_all() once for all threads?

99 Views Asked by At

I am writing a hybrid MPI/OpenMP code with MPI-3 remote memory access feature. I am assuming MPI_THREAD_SERIALIZED is available.

Can I do this?

 MPI_Win_lock_all(0, win);
 #pragma omp parallel 
 {
      ...
      #pragma omp critical(getRemoteData)
      {
           MPI_Get(buf, len, MPI_UINT64_T, t_rank, localOffset, len, MPI_UINT64_T, win);
           MPI_Win_flush(t_rank, win);
      }
      ...

 }
 MPI_Win_unlock_all(win);

Here main thread calls lock and unlock once for the whole MPI process. The OMP threads call MPI_Get when required. I could call lock and unlock for each MPI_Get, but, I think that takes more time.

Does seem to be working. But, I am not sure if this is the correct use.

0

There are 0 best solutions below