[mpich] MPICH primary repository branch, master, updated. v3.2a1-39-g3a4d8eb
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "MPICH primary repository". The branch, master has been updated via 3a4d8eb15a3db9912f62e2883e2a3c72f0ee88e1 (commit) via def275e90056f7af6c9566390c3820193df6c36b (commit) via 5bf646a352c0867aa79530da0ac856f100faf05f (commit) via c673fec42e015e9f714374dcb5d58528925663a1 (commit) via d6996640a0e50e932b105064fa026c53633cf88c (commit) from eda105b029572ebf7f4008f6de2e1afb9ccf6fc2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://git.mpich.org/mpich.git/commitdiff/3a4d8eb15a3db9912f62e2883e2a3c72f0... commit 3a4d8eb15a3db9912f62e2883e2a3c72f0ee88e1 Author: Xin Zhao <[email protected]> Date: Wed Oct 1 09:04:29 2014 -0500 Decrease iteration number in manyrma2 test. This test sometimes causes TIMEOUT in Jenkins TCP test. Signed-off-by: Pavan Balaji <[email protected]> diff --git a/test/mpi/rma/manyrma2.c b/test/mpi/rma/manyrma2.c index eb7f860..6773919 100644 --- a/test/mpi/rma/manyrma2.c +++ b/test/mpi/rma/manyrma2.c @@ -17,7 +17,7 @@ #define MAX_COUNT 65536*4/16 #define MAX_RMA_SIZE 2 /* 16 in manyrma performance test */ -#define MAX_RUNS 10 +#define MAX_RUNS 8 #define MAX_ITER_TIME 5.0 /* seconds */ typedef enum { SYNC_NONE = 0, http://git.mpich.org/mpich.git/commitdiff/def275e90056f7af6c9566390c3820193d... commit def275e90056f7af6c9566390c3820193df6c36b Author: Xin Zhao <[email protected]> Date: Tue Sep 30 17:17:33 2014 -0500 Bug-fix: correct SHM barrier in MPI_Win_fence. Here we move the SHM barrier in MPI_Win_fence after the completion of coming-in RMA operations, so that following coming-in RMA operations on SHM in the next FENCE epoch will see the updated value. Signed-off-by: Pavan Balaji <[email protected]> diff --git a/src/mpid/ch3/src/ch3u_rma_sync.c b/src/mpid/ch3/src/ch3u_rma_sync.c index 8e1353c..4cbf25c 100644 --- a/src/mpid/ch3/src/ch3u_rma_sync.c +++ b/src/mpid/ch3/src/ch3u_rma_sync.c @@ -1170,28 +1170,6 @@ int MPIDI_Win_fence(int assert, MPID_Win *win_ptr) MPIR_T_PVAR_TIMER_END(RMA, rma_winfence_clearlock); } - if (!(assert & MPI_MODE_NOSUCCEED) && - (assert & MPI_MODE_NOPRECEDE || win_ptr->fence_issued == 0)) { - - /* In the FENCE that opens an epoch but does not close an epoch, - if SHM is allocated, perform a barrier among processes on the - same node, to prevent one process modifying another process's - memory before that process starts an epoch. */ - - if (win_ptr->shm_allocated == TRUE) { - MPID_Comm *node_comm_ptr = win_ptr->comm_ptr->node_comm; - - /* Ensure ordering of load/store operations. */ - OPA_read_write_barrier(); - - mpi_errno = MPIR_Barrier_impl(node_comm_ptr, &errflag); - if (mpi_errno) {goto fn_fail;} - - /* Ensure ordering of load/store operations. */ - OPA_read_write_barrier(); - } - } - /* Note that the NOPRECEDE and NOSUCCEED must be specified by all processes in the window's group if any specify it */ if (assert & MPI_MODE_NOPRECEDE) @@ -1201,7 +1179,7 @@ int MPIDI_Win_fence(int assert, MPID_Win *win_ptr) mpi_errno, MPI_ERR_RMA_SYNC, "**rmasync"); win_ptr->fence_issued = (assert & MPI_MODE_NOSUCCEED) ? 0 : 1; - goto fn_exit; + goto shm_barrier; } if (win_ptr->fence_issued == 0) @@ -1407,6 +1385,28 @@ int MPIDI_Win_fence(int assert, MPID_Win *win_ptr) win_ptr->epoch_state = MPIDI_EPOCH_NONE; } + shm_barrier: + if (!(assert & MPI_MODE_NOSUCCEED)) { + /* In a FENCE without MPI_MODE_NOSUCCEED (which means this FENCE + might start a new Active epoch), if SHM is allocated, perform + a barrier among processes on the same node, to prevent one + process modifying another process's memory before that process + starts an epoch. */ + + if (win_ptr->shm_allocated == TRUE) { + MPID_Comm *node_comm_ptr = win_ptr->comm_ptr->node_comm; + + /* Ensure ordering of load/store operations. */ + OPA_read_write_barrier(); + + mpi_errno = MPIR_Barrier_impl(node_comm_ptr, &errflag); + if (mpi_errno) {goto fn_fail;} + + /* Ensure ordering of load/store operations. */ + OPA_read_write_barrier(); + } + } + fn_exit: MPIU_CHKLMEM_FREEALL(); MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_WIN_FENCE); http://git.mpich.org/mpich.git/commitdiff/5bf646a352c0867aa79530da0ac856f100... commit 5bf646a352c0867aa79530da0ac856f100faf05f Author: Xin Zhao <[email protected]> Date: Tue Sep 30 17:03:23 2014 -0500 Modify variable name my_counter to at_completion_counter. at_completion_counter is used to indicate if all Active Target operations have completed on this target. Signed-off-by: Pavan Balaji <[email protected]> diff --git a/src/mpid/ch3/include/mpidpre.h b/src/mpid/ch3/include/mpidpre.h index 76ef00f..4cf9d32 100644 --- a/src/mpid/ch3/include/mpidpre.h +++ b/src/mpid/ch3/include/mpidpre.h @@ -262,7 +262,7 @@ struct MPIDI_Win_target_state { }; #define MPIDI_DEV_WIN_DECL \ - volatile int my_counter; /* completion counter for operations \ + volatile int at_completion_counter; /* completion counter for operations \ targeting this window */ \ void **base_addrs; /* array of base addresses of the windows of \ all processes */ \ diff --git a/src/mpid/ch3/src/ch3u_handle_recv_req.c b/src/mpid/ch3/src/ch3u_handle_recv_req.c index f1232dc..262cf71 100644 --- a/src/mpid/ch3/src/ch3u_handle_recv_req.c +++ b/src/mpid/ch3/src/ch3u_handle_recv_req.c @@ -132,7 +132,7 @@ int MPIDI_CH3_ReqHandler_PutAccumRespComplete( MPIDI_VC_t *vc, /* here we increment the Active Target counter to guarantee the GET-like operation are completed when counter reaches zero. */ - win_ptr->my_counter++; + win_ptr->at_completion_counter++; iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) get_accum_resp_pkt; iov[0].MPID_IOV_LEN = sizeof(*get_accum_resp_pkt); @@ -332,8 +332,8 @@ int MPIDI_CH3_ReqHandler_GetAccumRespComplete( MPIDI_VC_t *vc, /* here we decrement the Active Target counter to guarantee the GET-like operation are completed when counter reaches zero. */ - win_ptr->my_counter--; - MPIU_Assert(win_ptr->my_counter >= 0); + win_ptr->at_completion_counter--; + MPIU_Assert(win_ptr->at_completion_counter >= 0); MPIDI_CH3U_Request_complete(rreq); *complete = TRUE; @@ -545,7 +545,7 @@ int MPIDI_CH3_ReqHandler_FOPComplete( MPIDI_VC_t *vc, /* here we increment the Active Target counter to guarantee the GET-like operation are completed when counter reaches zero. */ - win_ptr->my_counter++; + win_ptr->at_completion_counter++; MPIDI_CH3U_SRBuf_alloc(resp_req, len); MPIU_ERR_CHKANDJUMP(resp_req->dev.tmpbuf_sz < len, mpi_errno, MPI_ERR_OTHER, "**nomemreq"); @@ -582,7 +582,7 @@ int MPIDI_CH3_ReqHandler_FOPComplete( MPIDI_VC_t *vc, /* here we increment the Active Target counter to guarantee the GET-like operation are completed when counter reaches zero. */ - win_ptr->my_counter++; + win_ptr->at_completion_counter++; MPID_Request_release(resp_req); goto finish_up; @@ -1239,7 +1239,7 @@ static int do_simple_get(MPID_Win *win_ptr, MPIDI_Win_lock_queue *lock_queue) /* here we increment the Active Target counter to guarantee the GET-like operation are completed when counter reaches zero. */ - win_ptr->my_counter++; + win_ptr->at_completion_counter++; MPIDI_Pkt_init(get_resp_pkt, MPIDI_CH3_PKT_GET_RESP); get_resp_pkt->request_handle = lock_queue->pt_single_op->request_handle; diff --git a/src/mpid/ch3/src/ch3u_handle_send_req.c b/src/mpid/ch3/src/ch3u_handle_send_req.c index 78d740c..fd732bb 100644 --- a/src/mpid/ch3/src/ch3u_handle_send_req.c +++ b/src/mpid/ch3/src/ch3u_handle_send_req.c @@ -57,8 +57,8 @@ int MPIDI_CH3_ReqHandler_GetSendRespComplete( MPIDI_VC_t *vc ATTRIBUTE((unused)) /* here we decrement the Active Target counter to guarantee the GET-like operation are completed when counter reaches zero. */ - win_ptr->my_counter--; - MPIU_Assert(win_ptr->my_counter >= 0); + win_ptr->at_completion_counter--; + MPIU_Assert(win_ptr->at_completion_counter >= 0); /* mark data transfer as complete and decrement CC */ MPIDI_CH3U_Request_complete(sreq); diff --git a/src/mpid/ch3/src/ch3u_rma_sync.c b/src/mpid/ch3/src/ch3u_rma_sync.c index ea64175..8e1353c 100644 --- a/src/mpid/ch3/src/ch3u_rma_sync.c +++ b/src/mpid/ch3/src/ch3u_rma_sync.c @@ -1269,7 +1269,7 @@ int MPIDI_Win_fence(int assert, MPID_Win *win_ptr) RMA ops on its window */ /* first initialize the completion counter. */ - win_ptr->my_counter += comm_size; + win_ptr->at_completion_counter += comm_size; mpi_errno = MPIR_Reduce_scatter_block_impl(MPI_IN_PLACE, rma_target_proc, 1, MPI_INT, MPI_SUM, comm_ptr, &errflag); @@ -1286,8 +1286,8 @@ int MPIDI_Win_fence(int assert, MPID_Win *win_ptr) /* Set the completion counter */ /* FIXME: MT: this needs to be done atomically because other procs have the address and could decrement it. */ - win_ptr->my_counter -= comm_size; - win_ptr->my_counter += rma_target_proc[0]; + win_ptr->at_completion_counter -= comm_size; + win_ptr->at_completion_counter += rma_target_proc[0]; MPIR_T_PVAR_TIMER_START(RMA, rma_winfence_issue); MPIR_T_PVAR_COUNTER_INC(RMA, rma_winfence_issue_aux, total_op_count); @@ -1380,11 +1380,11 @@ int MPIDI_Win_fence(int assert, MPID_Win *win_ptr) finish_up: /* wait for all operations from other processes to finish */ - if (win_ptr->my_counter) + if (win_ptr->at_completion_counter) { MPIR_T_PVAR_TIMER_START(RMA, rma_winfence_wait); MPID_Progress_start(&progress_state); - while (win_ptr->my_counter) + while (win_ptr->at_completion_counter) { mpi_errno = MPID_Progress_wait(&progress_state); /* --BEGIN ERROR HANDLING-- */ @@ -2292,7 +2292,7 @@ int MPIDI_Win_post(MPID_Group *post_grp_ptr, int assert, MPID_Win *win_ptr) } /* initialize the completion counter */ - win_ptr->my_counter += post_grp_size; + win_ptr->at_completion_counter += post_grp_size; if ((assert & MPI_MODE_NOCHECK) == 0) { @@ -2748,7 +2748,7 @@ int MPIDI_Win_complete(MPID_Win *win_ptr) dst = ranks_in_win_grp[i]; if (dst == rank) { /* FIXME: MT: this has to be done atomically */ - win_ptr->my_counter -= 1; + win_ptr->at_completion_counter -= 1; } else if (nops_to_proc[dst] == 0) { @@ -2842,13 +2842,13 @@ int MPIDI_Win_wait(MPID_Win *win_ptr) win_ptr->epoch_state = MPIDI_EPOCH_NONE; /* wait for all operations from other processes to finish */ - if (win_ptr->my_counter) + if (win_ptr->at_completion_counter) { MPID_Progress_state progress_state; MPIR_T_PVAR_TIMER_START(RMA, rma_winwait_wait); MPID_Progress_start(&progress_state); - while (win_ptr->my_counter) + while (win_ptr->at_completion_counter) { mpi_errno = MPID_Progress_wait(&progress_state); /* --BEGIN ERROR HANDLING-- */ @@ -2900,7 +2900,7 @@ int MPIDI_Win_test(MPID_Win *win_ptr, int *flag) MPIU_ERR_POP(mpi_errno); } - *flag = (win_ptr->my_counter) ? 0 : 1; + *flag = (win_ptr->at_completion_counter) ? 0 : 1; if (*flag) { /* Track access epoch state */ @@ -4603,7 +4603,7 @@ int MPIDI_CH3_PktHandler_Get( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, /* here we increment the Active Target counter to guarantee the GET-like operation are completed when counter reaches zero. */ - win_ptr->my_counter++; + win_ptr->at_completion_counter++; if (MPIR_DATATYPE_IS_PREDEFINED(get_pkt->datatype)) { @@ -5012,7 +5012,7 @@ int MPIDI_CH3_PktHandler_CAS( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, /* here we increment the Active Target counter to guarantee the GET-like operation are completed when counter reaches zero. */ - win_ptr->my_counter++; + win_ptr->at_completion_counter++; MPID_Request_release(req); goto fn_exit; @@ -5533,7 +5533,7 @@ int MPIDI_CH3_PktHandler_LockGetUnlock( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, /* here we increment the Active Target counter to guarantee the GET-like operation are completed when counter reaches zero. */ - win_ptr->my_counter++; + win_ptr->at_completion_counter++; MPIDI_Pkt_init(get_resp_pkt, MPIDI_CH3_PKT_GET_RESP); get_resp_pkt->request_handle = lock_get_unlock_pkt->request_handle; @@ -6157,11 +6157,11 @@ int MPIDI_CH3_Finish_rma_op_target(MPIDI_VC_t *vc, MPID_Win *win_ptr, int is_rma if (flags & MPIDI_CH3_PKT_FLAG_RMA_AT_COMPLETE) { MPIU_Assert(win_ptr->current_lock_type == MPID_LOCK_NONE); - win_ptr->my_counter -= 1; - MPIU_Assert(win_ptr->my_counter >= 0); + win_ptr->at_completion_counter -= 1; + MPIU_Assert(win_ptr->at_completion_counter >= 0); /* Signal the local process when the op counter reaches 0. */ - if (win_ptr->my_counter == 0) + if (win_ptr->at_completion_counter == 0) MPIDI_CH3_Progress_signal_completion(); } diff --git a/src/mpid/ch3/src/mpid_rma.c b/src/mpid/ch3/src/mpid_rma.c index c112db0..685b665 100644 --- a/src/mpid/ch3/src/mpid_rma.c +++ b/src/mpid/ch3/src/mpid_rma.c @@ -285,7 +285,7 @@ static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model, (*win_ptr)->start_assert = 0; (*win_ptr)->comm_ptr = win_comm_ptr; - (*win_ptr)->my_counter = 0; + (*win_ptr)->at_completion_counter = 0; /* (*win_ptr)->base_addrs[] is set by caller; */ /* (*win_ptr)->sizes[] is set by caller; */ /* (*win_ptr)->disp_units[] is set by caller; */ http://git.mpich.org/mpich.git/commitdiff/c673fec42e015e9f714374dcb5d5852892... commit c673fec42e015e9f714374dcb5d58528925663a1 Author: Xin Zhao <[email protected]> Date: Tue Sep 30 16:57:18 2014 -0500 Bug-fix: correct decrementing counter in GET-like operations. For GET-like operations, We should increment the Active Target counter when the process of sending back data is not completed immediately on target and a response request is created. We should decrement the counter when the process of sending back data is completed on target side. Signed-off-by: Pavan Balaji <[email protected]> diff --git a/src/mpid/ch3/src/ch3u_handle_recv_req.c b/src/mpid/ch3/src/ch3u_handle_recv_req.c index 4579050..f1232dc 100644 --- a/src/mpid/ch3/src/ch3u_handle_recv_req.c +++ b/src/mpid/ch3/src/ch3u_handle_recv_req.c @@ -89,6 +89,8 @@ int MPIDI_CH3_ReqHandler_PutAccumRespComplete( MPIDI_VC_t *vc, MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_REQHANDLER_PUTACCUMRESPCOMPLETE); + MPID_Win_get_ptr(rreq->dev.target_win_handle, win_ptr); + /* Perform get in get-accumulate */ if (rreq->dev.resp_request_handle != MPI_REQUEST_NULL) { MPI_Aint type_size; @@ -128,6 +130,10 @@ int MPIDI_CH3_ReqHandler_PutAccumRespComplete( MPIDI_VC_t *vc, resp_req->dev.target_win_handle = rreq->dev.target_win_handle; resp_req->dev.flags = rreq->dev.flags; + /* here we increment the Active Target counter to guarantee the GET-like + operation are completed when counter reaches zero. */ + win_ptr->my_counter++; + iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) get_accum_resp_pkt; iov[0].MPID_IOV_LEN = sizeof(*get_accum_resp_pkt); @@ -146,8 +152,6 @@ int MPIDI_CH3_ReqHandler_PutAccumRespComplete( MPIDI_VC_t *vc, get_acc_flag = 1; } - MPID_Win_get_ptr(rreq->dev.target_win_handle, win_ptr); - if (MPIDI_Request_get_type(rreq) == MPIDI_REQUEST_TYPE_ACCUM_RESP) { if (win_ptr->shm_allocated == TRUE) @@ -168,13 +172,6 @@ int MPIDI_CH3_ReqHandler_PutAccumRespComplete( MPIDI_VC_t *vc, if (mpi_errno) { MPIU_ERR_POP(mpi_errno); } } - if (get_acc_flag) { - /* here we decrement the Active Target counter to guarantee the GET-like - operation are completed when counter reaches zero. */ - win_ptr->my_counter--; - MPIU_Assert(win_ptr->my_counter >= 0); - } - /* mark data transfer as complete and decrement CC */ MPIDI_CH3U_Request_complete(rreq); *complete = TRUE; @@ -333,6 +330,11 @@ int MPIDI_CH3_ReqHandler_GetAccumRespComplete( MPIDI_VC_t *vc, MPI_WIN_NULL); if (mpi_errno) { MPIU_ERR_POP(mpi_errno); } + /* here we decrement the Active Target counter to guarantee the GET-like + operation are completed when counter reaches zero. */ + win_ptr->my_counter--; + MPIU_Assert(win_ptr->my_counter >= 0); + MPIDI_CH3U_Request_complete(rreq); *complete = TRUE; fn_exit: @@ -525,6 +527,8 @@ int MPIDI_CH3_ReqHandler_FOPComplete( MPIDI_VC_t *vc, MPIDI_Pkt_init(fop_resp_pkt, MPIDI_CH3_PKT_FOP_RESP); fop_resp_pkt->request_handle = rreq->dev.request_handle; + MPID_Win_get_ptr(rreq->dev.target_win_handle, win_ptr); + /* Copy original data into the send buffer. If data will fit in the header, use that. Otherwise allocate a temporary buffer. */ if (len <= sizeof(fop_resp_pkt->data)) { @@ -539,13 +543,15 @@ int MPIDI_CH3_ReqHandler_FOPComplete( MPIDI_VC_t *vc, resp_req->dev.flags = rreq->dev.flags; resp_req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_GetAccumRespComplete; + /* here we increment the Active Target counter to guarantee the GET-like + operation are completed when counter reaches zero. */ + win_ptr->my_counter++; + MPIDI_CH3U_SRBuf_alloc(resp_req, len); MPIU_ERR_CHKANDJUMP(resp_req->dev.tmpbuf_sz < len, mpi_errno, MPI_ERR_OTHER, "**nomemreq"); MPIU_Memcpy( resp_req->dev.tmpbuf, rreq->dev.real_user_buf, len ); } - MPID_Win_get_ptr(rreq->dev.target_win_handle, win_ptr); - /* Apply the op */ if (rreq->dev.op != MPI_NO_OP) { uop = MPIR_OP_HDL_TO_FN(rreq->dev.op); @@ -573,6 +579,11 @@ int MPIDI_CH3_ReqHandler_FOPComplete( MPIDI_VC_t *vc, resp_req->dev.target_win_handle = rreq->dev.target_win_handle; resp_req->dev.flags = rreq->dev.flags; resp_req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_GetAccumRespComplete; + + /* here we increment the Active Target counter to guarantee the GET-like + operation are completed when counter reaches zero. */ + win_ptr->my_counter++; + MPID_Request_release(resp_req); goto finish_up; } @@ -607,11 +618,6 @@ int MPIDI_CH3_ReqHandler_FOPComplete( MPIDI_VC_t *vc, MPIU_Free(rreq->dev.user_buf); } - /* here we decrement the Active Target counter to guarantee the GET-like - operation are completed when counter reaches zero. */ - win_ptr->my_counter--; - MPIU_Assert(win_ptr->my_counter >= 0); - *complete = 1; fn_exit: diff --git a/src/mpid/ch3/src/ch3u_rma_sync.c b/src/mpid/ch3/src/ch3u_rma_sync.c index 1258760..ea64175 100644 --- a/src/mpid/ch3/src/ch3u_rma_sync.c +++ b/src/mpid/ch3/src/ch3u_rma_sync.c @@ -4738,12 +4738,6 @@ int MPIDI_CH3_PktHandler_Accumulate( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPIU_Object_set_ref(req, 1); *rreqp = req; - if (accum_pkt->type == MPIDI_CH3_PKT_GET_ACCUM) { - /* here we increment the Active Target counter to guarantee the GET-like - operation are completed when counter reaches zero. */ - win_ptr->my_counter++; - } - req->dev.user_count = accum_pkt->count; req->dev.op = accum_pkt->op; req->dev.real_user_buf = accum_pkt->addr; @@ -5015,6 +5009,11 @@ int MPIDI_CH3_PktHandler_CAS( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, req->dev.target_win_handle = cas_pkt->target_win_handle; req->dev.flags = cas_pkt->flags; req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_GetAccumRespComplete; + + /* here we increment the Active Target counter to guarantee the GET-like + operation are completed when counter reaches zero. */ + win_ptr->my_counter++; + MPID_Request_release(req); goto fn_exit; } @@ -5106,10 +5105,6 @@ int MPIDI_CH3_PktHandler_FOP( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPIU_Object_set_ref(req, 1); /* Ref is held by progress engine */ *rreqp = NULL; - /* here we increment the Active Target counter to guarantee the GET-like - operation are completed when counter reaches zero. */ - win_ptr->my_counter++; - req->dev.user_buf = NULL; /* will be set later */ req->dev.user_count = 1; req->dev.datatype = fop_pkt->datatype; http://git.mpich.org/mpich.git/commitdiff/d6996640a0e50e932b105064fa026c5363... commit d6996640a0e50e932b105064fa026c53633cf88c Author: Xin Zhao <[email protected]> Date: Mon Sep 29 15:36:05 2014 -0500 Bug-fix: call RMA finish function when RMA ops finishes. In the original implementation, for GACC/FOP/CAS, the function MPIDI_CH3_Finish_rma_op_target (includes operations that should be performed on target when that operation finishes on target) is not called when that operation real finishes, but is called after starting send back data. Here we fix it to make the function called after sending process on target is completed. Signed-off-by: Pavan Balaji <[email protected]> diff --git a/src/mpid/ch3/src/ch3u_handle_recv_req.c b/src/mpid/ch3/src/ch3u_handle_recv_req.c index df5583a..4579050 100644 --- a/src/mpid/ch3/src/ch3u_handle_recv_req.c +++ b/src/mpid/ch3/src/ch3u_handle_recv_req.c @@ -125,6 +125,8 @@ int MPIDI_CH3_ReqHandler_PutAccumRespComplete( MPIDI_VC_t *vc, resp_req->dev.OnFinal = MPIDI_CH3_ReqHandler_GetAccumRespComplete; resp_req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_GetAccumRespComplete; + resp_req->dev.target_win_handle = rreq->dev.target_win_handle; + resp_req->dev.flags = rreq->dev.flags; iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) get_accum_resp_pkt; iov[0].MPID_IOV_LEN = sizeof(*get_accum_resp_pkt); @@ -160,9 +162,11 @@ int MPIDI_CH3_ReqHandler_PutAccumRespComplete( MPIDI_VC_t *vc, } } + if (!get_acc_flag) { mpi_errno = MPIDI_CH3_Finish_rma_op_target(vc, win_ptr, TRUE, rreq->dev.flags, rreq->dev.source_win_handle); if (mpi_errno) { MPIU_ERR_POP(mpi_errno); } + } if (get_acc_flag) { /* here we decrement the Active Target counter to guarantee the GET-like @@ -317,11 +321,18 @@ int MPIDI_CH3_ReqHandler_GetAccumRespComplete( MPIDI_VC_t *vc, int *complete ) { int mpi_errno = MPI_SUCCESS; + MPID_Win *win_ptr; MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_REQHANDLER_GETACCUMRESPCOMPLETE); MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_REQHANDLER_GETACCUMRESPCOMPLETE); MPIU_Free(rreq->dev.user_buf); + MPID_Win_get_ptr(rreq->dev.target_win_handle, win_ptr); + + mpi_errno = MPIDI_CH3_Finish_rma_op_target(vc, win_ptr, TRUE, rreq->dev.flags, + MPI_WIN_NULL); + if (mpi_errno) { MPIU_ERR_POP(mpi_errno); } + MPIDI_CH3U_Request_complete(rreq); *complete = TRUE; fn_exit: @@ -524,6 +535,10 @@ int MPIDI_CH3_ReqHandler_FOPComplete( MPIDI_VC_t *vc, MPIU_ERR_CHKANDJUMP(resp_req == NULL, mpi_errno, MPI_ERR_OTHER, "**nomemreq"); MPIU_Object_set_ref(resp_req, 1); + resp_req->dev.target_win_handle = rreq->dev.target_win_handle; + resp_req->dev.flags = rreq->dev.flags; + resp_req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_GetAccumRespComplete; + MPIDI_CH3U_SRBuf_alloc(resp_req, len); MPIU_ERR_CHKANDJUMP(resp_req->dev.tmpbuf_sz < len, mpi_errno, MPI_ERR_OTHER, "**nomemreq"); MPIU_Memcpy( resp_req->dev.tmpbuf, rreq->dev.real_user_buf, len ); @@ -552,8 +567,25 @@ int MPIDI_CH3_ReqHandler_FOPComplete( MPIDI_VC_t *vc, MPIU_ERR_CHKANDJUMP(mpi_errno != MPI_SUCCESS, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg"); if (resp_req != NULL) { - MPID_Request_release(resp_req); + if (!MPID_Request_is_complete(resp_req)) { + /* sending process is not completed, set proper OnDataAvail + (it is initialized to NULL by lower layer) */ + resp_req->dev.target_win_handle = rreq->dev.target_win_handle; + resp_req->dev.flags = rreq->dev.flags; + resp_req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_GetAccumRespComplete; + MPID_Request_release(resp_req); + goto finish_up; + } + else { + MPID_Request_release(resp_req); + } } + + /* There are additional steps to take if this is a passive + target RMA or the last operation from the source */ + mpi_errno = MPIDI_CH3_Finish_rma_op_target(vc, win_ptr, TRUE, rreq->dev.flags, + rreq->dev.source_win_handle); + if (mpi_errno) { MPIU_ERR_POP(mpi_errno); } } else { MPID_IOV iov[MPID_IOV_LIMIT]; @@ -569,18 +601,12 @@ int MPIDI_CH3_ReqHandler_FOPComplete( MPIDI_VC_t *vc, MPIU_ERR_CHKANDJUMP(mpi_errno != MPI_SUCCESS, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg"); } + finish_up: /* Free temporary buffer allocated in PktHandler_FOP */ if (len > sizeof(int) * MPIDI_RMA_FOP_IMMED_INTS && rreq->dev.op != MPI_NO_OP) { MPIU_Free(rreq->dev.user_buf); } - /* There are additional steps to take if this is a passive - target RMA or the last operation from the source */ - - mpi_errno = MPIDI_CH3_Finish_rma_op_target(vc, win_ptr, TRUE, rreq->dev.flags, - rreq->dev.source_win_handle); - if (mpi_errno) { MPIU_ERR_POP(mpi_errno); } - /* here we decrement the Active Target counter to guarantee the GET-like operation are completed when counter reaches zero. */ win_ptr->my_counter--; diff --git a/src/mpid/ch3/src/ch3u_rma_sync.c b/src/mpid/ch3/src/ch3u_rma_sync.c index 0eeae75..1258760 100644 --- a/src/mpid/ch3/src/ch3u_rma_sync.c +++ b/src/mpid/ch3/src/ch3u_rma_sync.c @@ -5009,7 +5009,17 @@ int MPIDI_CH3_PktHandler_CAS( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPIU_ERR_CHKANDJUMP(mpi_errno != MPI_SUCCESS, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg"); if (req != NULL) { - MPID_Request_release(req); + if (!MPID_Request_is_complete(req)) { + /* sending process is not completed, set proper OnDataAvail + (it is initialized to NULL by lower layer) */ + req->dev.target_win_handle = cas_pkt->target_win_handle; + req->dev.flags = cas_pkt->flags; + req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_GetAccumRespComplete; + MPID_Request_release(req); + goto fn_exit; + } + else + MPID_Request_release(req); } ----------------------------------------------------------------------- Summary of changes: src/mpid/ch3/include/mpidpre.h | 2 +- src/mpid/ch3/src/ch3u_handle_recv_req.c | 80 +++++++++++++++++------- src/mpid/ch3/src/ch3u_handle_send_req.c | 4 +- src/mpid/ch3/src/ch3u_rma_sync.c | 103 ++++++++++++++++--------------- src/mpid/ch3/src/mpid_rma.c | 2 +- test/mpi/rma/manyrma2.c | 2 +- 6 files changed, 115 insertions(+), 78 deletions(-) hooks/post-receive -- MPICH primary repository
participants (1)
-
noreply@mpich.org