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 9289c6e6a4c582f5707aaac92a2359d492832c58 (commit) from 0c54cef778aa8a4849fedf92d96c03f4a38caa3d (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/9289c6e6a4c582f5707aaac92a2359d492... commit 9289c6e6a4c582f5707aaac92a2359d492832c58 Author: Xin Zhao <[email protected]> Date: Wed Jul 1 21:10:27 2015 -0500 Revert "Perf-tuning: overlapping issuing data and computation on target side in GACC/FOP." This reverts commit 06dbf44b8fe8cc313b5bab53e2cfd59b8085f718. In commit 06dbf44b8fe8cc313b5bab53e2cfd59b8085f718, for GACC/FOP/CAS, the target side first starts sending back data, then performs computation, in order to overlap data transmission and computation. This is not correct when this operation needs to be piggybacked with a FLUSH flag, or a Win_flush call is called after this operation, because the completion of computation on the target side is not guaranteed. Here we revert this patch so that data is sent back after computation is done on the target side. diff --git a/src/mpid/ch3/src/ch3u_handle_recv_req.c b/src/mpid/ch3/src/ch3u_handle_recv_req.c index 6bc7d87..7d0c8c1 100644 --- a/src/mpid/ch3/src/ch3u_handle_recv_req.c +++ b/src/mpid/ch3/src/ch3u_handle_recv_req.c @@ -332,6 +332,18 @@ int MPIDI_CH3_ReqHandler_GaccumRecvComplete(MPIDI_VC_t * vc, MPID_Request * rreq MPID_Segment_free(seg); } + /* accumulate data from tmp_buf into user_buf */ + MPIU_Assert(predef_count == (int) predef_count); + mpi_errno = do_accumulate_op(rreq->dev.user_buf, (int) predef_count, basic_type, + rreq->dev.real_user_buf, rreq->dev.user_count, rreq->dev.datatype, + stream_offset, rreq->dev.op); + + if (win_ptr->shm_allocated == TRUE) + MPIDI_CH3I_SHM_MUTEX_UNLOCK(win_ptr); + + if (mpi_errno) + MPIU_ERR_POP(mpi_errno); + resp_req->dev.OnFinal = MPIDI_CH3_ReqHandler_GaccumSendComplete; resp_req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_GaccumSendComplete; resp_req->dev.target_win_handle = rreq->dev.target_win_handle; @@ -353,18 +365,6 @@ int MPIDI_CH3_ReqHandler_GaccumRecvComplete(MPIDI_VC_t * vc, MPID_Request * rreq MPIU_ERR_CHKANDJUMP(mpi_errno != MPI_SUCCESS, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg"); - /* accumulate data from tmp_buf into user_buf */ - MPIU_Assert(predef_count == (int) predef_count); - mpi_errno = do_accumulate_op(rreq->dev.user_buf, (int) predef_count, basic_type, - rreq->dev.real_user_buf, rreq->dev.user_count, rreq->dev.datatype, - stream_offset, rreq->dev.op); - - if (win_ptr->shm_allocated == TRUE) - MPIDI_CH3I_SHM_MUTEX_UNLOCK(win_ptr); - - if (mpi_errno) - MPIU_ERR_POP(mpi_errno); - /* Mark get portion as handled */ rreq->dev.resp_request_handle = MPI_REQUEST_NULL; @@ -467,6 +467,16 @@ int MPIDI_CH3_ReqHandler_FOPRecvComplete(MPIDI_VC_t * vc, MPID_Request * rreq, i MPID_Segment_free(seg); } + /* Perform accumulate computation */ + mpi_errno = do_accumulate_op(rreq->dev.user_buf, 1, rreq->dev.datatype, + rreq->dev.real_user_buf, 1, rreq->dev.datatype, 0, rreq->dev.op); + + if (win_ptr->shm_allocated == TRUE) + MPIDI_CH3I_SHM_MUTEX_UNLOCK(win_ptr); + + if (mpi_errno) + MPIU_ERR_POP(mpi_errno); + /* Send back data */ MPIDI_Pkt_init(fop_resp_pkt, MPIDI_CH3_PKT_FOP_RESP); fop_resp_pkt->request_handle = rreq->dev.resp_request_handle; @@ -491,16 +501,6 @@ int MPIDI_CH3_ReqHandler_FOPRecvComplete(MPIDI_VC_t * vc, MPID_Request * rreq, i MPIU_ERR_CHKANDJUMP(mpi_errno != MPI_SUCCESS, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg"); - /* Perform accumulate computation */ - mpi_errno = do_accumulate_op(rreq->dev.user_buf, 1, rreq->dev.datatype, - rreq->dev.real_user_buf, 1, rreq->dev.datatype, 0, rreq->dev.op); - - if (win_ptr->shm_allocated == TRUE) - MPIDI_CH3I_SHM_MUTEX_UNLOCK(win_ptr); - - if (mpi_errno) - MPIU_ERR_POP(mpi_errno); - if (is_empty_origin == FALSE) { /* free the temporary buffer. * When origin data is zero, there @@ -1372,6 +1372,20 @@ static inline int perform_get_acc_in_lock_queue(MPID_Win * win_ptr, MPIU_ERR_POP(mpi_errno); } + /* Perform ACCUMULATE OP */ + + /* All data fits in packet header */ + mpi_errno = + do_accumulate_op(get_accum_pkt->info.data, get_accum_pkt->count, + get_accum_pkt->datatype, get_accum_pkt->addr, get_accum_pkt->count, + get_accum_pkt->datatype, 0, get_accum_pkt->op); + + if (win_ptr->shm_allocated == TRUE) + MPIDI_CH3I_SHM_MUTEX_UNLOCK(win_ptr); + + if (mpi_errno != MPI_SUCCESS) + MPIU_ERR_POP(mpi_errno); + /* here we increment the Active Target counter to guarantee the GET-like * operation are completed when counter reaches zero. */ win_ptr->at_completion_counter++; @@ -1387,20 +1401,6 @@ static inline int perform_get_acc_in_lock_queue(MPID_Win * win_ptr, MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg"); } - /* Perform ACCUMULATE OP */ - - /* All data fits in packet header */ - mpi_errno = - do_accumulate_op(get_accum_pkt->info.data, get_accum_pkt->count, - get_accum_pkt->datatype, get_accum_pkt->addr, get_accum_pkt->count, - get_accum_pkt->datatype, 0, get_accum_pkt->op); - - if (win_ptr->shm_allocated == TRUE) - MPIDI_CH3I_SHM_MUTEX_UNLOCK(win_ptr); - - if (mpi_errno != MPI_SUCCESS) - MPIU_ERR_POP(mpi_errno); - goto fn_exit; } @@ -1446,6 +1446,19 @@ static inline int perform_get_acc_in_lock_queue(MPID_Win * win_ptr, MPID_Segment_free(seg); } + /* Perform ACCUMULATE OP */ + + MPIU_Assert(recv_count == (int) recv_count); + mpi_errno = do_accumulate_op(target_lock_entry->data, (int) recv_count, get_accum_pkt->datatype, + get_accum_pkt->addr, get_accum_pkt->count, get_accum_pkt->datatype, + 0, get_accum_pkt->op); + + if (win_ptr->shm_allocated == TRUE) + MPIDI_CH3I_SHM_MUTEX_UNLOCK(win_ptr); + + if (mpi_errno != MPI_SUCCESS) + MPIU_ERR_POP(mpi_errno); + /* here we increment the Active Target counter to guarantee the GET-like * operation are completed when counter reaches zero. */ win_ptr->at_completion_counter++; @@ -1473,19 +1486,6 @@ static inline int perform_get_acc_in_lock_queue(MPID_Win * win_ptr, MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg"); } - /* Perform ACCUMULATE OP */ - - MPIU_Assert(recv_count == (int) recv_count); - mpi_errno = do_accumulate_op(target_lock_entry->data, (int) recv_count, get_accum_pkt->datatype, - get_accum_pkt->addr, get_accum_pkt->count, get_accum_pkt->datatype, - 0, get_accum_pkt->op); - - if (win_ptr->shm_allocated == TRUE) - MPIDI_CH3I_SHM_MUTEX_UNLOCK(win_ptr); - - if (mpi_errno != MPI_SUCCESS) - MPIU_ERR_POP(mpi_errno); - fn_exit: return mpi_errno; fn_fail: @@ -1591,6 +1591,22 @@ static inline int perform_fop_in_lock_queue(MPID_Win * win_ptr, MPID_Segment_free(seg); } + /* Apply the op */ + if (fop_pkt->type == MPIDI_CH3_PKT_FOP_IMMED) { + mpi_errno = do_accumulate_op(fop_pkt->info.data, 1, fop_pkt->datatype, + fop_pkt->addr, 1, fop_pkt->datatype, 0, fop_pkt->op); + } + else { + mpi_errno = do_accumulate_op(target_lock_entry->data, 1, fop_pkt->datatype, + fop_pkt->addr, 1, fop_pkt->datatype, 0, fop_pkt->op); + } + + if (win_ptr->shm_allocated == TRUE) + MPIDI_CH3I_SHM_MUTEX_UNLOCK(win_ptr); + + if (mpi_errno != MPI_SUCCESS) + MPIU_ERR_POP(mpi_errno); + if (fop_pkt->type == MPIDI_CH3_PKT_FOP_IMMED) { /* send back the original data */ MPIU_THREAD_CS_ENTER(CH3COMM, target_lock_entry->vc); @@ -1635,22 +1651,6 @@ static inline int perform_fop_in_lock_queue(MPID_Win * win_ptr, goto fn_exit; } - /* Apply the op */ - if (fop_pkt->type == MPIDI_CH3_PKT_FOP_IMMED) { - mpi_errno = do_accumulate_op(fop_pkt->info.data, 1, fop_pkt->datatype, - fop_pkt->addr, 1, fop_pkt->datatype, 0, fop_pkt->op); - } - else { - mpi_errno = do_accumulate_op(target_lock_entry->data, 1, fop_pkt->datatype, - fop_pkt->addr, 1, fop_pkt->datatype, 0, fop_pkt->op); - } - - if (win_ptr->shm_allocated == TRUE) - MPIDI_CH3I_SHM_MUTEX_UNLOCK(win_ptr); - - if (mpi_errno != MPI_SUCCESS) - MPIU_ERR_POP(mpi_errno); - /* do final action */ mpi_errno = finish_op_on_target(win_ptr, target_lock_entry->vc, TRUE /* has response data */ , fop_pkt->flags, MPI_WIN_NULL); @@ -1700,14 +1700,6 @@ static inline int perform_cas_in_lock_queue(MPID_Win * win_ptr, MPIU_Memcpy((void *) &cas_resp_pkt->info.data, cas_pkt->addr, len); - /* Send the response packet */ - MPIU_THREAD_CS_ENTER(CH3COMM, target_lock_entry->vc); - mpi_errno = - MPIDI_CH3_iStartMsg(target_lock_entry->vc, cas_resp_pkt, sizeof(*cas_resp_pkt), &send_req); - MPIU_THREAD_CS_EXIT(CH3COMM, target_lock_entry->vc); - - MPIU_ERR_CHKANDJUMP(mpi_errno != MPI_SUCCESS, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg"); - /* Compare and replace if equal */ if (MPIR_Compare_equal(&cas_pkt->compare_data, cas_pkt->addr, cas_pkt->datatype)) { MPIU_Memcpy(cas_pkt->addr, &cas_pkt->origin_data, len); @@ -1716,6 +1708,13 @@ static inline int perform_cas_in_lock_queue(MPID_Win * win_ptr, if (win_ptr->shm_allocated == TRUE) MPIDI_CH3I_SHM_MUTEX_UNLOCK(win_ptr); + /* Send the response packet */ + MPIU_THREAD_CS_ENTER(CH3COMM, target_lock_entry->vc); + mpi_errno = MPIDI_CH3_iStartMsg(target_lock_entry->vc, cas_resp_pkt, sizeof(*cas_resp_pkt), &send_req); + MPIU_THREAD_CS_EXIT(CH3COMM, target_lock_entry->vc); + + MPIU_ERR_CHKANDJUMP(mpi_errno != MPI_SUCCESS, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg"); + if (send_req != NULL) { if (!MPID_Request_is_complete(send_req)) { /* sending process is not completed, set proper OnDataAvail diff --git a/src/mpid/ch3/src/ch3u_rma_pkthandler.c b/src/mpid/ch3/src/ch3u_rma_pkthandler.c index a1b7dd9..84231c9 100644 --- a/src/mpid/ch3/src/ch3u_rma_pkthandler.c +++ b/src/mpid/ch3/src/ch3u_rma_pkthandler.c @@ -949,6 +949,18 @@ int MPIDI_CH3_PktHandler_GetAccumulate(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt, MPIU_ERR_POP(mpi_errno); } + /* perform accumulate operation. */ + mpi_errno = + do_accumulate_op(get_accum_pkt->info.data, get_accum_pkt->count, + get_accum_pkt->datatype, get_accum_pkt->addr, get_accum_pkt->count, + get_accum_pkt->datatype, 0, get_accum_pkt->op); + + if (win_ptr->shm_allocated == TRUE) + MPIDI_CH3I_SHM_MUTEX_UNLOCK(win_ptr); + + if (mpi_errno) + MPIU_ERR_POP(mpi_errno); + iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) get_accum_resp_pkt; iov[0].MPID_IOV_LEN = sizeof(*get_accum_resp_pkt); iovcnt = 1; @@ -963,18 +975,6 @@ int MPIDI_CH3_PktHandler_GetAccumulate(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt, MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg"); } /* --END ERROR HANDLING-- */ - - /* perform accumulate operation. */ - mpi_errno = - do_accumulate_op(get_accum_pkt->info.data, get_accum_pkt->count, - get_accum_pkt->datatype, get_accum_pkt->addr, get_accum_pkt->count, - get_accum_pkt->datatype, 0, get_accum_pkt->op); - - if (win_ptr->shm_allocated == TRUE) - MPIDI_CH3I_SHM_MUTEX_UNLOCK(win_ptr); - - if (mpi_errno) - MPIU_ERR_POP(mpi_errno); } else { int is_derived_dt = 0; @@ -1206,13 +1206,6 @@ int MPIDI_CH3_PktHandler_CAS(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt, MPIU_Memcpy((void *) &cas_resp_pkt->info.data, cas_pkt->addr, len); - /* Send the response packet */ - MPIU_THREAD_CS_ENTER(CH3COMM, vc); - mpi_errno = MPIDI_CH3_iStartMsg(vc, cas_resp_pkt, sizeof(*cas_resp_pkt), &req); - MPIU_THREAD_CS_EXIT(CH3COMM, vc); - - MPIU_ERR_CHKANDJUMP(mpi_errno != MPI_SUCCESS, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg"); - /* Compare and replace if equal */ if (MPIR_Compare_equal(&cas_pkt->compare_data, cas_pkt->addr, cas_pkt->datatype)) { MPIU_Memcpy(cas_pkt->addr, &cas_pkt->origin_data, len); @@ -1221,6 +1214,13 @@ int MPIDI_CH3_PktHandler_CAS(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt, if (win_ptr->shm_allocated == TRUE) MPIDI_CH3I_SHM_MUTEX_UNLOCK(win_ptr); + /* Send the response packet */ + MPIU_THREAD_CS_ENTER(CH3COMM, vc); + mpi_errno = MPIDI_CH3_iStartMsg(vc, cas_resp_pkt, sizeof(*cas_resp_pkt), &req); + MPIU_THREAD_CS_EXIT(CH3COMM, vc); + + MPIU_ERR_CHKANDJUMP(mpi_errno != MPI_SUCCESS, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg"); + if (req != NULL) { if (!MPID_Request_is_complete(req)) { /* sending process is not completed, set proper OnDataAvail @@ -1380,12 +1380,6 @@ int MPIDI_CH3_PktHandler_FOP(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt, MPIU_ERR_POP(mpi_errno); } - /* send back the original data */ - MPIU_THREAD_CS_ENTER(CH3COMM, vc); - mpi_errno = MPIDI_CH3_iStartMsg(vc, fop_resp_pkt, sizeof(*fop_resp_pkt), &resp_req); - MPIU_THREAD_CS_EXIT(CH3COMM, vc); - MPIU_ERR_CHKANDJUMP(mpi_errno != MPI_SUCCESS, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg"); - /* Apply the op */ mpi_errno = do_accumulate_op(fop_pkt->info.data, 1, fop_pkt->datatype, fop_pkt->addr, 1, fop_pkt->datatype, 0, fop_pkt->op); @@ -1396,6 +1390,12 @@ int MPIDI_CH3_PktHandler_FOP(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt, if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno); + /* send back the original data */ + MPIU_THREAD_CS_ENTER(CH3COMM, vc); + mpi_errno = MPIDI_CH3_iStartMsg(vc, fop_resp_pkt, sizeof(*fop_resp_pkt), &resp_req); + MPIU_THREAD_CS_EXIT(CH3COMM, vc); + MPIU_ERR_CHKANDJUMP(mpi_errno != MPI_SUCCESS, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg"); + if (resp_req != NULL) { if (!MPID_Request_is_complete(resp_req)) { /* sending process is not completed, set proper OnDataAvail ----------------------------------------------------------------------- Summary of changes: src/mpid/ch3/src/ch3u_handle_recv_req.c | 145 +++++++++++++++---------------- src/mpid/ch3/src/ch3u_rma_pkthandler.c | 50 ++++++------ 2 files changed, 97 insertions(+), 98 deletions(-) hooks/post-receive -- MPICH primary repository