Commit 920661c3 authored by Min Si's avatar Min Si Committed by Xin Zhao
Browse files

Bug-fix: trigger final req handler for receiving derived datatype.



There are two request handlers used when receiving data:
(1) OnDataAvail, which is triggered when data is arrived;
(2) OnFinal, which is triggered when receiving data is finished;

When receiving large derived datatype, the receiving iov can be divided
into multiple iovs. The OnDataAvail handler is set to iov load function
when still waiting for remaining data. However, such handler should be
set to OnFinal when starting receiving the last iov.

The original code does not set OnDataAvail handler to OnFinal at end.
This patch fixes this bug.

Note that this bug only appears in RMA calls, because only the RMA
packet handers need to specify OnFinal.

Resolve #2189.
Signed-off-by: default avatarXin Zhao <xinzhao3@illinois.edu>
parent 669f4286
......@@ -88,6 +88,8 @@ MPID_Request * MPID_Request_create(void)
req->dev.iov_offset = 0;
req->dev.flags = MPIDI_CH3_PKT_FLAG_NONE;
req->dev.resp_request_handle = MPI_REQUEST_NULL;
req->dev.OnDataAvail = NULL;
req->dev.OnFinal = NULL;
#ifdef MPIDI_CH3_REQUEST_INIT
MPIDI_CH3_REQUEST_INIT(req);
#endif
......@@ -397,7 +399,7 @@ int MPIDI_CH3U_Request_load_recv_iov(MPID_Request * const rreq)
MPIU_DBG_MSG(CH3_CHANNEL,VERBOSE,
"updating rreq to read the remaining data directly into the user buffer");
/* Eventually, use OnFinal for this instead */
rreq->dev.OnDataAvail = 0;
rreq->dev.OnDataAvail = rreq->dev.OnFinal;
}
else if (last == rreq->dev.segment_size ||
(last - rreq->dev.segment_first) / rreq->dev.iov_count >= MPIDI_IOV_DENSITY_MIN)
......@@ -466,7 +468,7 @@ int MPIDI_CH3U_Request_load_recv_iov(MPID_Request * const rreq)
rreq->dev.iov[0].MPID_IOV_LEN = data_sz;
MPIU_Assert(MPIDI_Request_get_type(rreq) == MPIDI_REQUEST_TYPE_RECV);
/* Eventually, use OnFinal for this instead */
rreq->dev.OnDataAvail = 0;
rreq->dev.OnDataAvail = rreq->dev.OnFinal;
}
else
{
......
......@@ -4502,6 +4502,7 @@ int MPIDI_CH3_PktHandler_Put( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
/* derived datatype */
MPIDI_Request_set_type(req, MPIDI_REQUEST_TYPE_PUT_RESP_DERIVED_DT);
req->dev.datatype = MPI_DATATYPE_NULL;
req->dev.OnFinal = MPIDI_CH3_ReqHandler_PutAccumRespComplete;
req->dev.dtype_info = (MPIDI_RMA_dtype_info *)
MPIU_Malloc(sizeof(MPIDI_RMA_dtype_info));
......@@ -4806,6 +4807,7 @@ int MPIDI_CH3_PktHandler_Accumulate( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
MPIDI_Request_set_type(req, MPIDI_REQUEST_TYPE_ACCUM_RESP_DERIVED_DT);
req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_AccumRespDerivedDTComplete;
req->dev.datatype = MPI_DATATYPE_NULL;
req->dev.OnFinal = MPIDI_CH3_ReqHandler_PutAccumRespComplete;
req->dev.dtype_info = (MPIDI_RMA_dtype_info *)
MPIU_Malloc(sizeof(MPIDI_RMA_dtype_info));
......
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