Commit ce893cc0 authored by Su Huang's avatar Su Huang Committed by Michael Blocksome
Browse files

PAMID: Support MPI_PROC_NULL in MPI_Win_lock and MPI_Win_unlock



  MPI Standard states:
  MPI_PROC_NULL is a valid target rank in all MPI RMA communication calls. The effect
  is the same as for MPI_PROC_NULL in MPI point-to-point communication. After any RMA
  operation with rank MPI_PROC_NULL, it is still necessary to finish the RMA epoch with the
  synchronization method that started the epoch.

  In the current design, both MPI_Win_lock and MPI_Win_unlock do not comply with the standard, e.g.
  if MPI_PROC_NULL is passed in as the target_rank of MPI_Win_lock or MPI_Win_unlock, without the
  fix, the job will be terminated with segfault.

  (ibm) D194295
Signed-off-by: default avatarMichael Blocksome <blocksom@us.ibm.com>
parent 2f73f9b6
......@@ -174,6 +174,7 @@ MPID_Win_lock(int lock_type,
MPIU_ERR_SETANDSTMT(mpi_errno, MPI_ERR_RMA_SYNC,
return mpi_errno, "**rmasync");
}
if (rank == MPI_PROC_NULL) goto fn_exit;
struct MPIDI_Win_sync* sync = &win->mpid.sync;
MPIDI_WinLock_info info = {
......@@ -185,7 +186,7 @@ MPID_Win_lock(int lock_type,
MPIDI_Context_post(MPIDI_Context[0], &info.work, MPIDI_WinLockReq_post, &info);
MPID_PROGRESS_WAIT_WHILE(!slock->remote.locked);
fn_exit:
win->mpid.sync.origin_epoch_type = MPID_EPOTYPE_LOCK;
return mpi_errno;
......@@ -203,7 +204,7 @@ MPID_Win_unlock(int rank,
MPIU_ERR_SETANDSTMT(mpi_errno, MPI_ERR_RMA_SYNC,
return mpi_errno, "**rmasync");
}
if (rank == MPI_PROC_NULL) goto fn_exit;
struct MPIDI_Win_sync* sync = &win->mpid.sync;
MPID_PROGRESS_WAIT_WHILE(win->mpid.origin[rank].nStarted != win->mpid.origin[rank].nCompleted);
win->mpid.origin[rank].nCompleted=0;
......@@ -216,7 +217,7 @@ MPID_Win_unlock(int rank,
};
MPIDI_Context_post(MPIDI_Context[0], &info.work, MPIDI_WinUnlock_post, &info);
MPID_PROGRESS_WAIT_WHILE(sync->lock.remote.locked);
fn_exit:
if(win->mpid.sync.target_epoch_type == MPID_EPOTYPE_REFENCE)
{
win->mpid.sync.origin_epoch_type = MPID_EPOTYPE_REFENCE;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment