Commit 43da8bb0 authored by Jithin Jose's avatar Jithin Jose Committed by Charles J Archer
Browse files

OFI: Added FI_RC_RETRY and use it for all TX/RX operations.


Signed-off-by: default avatarJithin Jose <jithin.jose@intel.com>
Signed-off-by: default avatarCharles J Archer <charles.j.archer@intel.com>
parent 60482cc2
......@@ -108,7 +108,7 @@ static inline int MPID_nem_ofi_conn_req_callback(cq_tagged_entry_t * wc, MPID_Re
MPIU_Memcpy(bc, rreq->dev.user_buf, wc->len);
bc[wc->len] = '\0';
MPIU_Assert(gl_data.conn_req == rreq);
FI_RC(fi_trecv(gl_data.endpoint,
FI_RC_RETRY(fi_trecv(gl_data.endpoint,
gl_data.conn_req->dev.user_buf,
OFI_KVSAPPSTRLEN,
gl_data.mr,
......@@ -228,7 +228,7 @@ static inline int MPID_nem_ofi_preposted_callback(cq_tagged_entry_t * wc, MPID_R
REQ_OFI(new_rreq)->vc = vc;
REQ_OFI(new_rreq)->pack_buffer = pack_buffer;
REQ_OFI(new_rreq)->pack_buffer_size = pkt_len;
FI_RC(fi_trecv(gl_data.endpoint,
FI_RC_RETRY(fi_trecv(gl_data.endpoint,
REQ_OFI(new_rreq)->pack_buffer,
REQ_OFI(new_rreq)->pack_buffer_size,
gl_data.mr,
......@@ -240,7 +240,7 @@ static inline int MPID_nem_ofi_preposted_callback(cq_tagged_entry_t * wc, MPID_R
sreq->dev.next = NULL;
REQ_OFI(sreq)->event_callback = MPID_nem_ofi_cts_send_callback;
REQ_OFI(sreq)->parent = new_rreq;
FI_RC(fi_tsend(gl_data.endpoint,
FI_RC_RETRY(fi_tsend(gl_data.endpoint,
NULL,
0,
gl_data.mr,
......@@ -249,7 +249,7 @@ static inline int MPID_nem_ofi_preposted_callback(cq_tagged_entry_t * wc, MPID_R
MPIU_Assert(gl_data.persistent_req == rreq);
rreq->dev.user_count = 0;
FI_RC(fi_trecv(gl_data.endpoint,
FI_RC_RETRY(fi_trecv(gl_data.endpoint,
&rreq->dev.user_count,
sizeof rreq->dev.user_count,
gl_data.mr,
......@@ -318,7 +318,7 @@ int MPID_nem_ofi_cm_init(MPIDI_PG_t * pg_p, int pg_rank ATTRIBUTE((unused)))
persistent_req->dev.next = NULL;
REQ_OFI(persistent_req)->vc = NULL;
REQ_OFI(persistent_req)->event_callback = MPID_nem_ofi_preposted_callback;
FI_RC(fi_trecv(gl_data.endpoint,
FI_RC_RETRY(fi_trecv(gl_data.endpoint,
&persistent_req->dev.user_count,
sizeof persistent_req->dev.user_count,
gl_data.mr,
......@@ -337,7 +337,7 @@ int MPID_nem_ofi_cm_init(MPIDI_PG_t * pg_p, int pg_rank ATTRIBUTE((unused)))
conn_req->dev.next = NULL;
REQ_OFI(conn_req)->vc = NULL; /* We don't know the source yet */
REQ_OFI(conn_req)->event_callback = MPID_nem_ofi_conn_req_callback;
FI_RC(fi_trecv(gl_data.endpoint,
FI_RC_RETRY(fi_trecv(gl_data.endpoint,
conn_req->dev.user_buf,
OFI_KVSAPPSTRLEN,
gl_data.mr,
......@@ -554,7 +554,7 @@ int MPID_nem_ofi_connect_to_root(const char *business_card, MPIDI_VC_t * new_vc)
REQ_OFI(sreq)->pack_buffer = my_bc;
if (gl_data.api_set == API_SET_1) {
conn_req_send_bits = init_sendtag(0, MPIR_Process.comm_world->rank, 0, MPID_CONN_REQ);
FI_RC(fi_tsend(gl_data.endpoint,
FI_RC_RETRY(fi_tsend(gl_data.endpoint,
REQ_OFI(sreq)->pack_buffer,
my_bc_len,
gl_data.mr,
......@@ -562,7 +562,7 @@ int MPID_nem_ofi_connect_to_root(const char *business_card, MPIDI_VC_t * new_vc)
conn_req_send_bits, &(REQ_OFI(sreq)->ofi_context)), tsend);
} else {
conn_req_send_bits = init_sendtag_2(0, 0, MPID_CONN_REQ);
FI_RC(fi_tsenddata(gl_data.endpoint,
FI_RC_RETRY(fi_tsenddata(gl_data.endpoint,
REQ_OFI(sreq)->pack_buffer,
my_bc_len,
gl_data.mr,
......
......@@ -132,6 +132,28 @@ fn_fail: \
fi_strerror(-_ret)); \
} while (0)
#define FI_RC_RETRY(FUNC,STR) \
do { \
ssize_t _ret; \
do { \
_ret = FUNC; \
if(likely(_ret==0)) break; \
MPIU_ERR_##CHKANDJUMP4(_ret != -FI_EAGAIN, \
mpi_errno, \
MPI_ERR_OTHER, \
"**ofi_"#STR, \
"**ofi_"#STR" %s %d %s %s", \
__SHORT_FILE__, \
__LINE__, \
FCNAME, \
fi_strerror(-_ret)); \
mpi_errno = MPID_nem_ofi_poll(0); \
if(mpi_errno != MPI_SUCCESS) \
MPIU_ERR_POP(mpi_errno); \
} while (_ret == -FI_EAGAIN); \
} while (0)
#define PMI_RC(FUNC,STR) \
do \
{ \
......
......@@ -79,7 +79,7 @@
REQ_OFI(cts_req)->event_callback = MPID_nem_ofi_cts_recv_callback; \
REQ_OFI(cts_req)->parent = sreq; \
\
FI_RC(fi_trecv(gl_data.endpoint, \
FI_RC_RETRY(fi_trecv(gl_data.endpoint, \
NULL, \
0, \
gl_data.mr, \
......@@ -88,7 +88,7 @@
0, /* Exact tag match, no ignore bits */ \
&(REQ_OFI(cts_req)->ofi_context)),trecv); \
if (gl_data.api_set == API_SET_1){ \
FI_RC(fi_tsend(gl_data.endpoint, \
FI_RC_RETRY(fi_tsend(gl_data.endpoint, \
&REQ_OFI(sreq)->pack_buffer_size, \
sizeof(REQ_OFI(sreq)->pack_buffer_size), \
gl_data.mr, \
......@@ -96,7 +96,7 @@
match_bits, \
&(REQ_OFI(sreq)->ofi_context)),tsend); \
}else{ \
FI_RC(fi_tsenddata(gl_data.endpoint, \
FI_RC_RETRY(fi_tsenddata(gl_data.endpoint, \
&REQ_OFI(sreq)->pack_buffer_size, \
sizeof(REQ_OFI(sreq)->pack_buffer_size), \
gl_data.mr, \
......@@ -125,7 +125,7 @@ static int MPID_nem_ofi_data_callback(cq_tagged_entry_t * wc, MPID_Request * sre
switch (wc->tag & MPID_PROTOCOL_MASK) {
case MPID_MSG_CTS:
vc = REQ_OFI(sreq)->vc;
FI_RC(fi_tsend(gl_data.endpoint,
FI_RC_RETRY(fi_tsend(gl_data.endpoint,
REQ_OFI(sreq)->pack_buffer,
REQ_OFI(sreq)->pack_buffer_size,
gl_data.mr,
......
......@@ -70,9 +70,9 @@ int ADD_SUFFIX(MPID_nem_ofi_recv_callback)(cq_tagged_entry_t * wc, MPID_Request
REQ_OFI(sync_req)->event_callback = MPID_nem_ofi_sync_recv_callback;
REQ_OFI(sync_req)->parent = rreq;
#if API_SET == API_SET_1
FI_RC(fi_tsend(gl_data.endpoint,
FI_RC_RETRY(fi_tsend(gl_data.endpoint,
#elif API_SET == API_SET_2
FI_RC(fi_tsenddata(gl_data.endpoint,
FI_RC_RETRY(fi_tsenddata(gl_data.endpoint,
#endif
NULL,
0,
......@@ -168,7 +168,7 @@ ADD_SUFFIX(do_isend)(struct MPIDI_VC *vc,
ssend_match = init_recvtag_2(&ssend_mask, comm->context_id + context_offset, tag);
#endif
ssend_match |= MPID_SYNC_SEND_ACK;
FI_RC(fi_trecv(gl_data.endpoint, /* endpoint */
FI_RC_RETRY(fi_trecv(gl_data.endpoint, /* endpoint */
NULL, /* recvbuf */
0, /* data sz */
gl_data.mr, /* dynamic mr */
......@@ -178,9 +178,9 @@ ADD_SUFFIX(do_isend)(struct MPIDI_VC *vc,
&(REQ_OFI(sync_req)->ofi_context)), trecv);
}
#if API_SET == API_SET_1
FI_RC(fi_tsend(gl_data.endpoint, /* Endpoint */
FI_RC_RETRY(fi_tsend(gl_data.endpoint, /* Endpoint */
#elif API_SET == API_SET_2
FI_RC(fi_tsenddata(gl_data.endpoint, /* Endpoint */
FI_RC_RETRY(fi_tsenddata(gl_data.endpoint, /* Endpoint */
#endif
send_buffer, /* Send buffer(packed or user) */
data_sz, /* Size of the send */
......@@ -333,7 +333,7 @@ int ADD_SUFFIX(MPID_nem_ofi_recv_posted)(struct MPIDI_VC *vc, struct MPID_Reques
msg.ignore = mask_bits;
msg.context = (void *) &(REQ_OFI(rreq)->ofi_context);
msg.data = 0;
FI_RC(fi_trecvmsg(gl_data.endpoint,&msg,msgflags), trecv);
FI_RC_RETRY(fi_trecvmsg(gl_data.endpoint,&msg,msgflags), trecv);
END_FUNC_RC(FCNAME);
}
......
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