[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2b1-52-g3ccad54
Service Account
noreply at mpich.org
Tue Apr 7 21:37:13 CDT 2015
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 3ccad54bd508c2a48525f4204a1b1622c8c0bca9 (commit)
via f4b253ca6b352e70a507ac585fa2c85965bdd530 (commit)
via fe576505335b4d93e8c0c66c943f40f73fa31d90 (commit)
via dc563e5a027ee7e6fb93fcff42880584963295fa (commit)
via 3093fe702697dc53d69dff5134492211d6cb2098 (commit)
via 4ab1144b469ffe8e3d0c393b9daa9e704aa31d80 (commit)
via a6b35edc1a218d747f71e0b73aff0ffb17ad18ad (commit)
via ec8ce7a9365930b1fc1a3bdb711dc20eac049b18 (commit)
via ae5e72186ae56d097124b6abfdc4bc906c8052a4 (commit)
via 211e8986c621369fa503ee99194069b5dbfd0f45 (commit)
via 0bdc7e7411b24707aa67708f1779a2cac104cbb4 (commit)
from 32e24c1db7163dfd7f13f8bba6c9321cc53c6972 (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/3ccad54bd508c2a48525f4204a1b1622c8c0bca9
commit 3ccad54bd508c2a48525f4204a1b1622c8c0bca9
Author: Norio Yamaguchi <norio.yamaguchi at riken.jp>
Date: Tue Mar 31 14:50:52 2015 +0900
Add copyright in netmod-IB
Also change individual author to organization names.
Signed-off-by: Huiwei Lu <huiweilu at mcs.anl.gov>
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_finalize.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_finalize.c
index cb047f0..b9b560e 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_finalize.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_finalize.c
@@ -1,7 +1,8 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* (C) 2012 NEC Corporation
- * Author: Masamichi Takagi
+ * (C) 2014 RIKEN AICS
+ *
* See COPYRIGHT in top-level directory.
*/
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
index ad1481b..21c080f 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
@@ -1,8 +1,9 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* (C) 2012 NEC Corporation
- * Author: Masamichi Takagi
- * (C) 2012 Oct 14 Yutaka Ishikawa, ishikawa at is.s.u-tokyo.ac.jp
+ * (C) 2012 University of Tokyo
+ * (C) 2014-2015 RIKEN AICS
+ *
* See COPYRIGHT in top-level directory.
*/
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h
index 0d6af7e..ebce06c 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h
@@ -1,8 +1,9 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* (C) 2012 NEC Corporation
- * Author: Masamichi Takagi
- * (C) 2012 Oct 14 Yutaka Ishikawa, ishikawa at is.s.u-tokyo.ac.jp
+ * (C) 2012 University of Tokyo
+ * (C) 2014 RIKEN AICS
+ *
* See COPYRIGHT in top-level directory.
*/
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
index 25c334a..faa3079 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
@@ -1,7 +1,8 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* (C) 2012 NEC Corporation
- * Author: Masamichi Takagi
+ * (C) 2014-2015 RIKEN AICS
+ *
* See COPYRIGHT in top-level directory.
*/
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_init.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_init.c
index 804a066..9010a6b 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_init.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_init.c
@@ -1,10 +1,10 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* (C) 2006 by Argonne National Laboratory.
- * See COPYRIGHT in top-level directory.
- *
* (C) 2012 NEC Corporation
- * Author: Masamichi Takagi
+ * (C) 2014-2015 RIKEN AICS
+ *
+ * See COPYRIGHT in top-level directory.
*/
#include "ib_impl.h"
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
index 95f72e0..1235fdf 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
@@ -1,7 +1,8 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* (C) 2013 NEC Corporation
- * Author: Masamichi Takagi
+ * (C) 2014-2015 RIKEN AICS
+ *
* See COPYRIGHT in top-level directory.
*/
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_malloc.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_malloc.c
index fe08357..e9a21c5 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_malloc.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_malloc.c
@@ -1,3 +1,10 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ * (C) 2014-2015 RIKEN AICS
+ *
+ * See COPYRIGHT in top-level directory.
+ */
+
#define _GNU_SOURCE 1
#include <stdio.h>
#include <stdlib.h>
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
index 1678d37..d3cab00 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
@@ -1,7 +1,9 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* (C) 2012 NEC Corporation
- * Author: Masamichi Takagi
+ * (C) 2014 RIKEN AICS
+ * (C) 2014-2015 RIKEN AICS
+ *
* See COPYRIGHT in top-level directory.
*/
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_reg_mr.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_reg_mr.c
index c9dca68..78457eb 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_reg_mr.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_reg_mr.c
@@ -1,9 +1,10 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
+ * (C) 2001-2009 University of Tokyo
* (C) 2012 NEC Corporation
- * Author: Masamichi Takagi
- * (C) 2012 Oct 10 Min Si
- * (C) 2001-2009 Yutaka Ishikawa
+ * (C) 2012 University of Tokyo
+ * (C) 2014-2015 RIKEN AICS
+ *
* See COPYRIGHT in top-level directory.
*/
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
index 5978bd9..701cc19 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
@@ -1,7 +1,9 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* (C) 2012 NEC Corporation
- * Author: Masamichi Takagi
+ * (C) 2014 RIKEN AICS
+ * (C) 2014-2015 RIKEN AICS
+ *
* See COPYRIGHT in top-level directory.
*/
http://git.mpich.org/mpich.git/commitdiff/f4b253ca6b352e70a507ac585fa2c85965bdd530
commit f4b253ca6b352e70a507ac585fa2c85965bdd530
Author: Norio Yamaguchi <norio.yamaguchi at riken.jp>
Date: Tue Mar 31 14:38:16 2015 +0900
Fix operation of long messages in netmod-IB
Signed-off-by: Huiwei Lu <huiweilu at mcs.anl.gov>
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
index 72cffc9..25c334a 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
@@ -722,9 +722,12 @@ typedef struct {
void *addr;
uint32_t rkey;
uint8_t tail; /* last word of payload */
- int len;
+ long len;
MPI_Request sender_req_id; /* request id of sender side */
+ MPI_Request receiver_req_id; /* request id of sender side */
uint32_t max_msg_sz; /* max message size */
+ int seg_seq_num;
+ int seg_num;
} MPID_nem_ib_rma_lmt_cookie_t;
typedef enum MPID_nem_ib_pkt_subtype {
@@ -927,13 +930,13 @@ int pkt_DONE_handler(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt, MPIDI_msg_sz_t * bu
} \
} while (0)
-#define MPID_nem_ib_lmt_send_RTS(vc, _req_id, _addr, _rkey, _seg_seq_num) do { \
+#define MPID_nem_ib_lmt_send_RTS(_subtype, vc, _req_id, _addr, _rkey, _seg_seq_num) do { \
MPID_PKT_DECL_CAST(_upkt, MPID_nem_ib_pkt_lmt_rts_t, _rts_pkt); \
MPID_Request *_rts_req; \
\
MPIU_DBG_MSG(CH3_OTHER,VERBOSE,"sending rndv RTS segment packet"); \
MPIDI_Pkt_init(_rts_pkt, MPIDI_NEM_PKT_NETMOD); \
- _rts_pkt->subtype = MPIDI_NEM_IB_PKT_LMT_RTS;\
+ _rts_pkt->subtype = _subtype;\
_rts_pkt->req_id = _req_id; \
_rts_pkt->addr = _addr; \
_rts_pkt->rkey = _rkey; \
@@ -962,6 +965,7 @@ int pkt_DONE_handler(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt, MPIDI_msg_sz_t * bu
MPIDI_Pkt_init(_done_pkt, MPIDI_NEM_PKT_NETMOD); \
_done_pkt->subtype = MPIDI_NEM_IB_PKT_RMA_LMT_GET_DONE;\
_done_pkt->req_id = (rreq)->ch.lmt_req_id; \
+ _done_pkt->receiver_req_id = (rreq)->handle; \
/* embed SR occupancy information */ \
_done_pkt->seq_num_tail = VC_FIELD(vc, ibcom->rsr_seq_num_tail); \
\
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
index 0f6f1a6..95f72e0 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
@@ -186,7 +186,7 @@ int MPID_nem_ib_lmt_start_recv_core(struct MPID_Request *req, void *raddr, uint3
MPID_nem_ib_com_get_info_conn(vc_ib->sc->fd, MPID_NEM_IB_COM_INFOKEY_PATTR_MAX_MSG_SZ,
&r_max_msg_sz, sizeof(uint32_t));
- divide = (max_msg_sz + r_max_msg_sz - 1) / r_max_msg_sz;
+ divide = (len + r_max_msg_sz - 1) / r_max_msg_sz;
write_pos = write_to_buf;
posted_num = 0;
@@ -196,7 +196,7 @@ int MPID_nem_ib_lmt_start_recv_core(struct MPID_Request *req, void *raddr, uint3
for (i = 0; i < divide; i++) {
if (i == divide - 1)
- data_sz = max_msg_sz - i * r_max_msg_sz;
+ data_sz = len - i * r_max_msg_sz;
else
data_sz = r_max_msg_sz;
@@ -206,8 +206,7 @@ int MPID_nem_ib_lmt_start_recv_core(struct MPID_Request *req, void *raddr, uint3
else
last = MPID_NEM_IB_LMT_SEGMENT_LAST; /* last part of this segment */
- /* last data may be smaller than initiator's max_msg_sz */
- if (rest_data_sz < max_msg_sz)
+ if (rest_data_sz < r_max_msg_sz)
data_sz = rest_data_sz;
}
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
index 608e4be..1678d37 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
@@ -446,6 +446,9 @@ int MPID_nem_ib_drain_scq(int dont_call_progress)
MPIU_Free(REQ_FIELD(req, lmt_pack_buf));
MPIDI_CH3U_Request_complete(req);
}
+ else if (req_wrap->mf == MPID_NEM_IB_LMT_SEGMENT_LAST) {
+ MPID_nem_ib_lmt_send_PKT_LMT_DONE(req->ch.vc, req);
+ }
/* decrement the number of entries in IB command queue */
vc_ib->ibcom->ncom -= 1;
@@ -1434,35 +1437,69 @@ int MPID_nem_ib_PktHandler_rma_lmt_rts(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
MPID_nem_ib_vc_area *vc_ib = VC_IB(vc);
int mpi_errno = MPI_SUCCESS;
MPID_Request *req = NULL;
- MPIDI_CH3_Pkt_t *pkt_hdr = (MPIDI_CH3_Pkt_t *) ((uint8_t *) pkt + sizeof(MPIDI_CH3_Pkt_t));
- MPID_nem_ib_rma_lmt_cookie_t *s_cookie_buf =
- (MPID_nem_ib_rma_lmt_cookie_t *) ((uint8_t *) pkt + sizeof(MPIDI_CH3_Pkt_t) +
- sizeof(MPIDI_CH3_Pkt_t));
+ MPID_nem_ib_pkt_lmt_rts_t *rts_pkt = (MPID_nem_ib_pkt_lmt_rts_t *) pkt;
void *write_to_buf;
+ void *addr;
+ uint32_t rkey;
+ long length;
+ int last;
MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_IB_PKTHANDLER_RMA_LMT_RTS);
MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_IB_PKTHANDLER_RMA_LMT_RTS);
- req = MPID_Request_create();
- MPIU_Object_set_ref(req, 1); /* decrement only in drain_scq ? */
+ if (rts_pkt->seg_seq_num == 1) {
+ // receive a packet for first segment
+ MPIDI_CH3_Pkt_t *pkt_hdr = (MPIDI_CH3_Pkt_t *) ((uint8_t *) pkt + sizeof(MPIDI_CH3_Pkt_t));
+ MPID_nem_ib_rma_lmt_cookie_t *s_cookie_buf =
+ (MPID_nem_ib_rma_lmt_cookie_t *) ((uint8_t *) pkt + sizeof(MPIDI_CH3_Pkt_t) +
+ sizeof(MPIDI_CH3_Pkt_t));
+
+ req = MPID_Request_create();
+ MPIU_Object_set_ref(req, 1); /* decrement only in drain_scq ? */
+
+ req->ch.lmt_data_sz = s_cookie_buf->len;
+ req->ch.lmt_req_id = s_cookie_buf->sender_req_id;
+
+ REQ_FIELD(req, max_msg_sz) = s_cookie_buf->max_msg_sz;
+
+ REQ_FIELD(req, lmt_pack_buf) =
+ MPIU_Malloc(sizeof(MPIDI_CH3_Pkt_t) + (size_t) req->ch.lmt_data_sz);
+ MPIU_ERR_CHKANDJUMP(!REQ_FIELD(req, lmt_pack_buf), mpi_errno, MPI_ERR_OTHER,
+ "**outofmemory");
+
+ memcpy(REQ_FIELD(req, lmt_pack_buf), pkt_hdr, sizeof(MPIDI_CH3_Pkt_t));
+ REQ_FIELD(req, seg_num) = s_cookie_buf->seg_num; /* store number of segments */
- req->ch.lmt_data_sz = s_cookie_buf->len;
- req->ch.lmt_req_id = s_cookie_buf->sender_req_id;
+ addr = s_cookie_buf->addr;
+ rkey = s_cookie_buf->rkey;
- REQ_FIELD(req, lmt_pack_buf) =
- MPIU_Malloc(sizeof(MPIDI_CH3_Pkt_t) + (size_t) req->ch.lmt_data_sz);
- MPIU_ERR_CHKANDJUMP(!REQ_FIELD(req, lmt_pack_buf), mpi_errno, MPI_ERR_OTHER, "**outofmemory");
+ REQ_FIELD(req, lmt_tail) = s_cookie_buf->tail;
+ }
+ else {
+ MPID_Request_get_ptr(rts_pkt->req_id, req);
+ addr = rts_pkt->addr;
+ rkey = rts_pkt->rkey;
+ }
- memcpy(REQ_FIELD(req, lmt_pack_buf), pkt_hdr, sizeof(MPIDI_CH3_Pkt_t));
+ if (rts_pkt->seg_seq_num == REQ_FIELD(req, seg_num)) {
+ last = 1;
+ length =
+ req->ch.lmt_data_sz - (long) (rts_pkt->seg_seq_num - 1) * REQ_FIELD(req, max_msg_sz);
+ }
+ else {
+ last = 0;
+ length = REQ_FIELD(req, max_msg_sz);
+ }
/* RDMA READ buffer address */
- write_to_buf = (void *) ((char *) REQ_FIELD(req, lmt_pack_buf) + sizeof(MPIDI_CH3_Pkt_t));
+ write_to_buf =
+ (void *) ((char *) REQ_FIELD(req, lmt_pack_buf) + sizeof(MPIDI_CH3_Pkt_t) +
+ (rts_pkt->seg_seq_num - 1) * REQ_FIELD(req, max_msg_sz));
/* stash vc for ib_poll */
req->ch.vc = vc;
- REQ_FIELD(req, lmt_tail) = s_cookie_buf->tail;
MPIDI_Request_set_type(req, MPIDI_REQUEST_TYPE_SEND); // Set dummy type for ib_drain_scq
/* try to issue RDMA-read command */
@@ -1472,9 +1509,8 @@ int MPID_nem_ib_PktHandler_rma_lmt_rts(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
MPID_nem_ib_ncqe < MPID_NEM_IB_COM_MAX_CQ_CAPACITY - slack) {
MPIDI_Request_set_msg_type(req, MPIDI_REQUEST_RNDV_MSG);
mpi_errno =
- MPID_nem_ib_lmt_start_recv_core(req, s_cookie_buf->addr, s_cookie_buf->rkey,
- s_cookie_buf->len, write_to_buf,
- s_cookie_buf->max_msg_sz, 1);
+ MPID_nem_ib_lmt_start_recv_core(req, addr, rkey, length, write_to_buf,
+ REQ_FIELD(req, max_msg_sz), last);
if (mpi_errno) {
MPIU_ERR_POP(mpi_errno);
}
@@ -1487,12 +1523,11 @@ int MPID_nem_ib_PktHandler_rma_lmt_rts(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
MPID_nem_ib_ncqe < MPID_NEM_IB_COM_MAX_CQ_CAPACITY);
/* make raddr, (sz is in rreq->ch.lmt_data_sz), rkey, (user_buf is in req->dev.user_buf) survive enqueue, free cookie, dequeue */
- REQ_FIELD(req, lmt_raddr) = s_cookie_buf->addr;
- REQ_FIELD(req, lmt_rkey) = s_cookie_buf->rkey;
+ REQ_FIELD(req, lmt_raddr) = addr;
+ REQ_FIELD(req, lmt_rkey) = rkey;
REQ_FIELD(req, lmt_write_to_buf) = write_to_buf;
- REQ_FIELD(req, lmt_szsend) = s_cookie_buf->len;
- REQ_FIELD(req, max_msg_sz) = s_cookie_buf->max_msg_sz;
- REQ_FIELD(req, last) = 1; /* not support segmentation */
+ REQ_FIELD(req, lmt_szsend) = length;
+ REQ_FIELD(req, last) = last; /* not support segmentation */
/* set for send_progress */
MPIDI_Request_set_msg_type(req, MPIDI_REQUEST_RNDV_MSG);
@@ -1501,9 +1536,15 @@ int MPID_nem_ib_PktHandler_rma_lmt_rts(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
MPID_nem_ib_sendq_enqueue(&vc_ib->sendq, req);
}
- /* prefix + header + data */
- *buflen =
- sizeof(MPIDI_CH3_Pkt_t) + sizeof(MPIDI_CH3_Pkt_t) + sizeof(MPID_nem_ib_rma_lmt_cookie_t);
+ if (rts_pkt->seg_seq_num == 1) {
+ /* prefix + header + data */
+ *buflen =
+ sizeof(MPIDI_CH3_Pkt_t) + sizeof(MPIDI_CH3_Pkt_t) +
+ sizeof(MPID_nem_ib_rma_lmt_cookie_t);
+ }
+ else {
+ *buflen = sizeof(MPIDI_CH3_Pkt_t);
+ }
*rreqp = NULL;
fn_exit:
@@ -1593,8 +1634,8 @@ int MPID_nem_ib_pkt_GET_DONE_handler(MPIDI_VC_t * vc,
#else
void *_addr = addr;
#endif
- MPID_nem_ib_lmt_send_RTS(vc, done_pkt->receiver_req_id, _addr, mr->rkey,
- next_seg_seq_num);
+ MPID_nem_ib_lmt_send_RTS(MPIDI_NEM_IB_PKT_LMT_RTS, vc, done_pkt->receiver_req_id, _addr,
+ mr->rkey, next_seg_seq_num);
}
break;
default:
@@ -1819,32 +1860,62 @@ int MPID_nem_ib_pkt_rma_lmt_getdone(MPIDI_VC_t * vc,
/* decrement reference counter of mr_cache_entry */
MPID_nem_ib_com_reg_mr_release(REQ_FIELD(req, lmt_mr_cache));
- req_type = MPIDI_Request_get_type(req);
- /* free memory area for cookie */
- if (!req->ch.s_cookie) {
- dprintf("lmt_done_send,enter,req->ch.s_cookie is zero");
- }
- MPIU_Free(req->ch.s_cookie);
+ if (REQ_FIELD(req, seg_seq_num) == REQ_FIELD(req, seg_num)) {
+ req_type = MPIDI_Request_get_type(req);
+ /* free memory area for cookie */
+ if (!req->ch.s_cookie) {
+ dprintf("lmt_done_send,enter,req->ch.s_cookie is zero");
+ }
+ MPIU_Free(req->ch.s_cookie);
- if ((req_type == 0 && !req->comm) || (req_type == MPIDI_REQUEST_TYPE_GET_RESP)) {
- if ((*req->cc_ptr == 1) && req->dev.datatype_ptr && (req->dev.segment_size > 0) &&
- REQ_FIELD(req, lmt_pack_buf)) {
- MPIU_Free(REQ_FIELD(req, lmt_pack_buf));
+ if ((req_type == 0 && !req->comm) || (req_type == MPIDI_REQUEST_TYPE_GET_RESP)) {
+ if ((*req->cc_ptr == 1) && req->dev.datatype_ptr && (req->dev.segment_size > 0) &&
+ REQ_FIELD(req, lmt_pack_buf)) {
+ MPIU_Free(REQ_FIELD(req, lmt_pack_buf));
+ }
}
- }
- int (*reqFn) (MPIDI_VC_t *, MPID_Request *, int *);
- reqFn = req->dev.OnDataAvail;
+ int (*reqFn) (MPIDI_VC_t *, MPID_Request *, int *);
+ reqFn = req->dev.OnDataAvail;
- if (*req->cc_ptr == 1 &&
- (reqFn == MPIDI_CH3_ReqHandler_ReqOpsComplete
- || reqFn == MPIDI_CH3_ReqHandler_GetSendComplete)) {
- MPIDI_VC_t *_vc = req->ch.vc;
- int complete = 0;
- mpi_errno = reqFn(_vc, req, &complete);
+ if (*req->cc_ptr == 1 &&
+ (reqFn == MPIDI_CH3_ReqHandler_ReqOpsComplete
+ || reqFn == MPIDI_CH3_ReqHandler_GetSendComplete)) {
+ MPIDI_VC_t *_vc = req->ch.vc;
+ int complete = 0;
+ mpi_errno = reqFn(_vc, req, &complete);
+ }
+ else {
+ MPIDI_CH3U_Request_complete(req);
+ }
}
else {
- MPIDI_CH3U_Request_complete(req);
+ REQ_FIELD(req, seg_seq_num) += 1; /* next segment number */
+ int next_seg_seq_num = REQ_FIELD(req, seg_seq_num);
+
+ uint32_t length;
+ if (next_seg_seq_num == REQ_FIELD(req, seg_num))
+ length = REQ_FIELD(req, data_sz) - (long) (next_seg_seq_num - 1) * REQ_FIELD(req, max_msg_sz); //length of last segment
+ else
+ length = REQ_FIELD(req, max_msg_sz);
+
+ void *addr =
+ (void *) ((char *) REQ_FIELD(req, buf.from) +
+ (long) (next_seg_seq_num - 1) * REQ_FIELD(req, max_msg_sz));
+ struct MPID_nem_ib_com_reg_mr_cache_entry_t *mr_cache =
+ MPID_nem_ib_com_reg_mr_fetch(addr, length, 0, MPID_NEM_IB_COM_REG_MR_GLOBAL);
+ MPIU_ERR_CHKANDJUMP(!mr_cache, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_reg_mr_fetch");
+ struct ibv_mr *mr = mr_cache->mr;
+ /* store new cache entry */
+ REQ_FIELD(req, lmt_mr_cache) = (void *) mr_cache;
+
+#ifdef HAVE_LIBDCFA
+ void *_addr = mr->host_addr;
+#else
+ void *_addr = addr;
+#endif
+ MPID_nem_ib_lmt_send_RTS(MPIDI_NEM_IB_PKT_RMA_LMT_RTS, vc, done_pkt->receiver_req_id, _addr,
+ mr->rkey, next_seg_seq_num);
}
*rreqp = NULL;
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_reg_mr.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_reg_mr.c
index d97ed5d..c9dca68 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_reg_mr.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_reg_mr.c
@@ -223,7 +223,7 @@ void *MPID_nem_ib_com_reg_mr_fetch(void *addr, long len,
num_global_cache--;
/* end loop if the total length released exceeds the requested */
- if (dereg_total > len_aligned) {
+ if (dereg_total >= len_aligned) {
dprintf("ib_com_reg_mr_fetch,dereg=%llu,len=%ld\n", dereg_total,
len_aligned);
/* re-registraion */
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
index 39d6325..5978bd9 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
@@ -29,11 +29,11 @@ static int MPID_nem_ib_iSendContig_core(MPIDI_VC_t * vc, MPID_Request * sreq, vo
int mpi_errno = MPI_SUCCESS;
int ibcom_errno;
MPID_nem_ib_vc_area *vc_ib = VC_IB(vc);
- MPID_nem_ib_pkt_prefix_t pkt_netmod;
+ MPID_nem_ib_pkt_lmt_rts_t pkt_rts;
void *prefix;
int sz_prefix;
void *s_data;
- int s_data_sz;
+ long s_data_sz;
MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_IB_ISENDCONTIG_CORE);
MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_IB_ISENDCONTIG_CORE);
@@ -66,9 +66,9 @@ static int MPID_nem_ib_iSendContig_core(MPIDI_VC_t * vc, MPID_Request * sreq, vo
if (MPID_NEM_IB_NETMOD_HDR_SIZEOF(vc_ib->ibcom->local_ringbuf_type)
+ sizeof(MPIDI_CH3_Pkt_t) + data_sz
> MPID_NEM_IB_COM_RDMABUF_SZSEG - sizeof(MPID_nem_ib_netmod_trailer_t)) {
- pkt_netmod.type = MPIDI_NEM_PKT_NETMOD;
+ pkt_rts.type = MPIDI_NEM_PKT_NETMOD;
- pkt_netmod.subtype = MPIDI_NEM_IB_PKT_RMA_LMT_RTS;
+ pkt_rts.subtype = MPIDI_NEM_IB_PKT_RMA_LMT_RTS;
void *write_from_buf = data;
@@ -83,9 +83,19 @@ static int MPID_nem_ib_iSendContig_core(MPIDI_VC_t * vc, MPID_Request * sreq, vo
s_cookie_buf->tail =
*((uint8_t *) ((uint8_t *) write_from_buf + data_sz - sizeof(uint8_t)));
+
+ int post_num = (data_sz + (long) max_msg_sz - 1) / (long) max_msg_sz;
+ long length;
+ if (post_num > 1) {
+ length = max_msg_sz;
+ }
+ else {
+ length = data_sz;
+ }
+
/* put IB rkey */
struct MPID_nem_ib_com_reg_mr_cache_entry_t *mr_cache =
- MPID_nem_ib_com_reg_mr_fetch(write_from_buf, data_sz, 0,
+ MPID_nem_ib_com_reg_mr_fetch(write_from_buf, length, 0,
MPID_NEM_IB_COM_REG_MR_GLOBAL);
MPIU_ERR_CHKANDJUMP(!mr_cache, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_reg_mr_fetch");
struct ibv_mr *mr = mr_cache->mr;
@@ -99,9 +109,19 @@ static int MPID_nem_ib_iSendContig_core(MPIDI_VC_t * vc, MPID_Request * sreq, vo
s_cookie_buf->len = data_sz;
s_cookie_buf->sender_req_id = sreq->handle;
s_cookie_buf->max_msg_sz = max_msg_sz;
+ s_cookie_buf->seg_seq_num = 1;
+ s_cookie_buf->seg_num = post_num;
+
+ pkt_rts.seg_seq_num = 1;
+
+ REQ_FIELD(sreq, buf.from) = write_from_buf;
+ REQ_FIELD(sreq, data_sz) = data_sz;
+ REQ_FIELD(sreq, seg_seq_num) = 1; // only send 1st-segment, even if there are some segments.
+ REQ_FIELD(sreq, seg_num) = post_num;
+ REQ_FIELD(sreq, max_msg_sz) = max_msg_sz;
/* set for ib_com_isend */
- prefix = (void *) &pkt_netmod;
+ prefix = (void *) &pkt_rts;
sz_prefix = sizeof(MPIDI_CH3_Pkt_t);
s_data = (void *) s_cookie_buf;
s_data_sz = sizeof(MPID_nem_ib_rma_lmt_cookie_t);
@@ -465,8 +485,8 @@ static int MPID_nem_ib_SendNoncontig_core(MPIDI_VC_t * vc, MPID_Request * sreq,
void *prefix;
int prefix_sz;
void *data;
- int data_sz;
- MPID_nem_ib_pkt_prefix_t pkt_netmod;
+ long data_sz;
+ MPID_nem_ib_pkt_lmt_rts_t pkt_rts;
prefix = NULL;
prefix_sz = 0;
@@ -495,9 +515,9 @@ static int MPID_nem_ib_SendNoncontig_core(MPIDI_VC_t * vc, MPID_Request * sreq,
if (MPID_NEM_IB_NETMOD_HDR_SIZEOF(vc_ib->ibcom->local_ringbuf_type)
+ sizeof(MPIDI_CH3_Pkt_t) + data_sz
> MPID_NEM_IB_COM_RDMABUF_SZSEG - sizeof(MPID_nem_ib_netmod_trailer_t)) {
- pkt_netmod.type = MPIDI_NEM_PKT_NETMOD;
+ pkt_rts.type = MPIDI_NEM_PKT_NETMOD;
- pkt_netmod.subtype = MPIDI_NEM_IB_PKT_RMA_LMT_RTS;
+ pkt_rts.subtype = MPIDI_NEM_IB_PKT_RMA_LMT_RTS;
void *write_from_buf = REQ_FIELD(sreq, lmt_pack_buf);
@@ -512,9 +532,19 @@ static int MPID_nem_ib_SendNoncontig_core(MPIDI_VC_t * vc, MPID_Request * sreq,
s_cookie_buf->tail =
*((uint8_t *) ((uint8_t *) write_from_buf + data_sz - sizeof(uint8_t)));
+
+ int post_num = (data_sz + (long) max_msg_sz - 1) / (long) max_msg_sz;
+ long length;
+ if (post_num > 1) {
+ length = max_msg_sz;
+ }
+ else {
+ length = data_sz;
+ }
+
/* put IB rkey */
struct MPID_nem_ib_com_reg_mr_cache_entry_t *mr_cache =
- MPID_nem_ib_com_reg_mr_fetch(write_from_buf, data_sz, 0,
+ MPID_nem_ib_com_reg_mr_fetch(write_from_buf, length, 0,
MPID_NEM_IB_COM_REG_MR_GLOBAL);
MPIU_ERR_CHKANDJUMP(!mr_cache, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_reg_mr_fetch");
struct ibv_mr *mr = mr_cache->mr;
@@ -528,9 +558,19 @@ static int MPID_nem_ib_SendNoncontig_core(MPIDI_VC_t * vc, MPID_Request * sreq,
s_cookie_buf->len = data_sz;
s_cookie_buf->sender_req_id = sreq->handle;
s_cookie_buf->max_msg_sz = max_msg_sz;
+ s_cookie_buf->seg_seq_num = 1;
+ s_cookie_buf->seg_num = post_num;
+
+ pkt_rts.seg_seq_num = 1;
+
+ REQ_FIELD(sreq, buf.from) = write_from_buf;
+ REQ_FIELD(sreq, data_sz) = data_sz;
+ REQ_FIELD(sreq, seg_seq_num) = 1; // only send 1st-segment, even if there are some segments.
+ REQ_FIELD(sreq, seg_num) = post_num;
+ REQ_FIELD(sreq, max_msg_sz) = max_msg_sz;
/* set for ib_com_isend */
- prefix = (void *) &pkt_netmod;
+ prefix = (void *) &pkt_rts;
prefix_sz = sizeof(MPIDI_CH3_Pkt_t);
data = (void *) s_cookie_buf;
data_sz = sizeof(MPID_nem_ib_rma_lmt_cookie_t);
http://git.mpich.org/mpich.git/commitdiff/fe576505335b4d93e8c0c66c943f40f73fa31d90
commit fe576505335b4d93e8c0c66c943f40f73fa31d90
Author: Norio Yamaguchi <norio.yamaguchi at riken.jp>
Date: Mon Mar 30 17:25:44 2015 +0900
Fix some build warnings in netmod-IB
Signed-off-by: Huiwei Lu <huiweilu at mcs.anl.gov>
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
index 9064232..ad1481b 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
@@ -128,7 +128,7 @@ static int MPID_nem_ib_rdmawr_to_init(uint64_t sz)
void *MPID_nem_ib_rdmawr_to_alloc(int nslots)
{
dprintf("rdmawr_to_alloc,nslots=%d\n", nslots);
- void *start;
+ void *start = NULL;
int i;
for (i = 0; i < nslots; i++) {
//dprintf("MPID_nem_ib_rdmawr_to_alloc,free_list=%p\n", MPID_nem_ib_rdmawr_to_alloc_free_list);
@@ -505,7 +505,6 @@ int MPID_nem_ib_com_open(int ib_port, int open_flag, int *condesc)
MPID_nem_ib_com_t *conp;
struct ibv_qp_init_attr qp_init_attr;
struct ibv_sge *sge;
- int mr_flags;
int i;
dprintf("MPID_nem_ib_com_open,port=%d,flag=%08x\n", ib_port, open_flag);
@@ -725,7 +724,6 @@ int MPID_nem_ib_com_open(int ib_port, int open_flag, int *condesc)
memset(conp->icom_mem, 0, sizeof(void **) * MPID_NEM_IB_COM_NBUF_RDMA);
conp->icom_msize = (int *) MPIU_Malloc(sizeof(int *) * MPID_NEM_IB_COM_NBUF_RDMA);
memset(conp->icom_msize, 0, sizeof(int *) * MPID_NEM_IB_COM_NBUF_RDMA);
- mr_flags = IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_READ | IBV_ACCESS_REMOTE_WRITE;
/* RDMA-write-to local memory area */
conp->icom_msize[MPID_NEM_IB_COM_RDMAWR_TO] = MPID_NEM_IB_COM_RDMABUF_SZ;
@@ -783,7 +781,6 @@ int MPID_nem_ib_com_open(int ib_port, int open_flag, int *condesc)
memset(conp->icom_mem, 0, sizeof(void *) * MPID_NEM_IB_COM_NBUF_SCRATCH_PAD);
conp->icom_msize = (int *) MPIU_Malloc(sizeof(int) * MPID_NEM_IB_COM_NBUF_SCRATCH_PAD);
memset(conp->icom_msize, 0, sizeof(int) * MPID_NEM_IB_COM_NBUF_SCRATCH_PAD);
- mr_flags = IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_READ | IBV_ACCESS_REMOTE_WRITE;
/* RDMA-write-from local memory area */
conp->icom_msize[MPID_NEM_IB_COM_SCRATCH_PAD_FROM] = MPID_NEM_IB_COM_SCRATCH_PAD_FROM_SZ;
@@ -824,7 +821,6 @@ int MPID_nem_ib_com_open(int ib_port, int open_flag, int *condesc)
memset(conp->icom_mem, 0, sizeof(void **) * MPID_NEM_IB_COM_NBUF_UD);
conp->icom_msize = (int *) MPIU_Malloc(sizeof(int *) * MPID_NEM_IB_COM_NBUF_UD);
memset(conp->icom_msize, 0, sizeof(int *) * MPID_NEM_IB_COM_NBUF_UD);
- mr_flags = IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_READ | IBV_ACCESS_REMOTE_WRITE;
/* UD-write-from local memory area */
MPID_NEM_IB_COM_ERR_CHKANDJUMP(MPID_NEM_IB_COM_UDBUF_SZ <= 40, -1,
@@ -845,7 +841,7 @@ int MPID_nem_ib_com_open(int ib_port, int open_flag, int *condesc)
conp->icom_msize[MPID_NEM_IB_COM_UDWR_FROM], 0,
MPID_NEM_IB_COM_REG_MR_STICKY);
MPID_NEM_IB_COM_ERR_CHKANDJUMP(!conp->icom_mrlist[MPID_NEM_IB_COM_UDWR_FROM], -1,
- dprintf("ibv_reg_mr failed with mr_flags=0x%x\n", mr_flags));
+ printf("ibv_reg_mr failed\n"));
/* UD-write-to local memory area */
/* addr to addr+39 are not filled, addr+40 to addr+length-1 are filled with payload */
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h
index ac6fe0d..0d6af7e 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h
@@ -772,7 +772,7 @@ static inline void *MPID_nem_ib_rdmawr_from_alloc(uint32_t _sz)
static inline void MPID_nem_ib_rdmawr_from_free(const void *p, uint32_t _sz)
{
int clz;
- uint32_t sz;
+ uint32_t sz _UNUSED_;
assert(_sz <= (1ULL << 31));
MPID_NEM_IB_RDMAWR_FROM_ALLOC_PREPROCESS_SZ;
void *q = MPID_NEM_IB_RDMAWR_FROM_ALLOC_ARENA_START(p);
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
index 2acb65e..72cffc9 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
@@ -23,6 +23,12 @@
*/
#define MPID_NEM_IB_ONDEMAND
+#ifdef __GNUC__
+#define _UNUSED_ __attribute__ ((__unused__))
+#else
+#define _UNUSED_
+#endif
+
typedef struct {
union ibv_gid gid;
uint16_t lid;
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
index 1f51d95..0f6f1a6 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
@@ -271,7 +271,7 @@ int MPID_nem_ib_lmt_start_recv(struct MPIDI_VC *vc, struct MPID_Request *req, MP
{
int mpi_errno = MPI_SUCCESS;
int dt_contig;
- MPIDI_msg_sz_t data_sz;
+ MPIDI_msg_sz_t data_sz _UNUSED_;
MPID_Datatype *dt_ptr;
MPI_Aint dt_true_lb;
MPID_nem_ib_vc_area *vc_ib = VC_IB(vc);
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
index 705593f..608e4be 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
@@ -605,7 +605,7 @@ int MPID_nem_ib_poll_eager(MPID_nem_ib_ringbuf_t * ringbuf)
int mpi_errno = MPI_SUCCESS;
int ibcom_errno;
- struct MPIDI_VC *vc;
+ struct MPIDI_VC *vc = NULL;
MPID_nem_ib_vc_area *vc_ib;
//int result;
//struct ibv_wc cqe[MPID_NEM_IB_COM_MAX_CQ_HEIGHT_DRAIN];
@@ -616,7 +616,7 @@ int MPID_nem_ib_poll_eager(MPID_nem_ib_ringbuf_t * ringbuf)
//MPID_nem_ib_tsc_poll = MPID_nem_ib_rdtsc();
- uint16_t *remote_poll;
+ uint16_t *remote_poll = NULL;
switch (ringbuf->type) {
case MPID_NEM_IB_RINGBUF_EXCLUSIVE:
remote_poll = &VC_FIELD(ringbuf->vc, ibcom->rsr_seq_num_poll);
@@ -1152,8 +1152,8 @@ int MPID_nem_ib_recv_posted(struct MPIDI_VC *vc, struct MPID_Request *req)
#endif
MPIDI_msg_sz_t data_sz;
- int dt_contig;
- MPI_Aint dt_true_lb;
+ int dt_contig _UNUSED_;
+ MPI_Aint dt_true_lb _UNUSED_;
MPID_Datatype *dt_ptr;
MPIDI_Datatype_get_info(req->dev.user_count, req->dev.datatype,
dt_contig, data_sz, dt_ptr, dt_true_lb);
@@ -1839,9 +1839,9 @@ int MPID_nem_ib_pkt_rma_lmt_getdone(MPIDI_VC_t * vc,
if (*req->cc_ptr == 1 &&
(reqFn == MPIDI_CH3_ReqHandler_ReqOpsComplete
|| reqFn == MPIDI_CH3_ReqHandler_GetSendComplete)) {
- MPIDI_VC_t *vc = req->ch.vc;
+ MPIDI_VC_t *_vc = req->ch.vc;
int complete = 0;
- mpi_errno = reqFn(vc, req, &complete);
+ mpi_errno = reqFn(_vc, req, &complete);
}
else {
MPIDI_CH3U_Request_complete(req);
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
index 2624310..39d6325 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
@@ -716,7 +716,7 @@ int MPID_nem_ib_send_progress(MPIDI_VC_t * vc)
int mpi_errno = MPI_SUCCESS;
MPID_nem_ib_vc_area *vc_ib = VC_IB(vc);
MPID_Request *sreq, *prev_sreq;
- int req_type, msg_type;
+ int msg_type;
MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_IB_SEND_PROGRESS);
MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_IB_SEND_PROGRESS);
@@ -740,7 +740,6 @@ int MPID_nem_ib_send_progress(MPIDI_VC_t * vc)
if (sreq) {
prev_sreq = NULL;
do {
- req_type = MPIDI_Request_get_type(sreq);
msg_type = MPIDI_Request_get_msg_type(sreq);
MPIDI_CH3_Pkt_t *ch3_hdr = (MPIDI_CH3_Pkt_t *) sreq->dev.iov[0].MPID_IOV_BUF;
http://git.mpich.org/mpich.git/commitdiff/dc563e5a027ee7e6fb93fcff42880584963295fa
commit dc563e5a027ee7e6fb93fcff42880584963295fa
Author: Norio Yamaguchi <norio.yamaguchi at riken.jp>
Date: Wed Mar 25 15:44:51 2015 +0900
Fix invalid access before connection established
Signed-off-by: Huiwei Lu <huiweilu at mcs.anl.gov>
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
index 58aec8a..9064232 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
@@ -36,6 +36,7 @@ static int maxcon;
static struct ibv_device **ib_devlist;
static struct ibv_context *ib_ctx;
struct ibv_context *MPID_nem_ib_ctx_export; /* for SC13 demo connector */
+static struct ibv_port_attr ib_pattr;
static struct ibv_pd *ib_pd;
struct ibv_pd *MPID_nem_ib_pd_export; /* for SC13 demo connector */
struct ibv_cq *MPID_nem_ib_rc_shared_scq;
@@ -275,6 +276,7 @@ static int MPID_nem_ib_com_device_init()
int dev_num;
char *dev_name;
int i;
+ int ib_port = 1;
if (ib_initialized == 1) {
dprintf("MPID_nem_ib_com_device_init,already initialized\n");
@@ -314,6 +316,14 @@ static int MPID_nem_ib_com_device_init()
}
else {
ib_ctx = ibv_open_device(ib_devlist[i]);
+
+ if (ib_ctx) {
+ /* get port attribute */
+ if (ibv_query_port(ib_ctx, ib_port, &ib_pattr)) {
+ dprintf("ibv_query_port on port %d failed\n", ib_port);
+ goto err_exit;
+ }
+ }
}
dprintf("MPID_nem_ib_com_device_init,MPID_nem_ib_ctx_export=%p,ib_ctx=%p\n",
MPID_nem_ib_ctx_export, ib_ctx);
@@ -2282,6 +2292,30 @@ int MPID_nem_ib_com_get_info_conn(int condesc, int key, void *out, uint32_t out_
goto fn_exit;
}
+int MPID_nem_ib_com_get_info_pattr(int key, void *out, uint32_t out_len)
+{
+ int ibcom_errno = 0;
+
+ switch (key) {
+ case MPID_NEM_IB_COM_INFOKEY_PATTR_MAX_MSG_SZ:{
+#ifdef HAVE_LIBDCFA
+ uint32_t max_msg_sz = 1073741824; /* ConnectX-3 */
+ memcpy(out, &max_msg_sz, out_len);
+#else
+ memcpy(out, &ib_pattr.max_msg_sz, out_len);
+#endif
+ break;
+ }
+ default:
+ ibcom_errno = -1;
+ break;
+ }
+ fn_exit:
+ return ibcom_errno;
+ fn_fail:
+ goto fn_exit;
+}
+
int MPID_nem_ib_com_get_info_mr(int condesc, int memid, int key, void *out, int out_len)
{
int ibcom_errno = 0;
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h
index ae28f55..ac6fe0d 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h
@@ -559,6 +559,7 @@ extern int MPID_nem_ib_com_reg_mr(void *addr, long len, struct ibv_mr **mr,
extern int MPID_nem_ib_com_dereg_mr(struct ibv_mr *mr);
extern int MPID_nem_ib_com_get_info_conn(int condesc, int key, void *out, uint32_t out_len);
+extern int MPID_nem_ib_com_get_info_pattr(int key, void *out, uint32_t out_len);
extern int MPID_nem_ib_com_get_info_mr(int condesc, int memid, int key, void *out, int out_len);
extern int MPID_nem_ib_com_rdmabuf_occupancy_notify_rate_get(int condesc, int *notify_rate);
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
index 9f9a4e5..1f51d95 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
@@ -101,8 +101,16 @@ int MPID_nem_ib_lmt_initiate_lmt(struct MPIDI_VC *vc, union MPIDI_CH3_Pkt *rts_p
int post_num;
uint32_t max_msg_sz;
MPID_nem_ib_vc_area *vc_ib = VC_IB(vc);
- MPID_nem_ib_com_get_info_conn(vc_ib->sc->fd, MPID_NEM_IB_COM_INFOKEY_PATTR_MAX_MSG_SZ,
- &max_msg_sz, sizeof(uint32_t));
+
+ if (vc_ib->connection_state == MPID_NEM_IB_CM_ESTABLISHED) {
+ MPID_nem_ib_com_get_info_conn(vc_ib->sc->fd, MPID_NEM_IB_COM_INFOKEY_PATTR_MAX_MSG_SZ,
+ &max_msg_sz, sizeof(uint32_t));
+ }
+ else {
+ /* If connection is not established, get max_msg_sz from the global value. */
+ MPID_nem_ib_com_get_info_pattr(MPID_NEM_IB_COM_INFOKEY_PATTR_MAX_MSG_SZ, &max_msg_sz,
+ sizeof(uint32_t));
+ }
/* Type of max_msg_sz is uint32_t. */
post_num = (data_sz + (long) max_msg_sz - 1) / (long) max_msg_sz;
http://git.mpich.org/mpich.git/commitdiff/3093fe702697dc53d69dff5134492211d6cb2098
commit 3093fe702697dc53d69dff5134492211d6cb2098
Author: Norio Yamaguchi <norio.yamaguchi at riken.jp>
Date: Thu Mar 19 14:21:44 2015 +0900
Fix sending size of non-contiguous data in IB
Signed-off-by: Huiwei Lu <huiweilu at mcs.anl.gov>
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
index a185452..2624310 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
@@ -476,8 +476,8 @@ static int MPID_nem_ib_SendNoncontig_core(MPIDI_VC_t * vc, MPID_Request * sreq,
last = sreq->dev.segment_size; /* segment_size is byte offset */
if (last > 0) {
- REQ_FIELD(sreq, lmt_pack_buf) =
- MPIU_Malloc((size_t) (sreq->dev.segment_size - sreq->dev.segment_first));
+ data_sz = sreq->dev.segment_size - sreq->dev.segment_first;
+ REQ_FIELD(sreq, lmt_pack_buf) = MPIU_Malloc((size_t) data_sz);
MPIU_ERR_CHKANDJUMP(!REQ_FIELD(sreq, lmt_pack_buf), mpi_errno, MPI_ERR_OTHER,
"**outofmemory");
MPID_Segment_pack(sreq->dev.segment_ptr, sreq->dev.segment_first, &last,
@@ -486,14 +486,14 @@ static int MPID_nem_ib_SendNoncontig_core(MPIDI_VC_t * vc, MPID_Request * sreq,
}
else {
REQ_FIELD(sreq, lmt_pack_buf) = NULL;
+ data_sz = 0;
}
data = (void *) REQ_FIELD(sreq, lmt_pack_buf);
- data_sz = last;
/* If request length is too long, create LMT packet */
if (MPID_NEM_IB_NETMOD_HDR_SIZEOF(vc_ib->ibcom->local_ringbuf_type)
- + sizeof(MPIDI_CH3_Pkt_t) + sreq->dev.segment_size - sreq->dev.segment_first
+ + sizeof(MPIDI_CH3_Pkt_t) + data_sz
> MPID_NEM_IB_COM_RDMABUF_SZSEG - sizeof(MPID_nem_ib_netmod_trailer_t)) {
pkt_netmod.type = MPIDI_NEM_PKT_NETMOD;
@@ -510,10 +510,11 @@ static int MPID_nem_ib_SendNoncontig_core(MPIDI_VC_t * vc, MPID_Request * sreq,
sreq->ch.s_cookie = s_cookie_buf;
- s_cookie_buf->tail = *((uint8_t *) ((uint8_t *) write_from_buf + last - sizeof(uint8_t)));
+ s_cookie_buf->tail =
+ *((uint8_t *) ((uint8_t *) write_from_buf + data_sz - sizeof(uint8_t)));
/* put IB rkey */
struct MPID_nem_ib_com_reg_mr_cache_entry_t *mr_cache =
- MPID_nem_ib_com_reg_mr_fetch(write_from_buf, last, 0,
+ MPID_nem_ib_com_reg_mr_fetch(write_from_buf, data_sz, 0,
MPID_NEM_IB_COM_REG_MR_GLOBAL);
MPIU_ERR_CHKANDJUMP(!mr_cache, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_reg_mr_fetch");
struct ibv_mr *mr = mr_cache->mr;
@@ -524,7 +525,7 @@ static int MPID_nem_ib_SendNoncontig_core(MPIDI_VC_t * vc, MPID_Request * sreq,
s_cookie_buf->addr = write_from_buf;
#endif
s_cookie_buf->rkey = mr->rkey;
- s_cookie_buf->len = last;
+ s_cookie_buf->len = data_sz;
s_cookie_buf->sender_req_id = sreq->handle;
s_cookie_buf->max_msg_sz = max_msg_sz;
http://git.mpich.org/mpich.git/commitdiff/4ab1144b469ffe8e3d0c393b9daa9e704aa31d80
commit 4ab1144b469ffe8e3d0c393b9daa9e704aa31d80
Author: Norio Yamaguchi <norio.yamaguchi at riken.jp>
Date: Thu Mar 19 13:06:19 2015 +0900
Fix strict-aliasing rules break in netmod-IB
Signed-off-by: Huiwei Lu <huiweilu at mcs.anl.gov>
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
index 2069aeb..2acb65e 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
@@ -55,8 +55,12 @@ typedef struct {
/* macro for secret area in vc */
#define VC_CH(vc) ((MPIDI_CH3I_VC *)&(vc)->ch)
-#define VC_IB(vc) ((MPID_nem_ib_vc_area *)VC_CH((vc))->netmod_area.padding)
-#define VC_FIELD(vcp, field) (((MPID_nem_ib_vc_area *)VC_CH(((vcp)))->netmod_area.padding)->field)
+static inline MPID_nem_ib_vc_area *VC_IB(MPIDI_VC_t * vc)
+{
+ return (MPID_nem_ib_vc_area *) vc->ch.netmod_area.padding;
+}
+
+#define VC_FIELD(vcp, field) VC_IB(vcp)->field
/* The req provides a generic buffer in which network modules can store
private fields This removes all dependencies from the req structure
@@ -88,8 +92,12 @@ typedef struct {
} MPID_nem_ib_req_area;
/* macro for secret area in req */
-#define REQ_IB(req) ((MPID_nem_ib_req_area *)(&(req)->ch.netmod_area.padding))
-#define REQ_FIELD(reqp, field) (((MPID_nem_ib_req_area *)((reqp)->ch.netmod_area.padding))->field)
+static inline MPID_nem_ib_req_area *REQ_IB(MPID_Request * req)
+{
+ return (MPID_nem_ib_req_area *) req->ch.netmod_area.padding;
+}
+
+#define REQ_FIELD(reqp, field) (REQ_IB(reqp)->field)
/* see src/mpid/ch3/channels/nemesis/include/mpidi_ch3_impl.h */
/* sreq is never enqueued into posted-queue nor unexpected-queue, so we can reuse sreq->dev.next */
http://git.mpich.org/mpich.git/commitdiff/a6b35edc1a218d747f71e0b73aff0ffb17ad18ad
commit a6b35edc1a218d747f71e0b73aff0ffb17ad18ad
Author: Norio Yamaguchi <norio.yamaguchi at riken.jp>
Date: Wed Mar 18 17:56:30 2015 +0900
Fix memory leak in netmod-IB
Signed-off-by: Huiwei Lu <huiweilu at mcs.anl.gov>
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
index 92590e1..705593f 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
@@ -153,9 +153,7 @@ int MPID_nem_ib_drain_scq(int dont_call_progress)
if (req_type == MPIDI_REQUEST_TYPE_SEND && req->comm) {
/* exclude control messages by requiring MPIDI_REQUEST_TYPE_SEND
* exclude eager-short by requiring req->comm != 0 */
- int is_contig;
- MPID_Datatype_is_contig(req->dev.datatype, &is_contig);
- if (!is_contig && REQ_FIELD(req, lmt_pack_buf)) {
+ if (REQ_FIELD(req, lmt_pack_buf)) {
dprintf("drain_scq,eager-send,non-contiguous,free lmt_pack_buf=%p\n",
REQ_FIELD(req, lmt_pack_buf));
MPIU_Free(REQ_FIELD(req, lmt_pack_buf));
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
index dfcef02..a185452 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
@@ -111,6 +111,8 @@ static int MPID_nem_ib_iSendContig_core(MPIDI_VC_t * vc, MPID_Request * sreq, vo
MPIDI_CH3U_Request_increment_cc(sreq, &incomplete); // decrement in drain_scq and pkt_rma_lmt_getdone
}
+ REQ_FIELD(sreq, lmt_pack_buf) = NULL;
+
/* packet handlers including MPIDI_CH3_PktHandler_EagerSend and MPID_nem_handle_pkt assume this */
hdr_sz = sizeof(MPIDI_CH3_Pkt_t);
@@ -482,6 +484,9 @@ static int MPID_nem_ib_SendNoncontig_core(MPIDI_VC_t * vc, MPID_Request * sreq,
(char *) REQ_FIELD(sreq, lmt_pack_buf));
MPIU_Assert(last == sreq->dev.segment_size);
}
+ else {
+ REQ_FIELD(sreq, lmt_pack_buf) = NULL;
+ }
data = (void *) REQ_FIELD(sreq, lmt_pack_buf);
data_sz = last;
http://git.mpich.org/mpich.git/commitdiff/ec8ce7a9365930b1fc1a3bdb711dc20eac049b18
commit ec8ce7a9365930b1fc1a3bdb711dc20eac049b18
Author: Norio Yamaguchi <norio.yamaguchi at riken.jp>
Date: Wed Mar 18 15:38:31 2015 +0900
Fix allocation size and release size in netmod-IB
Signed-off-by: Huiwei Lu <huiweilu at mcs.anl.gov>
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
index 4ad5d07..2069aeb 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
@@ -985,10 +985,16 @@ static inline void *MPID_nem_ib_stmalloc(size_t _sz)
sz >>= 1;
} while (sz > 0);
if (i < 12) {
- return MPIU_Malloc(sz);
+ return MPIU_Malloc(_sz);
}
if (i > 30) {
- return mmap(0, sz, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ void *addr = mmap(0, _sz, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ if (addr == (void *) -1) {
+ return NULL;
+ }
+ else {
+ return addr;
+ }
}
int ndx = i - 12;
void *slot;
@@ -1008,12 +1014,13 @@ static inline void *MPID_nem_ib_stmalloc(size_t _sz)
return slot;
}
-static inline void MPID_nem_ib_stfree(void *ptr, size_t sz)
+static inline void MPID_nem_ib_stfree(void *ptr, size_t _sz)
{
if (MPID_nem_ib_myrank == 1) {
//printf("stfree,%p,%08x\n", ptr, (int)sz);
}
int i = 0;
+ size_t sz = _sz;
do {
i++;
sz >>= 1;
@@ -1023,7 +1030,7 @@ static inline void MPID_nem_ib_stfree(void *ptr, size_t sz)
goto fn_exit;
}
if (i > 30) {
- munmap(ptr, sz);
+ munmap(ptr, _sz);
goto fn_exit;
}
int ndx = i - 12;
http://git.mpich.org/mpich.git/commitdiff/ae5e72186ae56d097124b6abfdc4bc906c8052a4
commit ae5e72186ae56d097124b6abfdc4bc906c8052a4
Author: Norio Yamaguchi <norio.yamaguchi at riken.jp>
Date: Mon Mar 16 13:17:25 2015 +0900
Fix fail to build with new libc
Signed-off-by: Huiwei Lu <huiweilu at mcs.anl.gov>
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_malloc.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_malloc.c
index d2b679e..fe08357 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_malloc.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_malloc.c
@@ -29,7 +29,10 @@ void *ib_malloc_hook(size_t size, const void *caller);
void ib_free_hook(void *addr, const void *caller);
void *ib_realloc_hook(void *addr, size_t size, const void *caller);
-void (*__malloc_initialize_hook) (void) = _local_malloc_initialize_hook;
+#ifndef __MALLOC_HOOK_VOLATILE
+#define __MALLOC_HOOK_VOLATILE
+#endif
+void (*__MALLOC_HOOK_VOLATILE __malloc_initialize_hook) (void) = _local_malloc_initialize_hook;
static pthread_mutex_t mutex;
static int __initialized_malloc = 0;
http://git.mpich.org/mpich.git/commitdiff/211e8986c621369fa503ee99194069b5dbfd0f45
commit 211e8986c621369fa503ee99194069b5dbfd0f45
Author: Norio Yamaguchi <norio.yamaguchi at riken.jp>
Date: Thu Mar 12 14:37:09 2015 +0900
Code cleanup in netmod-IB
Signed-off-by: Huiwei Lu <huiweilu at mcs.anl.gov>
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
index d943bb7..58aec8a 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
@@ -1900,8 +1900,8 @@ int MPID_nem_ib_com_put_scratch_pad(int condesc, uint64_t wr_id, uint64_t offset
/* rkey is defined in MPID_nem_ib_com_reg_mr_connect */
dprintf("MPID_nem_ib_com_put_scratch_pad,wr.rdma.remote_addr=%llx\n",
- (unsigned long long) conp->icom_sr[MPID_NEM_IB_COM_SCRATCH_PAD_INITIATOR].wr.
- rdma.remote_addr);
+ (unsigned long long) conp->icom_sr[MPID_NEM_IB_COM_SCRATCH_PAD_INITIATOR].wr.rdma.
+ remote_addr);
#ifdef HAVE_LIBDCFA
ib_errno = ibv_post_send(conp->icom_qp, &conp->icom_sr[MPID_NEM_IB_COM_SCRATCH_PAD_INITIATOR]);
@@ -1965,8 +1965,8 @@ int MPID_nem_ib_com_get_scratch_pad(int condesc,
/* rkey is defined in MPID_nem_ib_com_reg_mr_connect */
dprintf("MPID_nem_ib_com_get_scratch_pad,wr.rdma.remote_addr=%llx\n",
- (unsigned long long) conp->icom_sr[MPID_NEM_IB_COM_SCRATCH_PAD_GET].wr.
- rdma.remote_addr);
+ (unsigned long long) conp->icom_sr[MPID_NEM_IB_COM_SCRATCH_PAD_GET].wr.rdma.
+ remote_addr);
#ifdef HAVE_LIBDCFA
ib_errno = ibv_post_send(conp->icom_qp, &conp->icom_sr[MPID_NEM_IB_COM_SCRATCH_PAD_GET]);
@@ -2032,8 +2032,8 @@ int MPID_nem_ib_com_cas_scratch_pad(int condesc,
conp->icom_sr[MPID_NEM_IB_COM_SCRATCH_PAD_CAS].wr.atomic.swap = swap;
dprintf("MPID_nem_ib_com_cas_scratch_pad,wr.rdma.remote_addr=%llx\n",
- (unsigned long long) conp->icom_sr[MPID_NEM_IB_COM_SCRATCH_PAD_CAS].wr.
- rdma.remote_addr);
+ (unsigned long long) conp->icom_sr[MPID_NEM_IB_COM_SCRATCH_PAD_CAS].wr.rdma.
+ remote_addr);
#ifdef HAVE_LIBDCFA
ib_errno = ibv_post_send(conp->icom_qp, &conp->icom_sr[MPID_NEM_IB_COM_SCRATCH_PAD_CAS]);
@@ -2456,7 +2456,7 @@ char *MPID_nem_ib_com_strerror(int err)
goto fn_exit;
}
else {
- r = (char *)strerror_tbl[-err];
+ r = (char *) strerror_tbl[-err];
}
fn_exit:
return r;
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
index 889d3ba..4ad5d07 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
@@ -484,7 +484,7 @@ static inline int MPID_nem_ib_cbf_hash1(uint64_t addr)
(((addr >> (MPID_nem_ib_cbf_lognslot * 0)) & (MPID_nem_ib_cbf_nslot - 1)) ^
((addr >> (MPID_nem_ib_cbf_lognslot * 3)) & (MPID_nem_ib_cbf_nslot - 1)) ^
(((addr >> (MPID_nem_ib_cbf_lognslot * 6)) & (MPID_nem_ib_cbf_nslot - 1))
- + 1)) & (MPID_nem_ib_cbf_nslot - 1);
+ + 1)) & (MPID_nem_ib_cbf_nslot - 1);
}
static inline int MPID_nem_ib_cbf_hash2(uint64_t addr)
@@ -494,7 +494,7 @@ static inline int MPID_nem_ib_cbf_hash2(uint64_t addr)
(((addr >> (MPID_nem_ib_cbf_lognslot * 1)) & (MPID_nem_ib_cbf_nslot - 1)) ^
((addr >> (MPID_nem_ib_cbf_lognslot * 4)) & (MPID_nem_ib_cbf_nslot - 1)) ^
(((addr >> (MPID_nem_ib_cbf_lognslot * 7)) & (MPID_nem_ib_cbf_nslot - 1))
- + 1)) & (MPID_nem_ib_cbf_nslot - 1);
+ + 1)) & (MPID_nem_ib_cbf_nslot - 1);
}
static inline int MPID_nem_ib_cbf_hash3(uint64_t addr)
@@ -504,7 +504,7 @@ static inline int MPID_nem_ib_cbf_hash3(uint64_t addr)
(((addr >> (MPID_nem_ib_cbf_lognslot * 2)) & (MPID_nem_ib_cbf_nslot - 1)) ^
((addr >> (MPID_nem_ib_cbf_lognslot * 5)) & (MPID_nem_ib_cbf_nslot - 1)) ^
(((addr >> (MPID_nem_ib_cbf_lognslot * 8)) & (MPID_nem_ib_cbf_nslot - 1))
- + 2)) & (MPID_nem_ib_cbf_nslot - 1);
+ + 2)) & (MPID_nem_ib_cbf_nslot - 1);
}
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_init.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_init.c
index 62d46eb..804a066 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_init.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_init.c
@@ -494,7 +494,8 @@ int MPID_nem_ib_init(MPIDI_PG_t * pg_p, int pg_rank, char **bc_val_p, int *val_m
for (i = 0; i < MPID_nem_ib_nranks; i++) {
if (i != MPID_nem_ib_myrank) {
for (j = 0; j < MPID_NEM_IB_COM_MAX_RQ_CAPACITY; j++) {
- MPID_nem_ib_com_scratch_pad_recv(MPID_nem_ib_scratch_pad_fds[i], sizeof(MPID_nem_ib_cm_notify_send_t));
+ MPID_nem_ib_com_scratch_pad_recv(MPID_nem_ib_scratch_pad_fds[i],
+ sizeof(MPID_nem_ib_cm_notify_send_t));
}
}
}
@@ -855,11 +856,9 @@ int MPID_nem_ib_vc_init(MPIDI_VC_t * vc)
MPIU_ERR_CHKANDJUMP(ibcom_errno, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_obtain_pointer");
int ntrial = 0;
- volatile MPID_nem_ib_com_qp_state_t *rstate =
- (MPID_nem_ib_com_qp_state_t *) ((uint8_t *)
- MPID_nem_ib_com_scratch_pad->icom_mem
- [MPID_NEM_IB_COM_SCRATCH_PAD_TO] +
- vc->pg_rank * sizeof(MPID_nem_ib_com_qp_state_t));
+ volatile MPID_nem_ib_com_qp_state_t *rstate = (MPID_nem_ib_com_qp_state_t *)
+ ((uint8_t *) MPID_nem_ib_com_scratch_pad->icom_mem[MPID_NEM_IB_COM_SCRATCH_PAD_TO]
+ + vc->pg_rank * sizeof(MPID_nem_ib_com_qp_state_t));
dprintf("ib_init,rstate=%p,*rstate=%08x\n", rstate, *((uint32_t *) rstate));
while (rstate->state != MPID_NEM_IB_COM_QP_STATE_RTR) {
__asm__ __volatile__("pause;":::"memory");
@@ -1005,8 +1004,8 @@ int MPID_nem_ib_vc_terminate(MPIDI_VC_t * vc)
dprintf
("vc_terminate,before,%d->%d,diff-rsr=%d,l diff-lsr=%d,sendq_empty=%d,ncqe=%d,pending_sends=%d\n",
MPID_nem_ib_myrank, vc->pg_rank, MPID_nem_ib_diff16(vc_ib->ibcom->rsr_seq_num_tail,
- vc_ib->ibcom->
- rsr_seq_num_tail_last_sent),
+ vc_ib->
+ ibcom->rsr_seq_num_tail_last_sent),
MPID_nem_ib_diff16(vc_ib->ibcom->sseq_num, vc_ib->ibcom->lsr_seq_num_tail),
MPID_nem_ib_sendq_empty(vc_ib->sendq), MPID_nem_ib_ncqe, VC_FIELD(vc, pending_sends));
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
index 716ac03..9f9a4e5 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
@@ -323,8 +323,8 @@ int MPID_nem_ib_lmt_start_recv(struct MPIDI_VC *vc, struct MPID_Request *req, MP
length = s_cookie_buf->max_msg_sz;
}
- REQ_FIELD(req, max_msg_sz) = s_cookie_buf->max_msg_sz; /* store initiator's max_msg_sz */
- REQ_FIELD(req, seg_num) = s_cookie_buf->seg_num; /* store number of segments */
+ REQ_FIELD(req, max_msg_sz) = s_cookie_buf->max_msg_sz; /* store initiator's max_msg_sz */
+ REQ_FIELD(req, seg_num) = s_cookie_buf->seg_num; /* store number of segments */
/* try to issue RDMA-read command */
int slack = 1; /* slack for control packet bringing sequence number */
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
index 0e64960..92590e1 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
@@ -1270,20 +1270,14 @@ int MPID_nem_ib_recv_buf_released(struct MPIDI_VC *vc, void *user_data)
MPID_nem_ib_ringbuf_headtail_t *headtail =
(MPID_nem_ib_ringbuf_headtail_t *) ((uint8_t *) MPID_nem_ib_scratch_pad +
MPID_NEM_IB_RINGBUF_OFF_HEAD);
- uint16_t index_tail =
- vc_ib->ibcom->remote_ringbuf->type ==
- MPID_NEM_IB_RINGBUF_EXCLUSIVE ? ((uint16_t) (vc_ib->ibcom->rsr_seq_num_tail + 1) %
- vc_ib->ibcom->
- remote_ringbuf->nslot) : ((uint16_t) (headtail->tail +
- 1) %
- vc_ib->ibcom->remote_ringbuf->
- nslot);
+ uint16_t index_tail = vc_ib->ibcom->remote_ringbuf->type == MPID_NEM_IB_RINGBUF_EXCLUSIVE ?
+ ((uint16_t) (vc_ib->ibcom->rsr_seq_num_tail + 1) % vc_ib->ibcom->remote_ringbuf-> nslot) :
+ ((uint16_t) (headtail->tail + 1) % vc_ib->ibcom->remote_ringbuf->nslot);
dprintf("released,index_tail=%d\n", index_tail);
dprintf("released,%016lx\n", vc_ib->ibcom->remote_ringbuf->remote_released[index_tail / 64]);
if (1 || (index_tail & 7) || MPID_nem_ib_diff16(index_slot, index_tail) >= vc_ib->ibcom->remote_ringbuf->nslot - 8) { /* avoid wrap-around */
while (1) {
- if (((vc_ib->ibcom->remote_ringbuf->
- remote_released[index_tail / 64] >> (index_tail & 63)) & 1) == 1) {
+ if (((vc_ib->ibcom-> remote_ringbuf->remote_released[index_tail / 64] >> (index_tail & 63)) & 1) == 1) {
if (vc_ib->ibcom->remote_ringbuf->type == MPID_NEM_IB_RINGBUF_EXCLUSIVE) {
vc_ib->ibcom->rsr_seq_num_tail += 1;
dprintf("exclusive ringbuf,remote_tail,incremented to %d\n",
@@ -1414,7 +1408,7 @@ int MPID_nem_ib_PktHandler_EagerSend(MPIDI_VC_t * vc,
* see MPID_nem_ib_iSendContig
*/
//ch3_pkt->type = MPIDI_CH3_PKT_EAGER_SEND;
- dprintf("ib_poll.c,before PktHandler_EagerSend,buflen=%ld\n", *buflen);
+ dprintf("ib_poll.c,before PktHandler_EagerSend,buflen=%ld\n", *buflen);
MPIDI_msg_sz_t ch3_buflen = *buflen - sizeof(MPID_nem_ib_pkt_prefix_t);
mpi_errno = MPIDI_CH3_PktHandler_EagerSend(vc, (MPIDI_CH3_Pkt_t *) ch3_pkt, &ch3_buflen, rreqp);
dprintf("ib_poll.c,after PktHandler_EagerSend,buflen=%ld\n", ch3_buflen);
@@ -1660,8 +1654,7 @@ int MPID_nem_ib_pkt_RTS_handler(MPIDI_VC_t * vc,
MPID_nem_ib_ncqe < MPID_NEM_IB_COM_MAX_CQ_CAPACITY - slack) {
mpi_errno =
MPID_nem_ib_lmt_start_recv_core(req, rts_pkt->addr, rts_pkt->rkey, length,
- write_to_buf, REQ_FIELD(req, max_msg_sz),
- last);
+ write_to_buf, REQ_FIELD(req, max_msg_sz), last);
if (mpi_errno) {
MPIU_ERR_POP(mpi_errno);
}
@@ -1955,8 +1948,8 @@ int MPID_nem_ib_cm_drain_scq()
MPID_nem_ib_cm_ringbuf_tail) < MPID_NEM_IB_CM_NSEG) {
MPID_nem_ib_cm_cmd_syn_t *cmd =
- (MPID_nem_ib_cm_cmd_syn_t *) shadow_cm->req->ibcom->
- icom_mem[MPID_NEM_IB_COM_SCRATCH_PAD_FROM];
+ (MPID_nem_ib_cm_cmd_syn_t *) shadow_cm->req->
+ ibcom->icom_mem[MPID_NEM_IB_COM_SCRATCH_PAD_FROM];
MPID_NEM_IB_CM_COMPOSE_SYN(cmd, shadow_cm->req);
cmd->responder_ringbuf_index =
shadow_cm->req->responder_ringbuf_index =
@@ -2481,8 +2474,8 @@ int MPID_nem_ib_cm_poll_syn()
MPID_nem_ib_cm_ringbuf_tail) < MPID_NEM_IB_CM_NSEG) {
MPID_nem_ib_cm_cmd_synack_t *cmd =
- (MPID_nem_ib_cm_cmd_synack_t *) req->ibcom->
- icom_mem[MPID_NEM_IB_COM_SCRATCH_PAD_FROM];
+ (MPID_nem_ib_cm_cmd_synack_t *) req->
+ ibcom->icom_mem[MPID_NEM_IB_COM_SCRATCH_PAD_FROM];
if (is_synack) {
dprintf("cm_poll_syn,sending synack,%d->%d[%d],connection_tx=%d\n",
MPID_nem_ib_myrank, syn->initiator_rank, req->ringbuf_index,
@@ -2722,8 +2715,8 @@ int MPID_nem_ib_cm_poll()
dprintf("cm_poll,sending ack1,req=%p,ringbuf_index=%d\n", req,
req->ringbuf_index);
MPID_nem_ib_cm_cmd_ack1_t *cmd =
- (MPID_nem_ib_cm_cmd_ack1_t *) req->ibcom->
- icom_mem[MPID_NEM_IB_COM_SCRATCH_PAD_FROM];
+ (MPID_nem_ib_cm_cmd_ack1_t *) req->
+ ibcom->icom_mem[MPID_NEM_IB_COM_SCRATCH_PAD_FROM];
MPID_NEM_IB_CM_COMPOSE_ACK1(cmd, req, synack->responder_req);
dprintf
("cm_poll,composing ack1,cmd->responder_req=%p,cmd->rmem=%p,rkey=%08x,ringbuf_nslot=%d,remote_vc=%p\n",
@@ -2863,8 +2856,8 @@ int MPID_nem_ib_cm_poll()
req, req->ringbuf_index, req->initiator_rank,
req->ibcom->outstanding_connection_tx);
MPID_nem_ib_cm_cmd_ack2_t *cmd =
- (MPID_nem_ib_cm_cmd_ack2_t *) req->ibcom->
- icom_mem[MPID_NEM_IB_COM_SCRATCH_PAD_FROM];
+ (MPID_nem_ib_cm_cmd_ack2_t *) req->
+ ibcom->icom_mem[MPID_NEM_IB_COM_SCRATCH_PAD_FROM];
MPID_NEM_IB_CM_COMPOSE_ACK2(cmd, ack1->initiator_req);
MPID_nem_ib_cm_cmd_shadow_t *shadow = (MPID_nem_ib_cm_cmd_shadow_t *)
MPIU_Malloc(sizeof(MPID_nem_ib_cm_cmd_shadow_t));
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_reg_mr.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_reg_mr.c
index bd8b5f5..d97ed5d 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_reg_mr.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_reg_mr.c
@@ -132,8 +132,7 @@ static inline void __lru_queue_display()
int i = 0;
for (i = 0; i < MPID_NEM_IB_COM_REG_MR_NLINE; i++) {
dprintf("---- hash %d\n", i);
- for (p =
- (struct MPID_nem_ib_com_reg_mr_cache_entry_t *)
+ for (p = (struct MPID_nem_ib_com_reg_mr_cache_entry_t *)
MPID_nem_ib_com_reg_mr_cache[i].lru_next;
p != (struct MPID_nem_ib_com_reg_mr_cache_entry_t *) &MPID_nem_ib_com_reg_mr_cache[i];
p = (struct MPID_nem_ib_com_reg_mr_cache_entry_t *) p->lru_next) {
@@ -357,8 +356,7 @@ int MPID_nem_ib_com_register_cache_release()
}
for (i = 0; i < MPID_NEM_IB_COM_REG_MR_NLINE; i++) {
- for (p =
- (struct MPID_nem_ib_com_reg_mr_cache_entry_t *)
+ for (p = (struct MPID_nem_ib_com_reg_mr_cache_entry_t *)
MPID_nem_ib_com_reg_mr_cache[i].lru_next;
p !=
(struct MPID_nem_ib_com_reg_mr_cache_entry_t *) &MPID_nem_ib_com_reg_mr_cache[i];) {
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
index 8981409..dfcef02 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
@@ -62,53 +62,54 @@ static int MPID_nem_ib_iSendContig_core(MPIDI_VC_t * vc, MPID_Request * sreq, vo
s_data = data;
s_data_sz = data_sz;
- /* If request length is too long, create LMT packet */
- if (MPID_NEM_IB_NETMOD_HDR_SIZEOF(vc_ib->ibcom->local_ringbuf_type)
- + sizeof(MPIDI_CH3_Pkt_t) + data_sz
- > MPID_NEM_IB_COM_RDMABUF_SZSEG - sizeof(MPID_nem_ib_netmod_trailer_t)) {
- pkt_netmod.type = MPIDI_NEM_PKT_NETMOD;
-
- pkt_netmod.subtype = MPIDI_NEM_IB_PKT_RMA_LMT_RTS;
-
- void *write_from_buf = data;
-
- uint32_t max_msg_sz;
- MPID_nem_ib_com_get_info_conn(vc_ib->sc->fd, MPID_NEM_IB_COM_INFOKEY_PATTR_MAX_MSG_SZ,
- &max_msg_sz, sizeof(uint32_t));
-
- MPID_nem_ib_rma_lmt_cookie_t *s_cookie_buf = (MPID_nem_ib_rma_lmt_cookie_t *) MPIU_Malloc(sizeof(MPID_nem_ib_rma_lmt_cookie_t));
-
- sreq->ch.s_cookie = s_cookie_buf;
-
- s_cookie_buf->tail = *((uint8_t *) ((uint8_t *) write_from_buf + data_sz - sizeof(uint8_t)));
- /* put IB rkey */
- struct MPID_nem_ib_com_reg_mr_cache_entry_t *mr_cache =
- MPID_nem_ib_com_reg_mr_fetch(write_from_buf, data_sz, 0,
- MPID_NEM_IB_COM_REG_MR_GLOBAL);
- MPIU_ERR_CHKANDJUMP(!mr_cache, mpi_errno, MPI_ERR_OTHER,
- "**MPID_nem_ib_com_reg_mr_fetch");
- struct ibv_mr *mr = mr_cache->mr;
- REQ_FIELD(sreq, lmt_mr_cache) = (void *) mr_cache;
+ /* If request length is too long, create LMT packet */
+ if (MPID_NEM_IB_NETMOD_HDR_SIZEOF(vc_ib->ibcom->local_ringbuf_type)
+ + sizeof(MPIDI_CH3_Pkt_t) + data_sz
+ > MPID_NEM_IB_COM_RDMABUF_SZSEG - sizeof(MPID_nem_ib_netmod_trailer_t)) {
+ pkt_netmod.type = MPIDI_NEM_PKT_NETMOD;
+
+ pkt_netmod.subtype = MPIDI_NEM_IB_PKT_RMA_LMT_RTS;
+
+ void *write_from_buf = data;
+
+ uint32_t max_msg_sz;
+ MPID_nem_ib_com_get_info_conn(vc_ib->sc->fd, MPID_NEM_IB_COM_INFOKEY_PATTR_MAX_MSG_SZ,
+ &max_msg_sz, sizeof(uint32_t));
+
+ MPID_nem_ib_rma_lmt_cookie_t *s_cookie_buf =
+ (MPID_nem_ib_rma_lmt_cookie_t *) MPIU_Malloc(sizeof(MPID_nem_ib_rma_lmt_cookie_t));
+
+ sreq->ch.s_cookie = s_cookie_buf;
+
+ s_cookie_buf->tail =
+ *((uint8_t *) ((uint8_t *) write_from_buf + data_sz - sizeof(uint8_t)));
+ /* put IB rkey */
+ struct MPID_nem_ib_com_reg_mr_cache_entry_t *mr_cache =
+ MPID_nem_ib_com_reg_mr_fetch(write_from_buf, data_sz, 0,
+ MPID_NEM_IB_COM_REG_MR_GLOBAL);
+ MPIU_ERR_CHKANDJUMP(!mr_cache, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_reg_mr_fetch");
+ struct ibv_mr *mr = mr_cache->mr;
+ REQ_FIELD(sreq, lmt_mr_cache) = (void *) mr_cache;
#ifdef HAVE_LIBDCFA
- s_cookie_buf->addr = (void *) mr->host_addr;
+ s_cookie_buf->addr = (void *) mr->host_addr;
#else
- s_cookie_buf->addr = write_from_buf;
+ s_cookie_buf->addr = write_from_buf;
#endif
- s_cookie_buf->rkey = mr->rkey;
- s_cookie_buf->len = data_sz;
- s_cookie_buf->sender_req_id = sreq->handle;
- s_cookie_buf->max_msg_sz = max_msg_sz;
-
- /* set for ib_com_isend */
- prefix = (void *)&pkt_netmod;
- sz_prefix = sizeof(MPIDI_CH3_Pkt_t);
- s_data = (void *)s_cookie_buf;
- s_data_sz = sizeof(MPID_nem_ib_rma_lmt_cookie_t);
-
- /* Release Request, when sender receives DONE packet. */
- int incomplete;
- MPIDI_CH3U_Request_increment_cc(sreq, &incomplete); // decrement in drain_scq and pkt_rma_lmt_getdone
- }
+ s_cookie_buf->rkey = mr->rkey;
+ s_cookie_buf->len = data_sz;
+ s_cookie_buf->sender_req_id = sreq->handle;
+ s_cookie_buf->max_msg_sz = max_msg_sz;
+
+ /* set for ib_com_isend */
+ prefix = (void *) &pkt_netmod;
+ sz_prefix = sizeof(MPIDI_CH3_Pkt_t);
+ s_data = (void *) s_cookie_buf;
+ s_data_sz = sizeof(MPID_nem_ib_rma_lmt_cookie_t);
+
+ /* Release Request, when sender receives DONE packet. */
+ int incomplete;
+ MPIDI_CH3U_Request_increment_cc(sreq, &incomplete); // decrement in drain_scq and pkt_rma_lmt_getdone
+ }
/* packet handlers including MPIDI_CH3_PktHandler_EagerSend and MPID_nem_handle_pkt assume this */
hdr_sz = sizeof(MPIDI_CH3_Pkt_t);
@@ -473,7 +474,8 @@ static int MPID_nem_ib_SendNoncontig_core(MPIDI_VC_t * vc, MPID_Request * sreq,
last = sreq->dev.segment_size; /* segment_size is byte offset */
if (last > 0) {
- REQ_FIELD(sreq, lmt_pack_buf) = MPIU_Malloc((size_t) (sreq->dev.segment_size - sreq->dev.segment_first));
+ REQ_FIELD(sreq, lmt_pack_buf) =
+ MPIU_Malloc((size_t) (sreq->dev.segment_size - sreq->dev.segment_first));
MPIU_ERR_CHKANDJUMP(!REQ_FIELD(sreq, lmt_pack_buf), mpi_errno, MPI_ERR_OTHER,
"**outofmemory");
MPID_Segment_pack(sreq->dev.segment_ptr, sreq->dev.segment_first, &last,
@@ -481,56 +483,56 @@ static int MPID_nem_ib_SendNoncontig_core(MPIDI_VC_t * vc, MPID_Request * sreq,
MPIU_Assert(last == sreq->dev.segment_size);
}
- data = (void *)REQ_FIELD(sreq, lmt_pack_buf);
+ data = (void *) REQ_FIELD(sreq, lmt_pack_buf);
data_sz = last;
- /* If request length is too long, create LMT packet */
- if ( MPID_NEM_IB_NETMOD_HDR_SIZEOF(vc_ib->ibcom->local_ringbuf_type)
- + sizeof(MPIDI_CH3_Pkt_t) + sreq->dev.segment_size - sreq->dev.segment_first
- > MPID_NEM_IB_COM_RDMABUF_SZSEG - sizeof(MPID_nem_ib_netmod_trailer_t)) {
- pkt_netmod.type = MPIDI_NEM_PKT_NETMOD;
+ /* If request length is too long, create LMT packet */
+ if (MPID_NEM_IB_NETMOD_HDR_SIZEOF(vc_ib->ibcom->local_ringbuf_type)
+ + sizeof(MPIDI_CH3_Pkt_t) + sreq->dev.segment_size - sreq->dev.segment_first
+ > MPID_NEM_IB_COM_RDMABUF_SZSEG - sizeof(MPID_nem_ib_netmod_trailer_t)) {
+ pkt_netmod.type = MPIDI_NEM_PKT_NETMOD;
- pkt_netmod.subtype = MPIDI_NEM_IB_PKT_RMA_LMT_RTS;
+ pkt_netmod.subtype = MPIDI_NEM_IB_PKT_RMA_LMT_RTS;
- void *write_from_buf = REQ_FIELD(sreq, lmt_pack_buf);
+ void *write_from_buf = REQ_FIELD(sreq, lmt_pack_buf);
- uint32_t max_msg_sz;
- MPID_nem_ib_com_get_info_conn(vc_ib->sc->fd, MPID_NEM_IB_COM_INFOKEY_PATTR_MAX_MSG_SZ,
- &max_msg_sz, sizeof(uint32_t));
+ uint32_t max_msg_sz;
+ MPID_nem_ib_com_get_info_conn(vc_ib->sc->fd, MPID_NEM_IB_COM_INFOKEY_PATTR_MAX_MSG_SZ,
+ &max_msg_sz, sizeof(uint32_t));
- MPID_nem_ib_rma_lmt_cookie_t *s_cookie_buf = (MPID_nem_ib_rma_lmt_cookie_t *) MPIU_Malloc(sizeof(MPID_nem_ib_rma_lmt_cookie_t));
+ MPID_nem_ib_rma_lmt_cookie_t *s_cookie_buf =
+ (MPID_nem_ib_rma_lmt_cookie_t *) MPIU_Malloc(sizeof(MPID_nem_ib_rma_lmt_cookie_t));
- sreq->ch.s_cookie = s_cookie_buf;
+ sreq->ch.s_cookie = s_cookie_buf;
- s_cookie_buf->tail = *((uint8_t *) ((uint8_t *) write_from_buf + last - sizeof(uint8_t)));
- /* put IB rkey */
- struct MPID_nem_ib_com_reg_mr_cache_entry_t *mr_cache =
- MPID_nem_ib_com_reg_mr_fetch(write_from_buf, last, 0,
- MPID_NEM_IB_COM_REG_MR_GLOBAL);
- MPIU_ERR_CHKANDJUMP(!mr_cache, mpi_errno, MPI_ERR_OTHER,
- "**MPID_nem_ib_com_reg_mr_fetch");
- struct ibv_mr *mr = mr_cache->mr;
- REQ_FIELD(sreq, lmt_mr_cache) = (void *) mr_cache;
+ s_cookie_buf->tail = *((uint8_t *) ((uint8_t *) write_from_buf + last - sizeof(uint8_t)));
+ /* put IB rkey */
+ struct MPID_nem_ib_com_reg_mr_cache_entry_t *mr_cache =
+ MPID_nem_ib_com_reg_mr_fetch(write_from_buf, last, 0,
+ MPID_NEM_IB_COM_REG_MR_GLOBAL);
+ MPIU_ERR_CHKANDJUMP(!mr_cache, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_reg_mr_fetch");
+ struct ibv_mr *mr = mr_cache->mr;
+ REQ_FIELD(sreq, lmt_mr_cache) = (void *) mr_cache;
#ifdef HAVE_LIBDCFA
- s_cookie_buf->addr = (void *) mr->host_addr;
+ s_cookie_buf->addr = (void *) mr->host_addr;
#else
- s_cookie_buf->addr = write_from_buf;
+ s_cookie_buf->addr = write_from_buf;
#endif
- s_cookie_buf->rkey = mr->rkey;
- s_cookie_buf->len = last;
- s_cookie_buf->sender_req_id = sreq->handle;
- s_cookie_buf->max_msg_sz = max_msg_sz;
-
- /* set for ib_com_isend */
- prefix = (void *)&pkt_netmod;
- prefix_sz = sizeof(MPIDI_CH3_Pkt_t);
- data = (void *)s_cookie_buf;
- data_sz = sizeof(MPID_nem_ib_rma_lmt_cookie_t);
-
- /* Release Request, when sender receives DONE packet. */
- int incomplete;
- MPIDI_CH3U_Request_increment_cc(sreq, &incomplete); // decrement in drain_scq and pkt_rma_lmt_getdone
- }
+ s_cookie_buf->rkey = mr->rkey;
+ s_cookie_buf->len = last;
+ s_cookie_buf->sender_req_id = sreq->handle;
+ s_cookie_buf->max_msg_sz = max_msg_sz;
+
+ /* set for ib_com_isend */
+ prefix = (void *) &pkt_netmod;
+ prefix_sz = sizeof(MPIDI_CH3_Pkt_t);
+ data = (void *) s_cookie_buf;
+ data_sz = sizeof(MPID_nem_ib_rma_lmt_cookie_t);
+
+ /* Release Request, when sender receives DONE packet. */
+ int incomplete;
+ MPIDI_CH3U_Request_increment_cc(sreq, &incomplete); // decrement in drain_scq and pkt_rma_lmt_getdone
+ }
/* packet handlers assume this */
hdr_sz = sizeof(MPIDI_CH3_Pkt_t);
@@ -873,8 +875,8 @@ int MPID_nem_ib_send_progress(MPIDI_VC_t * vc)
}
case MPIDI_NEM_IB_PKT_REPLY_SEQ_NUM:{
MPID_nem_ib_pkt_reply_seq_num_t *_pkt =
- (MPID_nem_ib_pkt_reply_seq_num_t *) sreq->dev.iov[0].
- MPID_IOV_BUF;
+ (MPID_nem_ib_pkt_reply_seq_num_t *) sreq->dev.
+ iov[0].MPID_IOV_BUF;
dprintf
("send_progress,MPIDI_NEM_IB_PKT_REPLY_SEQ_NUM,rsr_seq_num_tail=%d\n",
vc_ib->ibcom->rsr_seq_num_tail);
@@ -1016,8 +1018,7 @@ int MPID_nem_ib_cm_progress()
("cm_progress,retry CAS,responder_rank=%d,req=%p,decided=%ld,vt=%ld,backoff=%ld\n",
sreq->responder_rank, sreq, sreq->retry_decided,
MPID_nem_ib_progress_engine_vt, sreq->retry_backoff);
- shadow =
- (MPID_nem_ib_cm_cmd_shadow_t *)
+ shadow = (MPID_nem_ib_cm_cmd_shadow_t *)
MPIU_Malloc(sizeof(MPID_nem_ib_cm_cmd_shadow_t));
shadow->type = sreq->state;
shadow->req = sreq;
@@ -1030,13 +1031,13 @@ int MPID_nem_ib_cm_progress()
("cm_progress,retry CAS_RELEASE,responder_rank=%d,req=%p,decided=%ld,vt=%ld,backoff=%ld\n",
sreq->responder_rank, sreq, sreq->retry_decided,
MPID_nem_ib_progress_engine_vt, sreq->retry_backoff);
- shadow =
- (MPID_nem_ib_cm_cmd_shadow_t *)
+ shadow = (MPID_nem_ib_cm_cmd_shadow_t *)
MPIU_Malloc(sizeof(MPID_nem_ib_cm_cmd_shadow_t));
shadow->type = sreq->state;
shadow->req = sreq;
mpi_errno = MPID_nem_ib_cm_cas_release_core(sreq->responder_rank, shadow);
- MPIU_ERR_CHKANDJUMP(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_cm_cas_release_core");
+ MPIU_ERR_CHKANDJUMP(mpi_errno, mpi_errno, MPI_ERR_OTHER,
+ "**MPID_nem_ib_cm_cas_release_core");
break;
case MPID_NEM_IB_CM_SYN:
if (is_conn_established(sreq->responder_rank)) {
@@ -1061,8 +1062,7 @@ int MPID_nem_ib_cm_progress()
((MPID_nem_ib_cm_cmd_syn_t *) & sreq->cmd)->initiator_rank = MPID_nem_ib_myrank;
MPID_nem_ib_cm_ringbuf_head++;
- shadow =
- (MPID_nem_ib_cm_cmd_shadow_t *)
+ shadow = (MPID_nem_ib_cm_cmd_shadow_t *)
MPIU_Malloc(sizeof(MPID_nem_ib_cm_cmd_shadow_t));
shadow->type = sreq->state;
shadow->req = sreq;
@@ -1080,8 +1080,7 @@ int MPID_nem_ib_cm_progress()
((MPID_nem_ib_cm_cmd_syn_t *) & sreq->cmd)->initiator_rank = MPID_nem_ib_myrank;
- shadow =
- (MPID_nem_ib_cm_cmd_shadow_t *)
+ shadow = (MPID_nem_ib_cm_cmd_shadow_t *)
MPIU_Malloc(sizeof(MPID_nem_ib_cm_cmd_shadow_t));
shadow->type = sreq->state;
shadow->req = sreq;
@@ -1103,8 +1102,7 @@ int MPID_nem_ib_cm_progress()
MPID_nem_ib_cm_ringbuf_head;
sreq->initiator_ringbuf_index = MPID_nem_ib_cm_ringbuf_head;
MPID_nem_ib_cm_ringbuf_head++;
- shadow =
- (MPID_nem_ib_cm_cmd_shadow_t *)
+ shadow = (MPID_nem_ib_cm_cmd_shadow_t *)
MPIU_Malloc(sizeof(MPID_nem_ib_cm_cmd_shadow_t));
shadow->type = sreq->state;
shadow->req = sreq;
@@ -1118,8 +1116,7 @@ int MPID_nem_ib_cm_progress()
"**MPID_nem_ib_cm_send_core");
break;
case MPID_NEM_IB_CM_ACK1:
- shadow =
- (MPID_nem_ib_cm_cmd_shadow_t *)
+ shadow = (MPID_nem_ib_cm_cmd_shadow_t *)
MPIU_Malloc(sizeof(MPID_nem_ib_cm_cmd_shadow_t));
shadow->type = sreq->state;
shadow->req = sreq;
@@ -1133,8 +1130,7 @@ int MPID_nem_ib_cm_progress()
"**MPID_nem_ib_cm_send_core");
break;
case MPID_NEM_IB_CM_ACK2:
- shadow =
- (MPID_nem_ib_cm_cmd_shadow_t *)
+ shadow = (MPID_nem_ib_cm_cmd_shadow_t *)
MPIU_Malloc(sizeof(MPID_nem_ib_cm_cmd_shadow_t));
shadow->type = sreq->state;
shadow->req = sreq;
@@ -1149,8 +1145,7 @@ int MPID_nem_ib_cm_progress()
break;
case MPID_NEM_IB_CM_ALREADY_ESTABLISHED:
case MPID_NEM_IB_CM_RESPONDER_IS_CONNECTING:
- shadow =
- (MPID_nem_ib_cm_cmd_shadow_t *)
+ shadow = (MPID_nem_ib_cm_cmd_shadow_t *)
MPIU_Malloc(sizeof(MPID_nem_ib_cm_cmd_shadow_t));
shadow->type = sreq->state;
shadow->req = sreq;
@@ -1236,13 +1231,8 @@ int MPID_nem_ib_cm_cas_core(int rank, MPID_nem_ib_cm_cmd_shadow_t * shadow)
(unsigned long) conp->icom_rmem[MPID_NEM_IB_COM_SCRATCH_PAD_TO] + 0);
/* Compare-and-swap rank to acquire communication manager port */
- ibcom_errno =
- MPID_nem_ib_com_cas_scratch_pad(MPID_nem_ib_scratch_pad_fds[rank],
- (uint64_t) shadow,
- 0,
- MPID_NEM_IB_CM_RELEASED,
- MPID_nem_ib_myrank/*rank*/, /*debug*/
- &shadow->buf_from, &shadow->buf_from_sz);
+ ibcom_errno = MPID_nem_ib_com_cas_scratch_pad(MPID_nem_ib_scratch_pad_fds[rank], (uint64_t) shadow, 0, MPID_NEM_IB_CM_RELEASED, MPID_nem_ib_myrank /*rank */ , /*debug */
+ &shadow->buf_from, &shadow->buf_from_sz);
MPIU_ERR_CHKANDJUMP(ibcom_errno, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_cas_scratch_pad");
MPID_nem_ib_ncqe_scratch_pad += 1;
@@ -1338,13 +1328,8 @@ int MPID_nem_ib_cm_cas_release_core(int rank, MPID_nem_ib_cm_cmd_shadow_t * shad
(unsigned long) conp->icom_rmem[MPID_NEM_IB_COM_SCRATCH_PAD_TO] + 0);
/* Compare-and-swap rank to acquire communication manager port */
- ibcom_errno =
- MPID_nem_ib_com_cas_scratch_pad(MPID_nem_ib_scratch_pad_fds[rank],
- (uint64_t) shadow,
- 0,
- MPID_nem_ib_myrank,
- MPID_NEM_IB_CM_RELEASED/*rank*/, /*debug*/
- &shadow->buf_from, &shadow->buf_from_sz);
+ ibcom_errno = MPID_nem_ib_com_cas_scratch_pad(MPID_nem_ib_scratch_pad_fds[rank], (uint64_t) shadow, 0, MPID_nem_ib_myrank, MPID_NEM_IB_CM_RELEASED /*rank */ , /*debug */
+ &shadow->buf_from, &shadow->buf_from_sz);
MPIU_ERR_CHKANDJUMP(ibcom_errno, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_cas_scratch_pad");
MPID_nem_ib_ncqe_scratch_pad += 1;
@@ -1531,11 +1516,13 @@ int MPID_nem_ib_cm_notify_progress(void)
}
ibcom_errno = MPID_nem_ib_cm_notify_send(sreq->pg_rank, sreq->my_rank);
- MPIU_ERR_CHKANDJUMP(ibcom_errno, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_cm_notify_send");
+ MPIU_ERR_CHKANDJUMP(ibcom_errno, mpi_errno, MPI_ERR_OTHER,
+ "**MPID_nem_ib_cm_notify_send");
/* unlink sreq */
if (prev_sreq != NULL) {
- MPID_nem_ib_cm_notify_sendq_next(prev_sreq) = MPID_nem_ib_cm_notify_sendq_next(sreq);
+ MPID_nem_ib_cm_notify_sendq_next(prev_sreq) =
+ MPID_nem_ib_cm_notify_sendq_next(sreq);
}
else {
MPID_nem_ib_cm_notify_sendq_head(MPID_nem_ib_cm_notify_sendq) =
@@ -1641,8 +1628,7 @@ int MPID_nem_ib_ringbuf_ask_fetch(MPIDI_VC_t * vc)
* from the same process */
VC_FIELD(vc, ibcom->ask_guard) = 1;
- MPID_nem_ib_ringbuf_cmd_shadow_t *shadow =
- (MPID_nem_ib_ringbuf_cmd_shadow_t *)
+ MPID_nem_ib_ringbuf_cmd_shadow_t *shadow = (MPID_nem_ib_ringbuf_cmd_shadow_t *)
MPIU_Malloc(sizeof(MPID_nem_ib_ringbuf_cmd_shadow_t));
shadow->type = req->state;
shadow->req = req;
@@ -1732,8 +1718,7 @@ int MPID_nem_ib_ringbuf_ask_cas(MPIDI_VC_t * vc, MPID_nem_ib_ringbuf_req_t * req
dprintf("ask_cas,core\n");
req->state = MPID_NEM_IB_RINGBUF_ASK_CAS;
- MPID_nem_ib_ringbuf_cmd_shadow_t *shadow =
- (MPID_nem_ib_ringbuf_cmd_shadow_t *)
+ MPID_nem_ib_ringbuf_cmd_shadow_t *shadow = (MPID_nem_ib_ringbuf_cmd_shadow_t *)
MPIU_Malloc(sizeof(MPID_nem_ib_ringbuf_cmd_shadow_t));
shadow->type = req->state;
shadow->req = req;
@@ -1799,8 +1784,7 @@ int MPID_nem_ib_ringbuf_progress()
switch (sreq->state) {
case MPID_NEM_IB_RINGBUF_ASK_CAS:
dprintf("ringbuf_progress,ask_cas,req=%p\n", sreq);
- shadow =
- (MPID_nem_ib_ringbuf_cmd_shadow_t *)
+ shadow = (MPID_nem_ib_ringbuf_cmd_shadow_t *)
MPIU_Malloc(sizeof(MPID_nem_ib_ringbuf_cmd_shadow_t));
shadow->type = sreq->state;
shadow->req = sreq;
@@ -1829,8 +1813,7 @@ int MPID_nem_ib_ringbuf_progress()
}
dprintf("ringbuf_progress,ask_fetch,req=%p\n", sreq);
VC_FIELD(sreq->vc, ibcom->ask_guard) = 1;
- shadow =
- (MPID_nem_ib_ringbuf_cmd_shadow_t *)
+ shadow = (MPID_nem_ib_ringbuf_cmd_shadow_t *)
MPIU_Malloc(sizeof(MPID_nem_ib_ringbuf_cmd_shadow_t));
shadow->type = sreq->state;
shadow->req = sreq;
http://git.mpich.org/mpich.git/commitdiff/0bdc7e7411b24707aa67708f1779a2cac104cbb4
commit 0bdc7e7411b24707aa67708f1779a2cac104cbb4
Author: Norio Yamaguchi <norio.yamaguchi at riken.jp>
Date: Thu Mar 12 14:27:48 2015 +0900
Delete unused code in netmod-IB
Signed-off-by: Huiwei Lu <huiweilu at mcs.anl.gov>
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_finalize.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_finalize.c
index c34a392..cb047f0 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_finalize.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_finalize.c
@@ -24,22 +24,10 @@
int MPID_nem_ib_finalize(void)
{
int mpi_errno = MPI_SUCCESS;
-#if 0
- int ibcom_errno;
- int i;
-#endif
MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_IB_FINALIZE);
MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_IB_FINALIZE);
-#if 0
- for (i = 0; i < MPID_nem_ib_nranks; i++) {
- ibcom_errno = MPID_nem_ib_com_close(MPID_nem_ib_conns[i].fd);
- MPIU_ERR_CHKANDJUMP(ibcom_errno, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_close");
-
- }
-#endif
-
MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_IB_FINALIZE);
fn_exit:
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
index 30bc222..d943bb7 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c
@@ -221,7 +221,6 @@ static int modify_qp_to_rtr(struct ibv_qp *qp, uint32_t remote_qpn, uint16_t dli
attr.ah_attr.port_num = ib_port;
/* In dcfa gid is not set and for testing here it is also not set */
-#if 1
#ifdef HAVE_LIBDCFA /* DCFA doesn't use gid */
#else
if (gid_idx >= 0) {
@@ -234,7 +233,6 @@ static int modify_qp_to_rtr(struct ibv_qp *qp, uint32_t remote_qpn, uint16_t dli
attr.ah_attr.grh.traffic_class = 0;
}
#endif
-#endif
flags = IBV_QP_STATE | IBV_QP_AV | IBV_QP_PATH_MTU | IBV_QP_DEST_QPN
| IBV_QP_RQ_PSN | IBV_QP_MAX_DEST_RD_ATOMIC | IBV_QP_MIN_RNR_TIMER;
@@ -392,15 +390,7 @@ static int MPID_nem_ib_com_clean(MPID_nem_ib_com_t * conp)
MPID_nem_ib_rc_shared_rcq = NULL;
}
-#if 0 /* It's not used */
- retval =
- munmap(conp->icom_mem[MPID_NEM_IB_COM_RDMAWR_FROM], MPID_NEM_IB_COM_RDMABUF_SZ);
- MPID_NEM_IB_COM_ERR_CHKANDJUMP(retval, -1, dprintf("munmap"));
-#endif
-#if 0 /* Don't free it because it's managed through VC_FILED(vc, ibcom->remote_ringbuf) */
- retval = munmap(conp->icom_mem[MPID_NEM_IB_COM_RDMAWR_TO], MPID_NEM_IB_COM_RDMABUF_SZ);
- MPID_NEM_IB_COM_ERR_CHKANDJUMP(retval, -1, dprintf("munmap"));
-#endif
+
MPIU_Free(conp->icom_mrlist);
MPIU_Free(conp->icom_mem);
MPIU_Free(conp->icom_msize);
@@ -729,17 +719,7 @@ int MPID_nem_ib_com_open(int ib_port, int open_flag, int *condesc)
/* RDMA-write-to local memory area */
conp->icom_msize[MPID_NEM_IB_COM_RDMAWR_TO] = MPID_NEM_IB_COM_RDMABUF_SZ;
-#if 0
- int shmid = shmget(2, MPID_NEM_IB_COM_RDMABUF_SZ, SHM_HUGETLB | IPC_CREAT | SHM_R | SHM_W);
- MPID_NEM_IB_COM_ERR_CHKANDJUMP(shmid < 0, -1, perror("shmget"));
- conp->icom_mem[MPID_NEM_IB_COM_RDMAWR_TO] = shmat(shmid, 0, 0);
- if (conp->icom_mem[MPID_NEM_IB_COM_RDMAWR_TO] == (char *) -1) {
- perror("Shared memory attach failure");
- shmctl(shmid, IPC_RMID, NULL);
- ibcom_errno = -1;
- goto fn_fail;
- }
-#else
+
/* ibv_reg_mr all memory area for all ring buffers
* including shared and exclusive ones */
if (!MPID_nem_ib_rdmawr_to_alloc_start) {
@@ -755,7 +735,6 @@ int MPID_nem_ib_com_open(int ib_port, int open_flag, int *condesc)
//-1, 0);
dprintf("MPID_nem_ib_com_open,mmap=%p,len=%d\n", conp->icom_mem[MPID_NEM_IB_COM_RDMAWR_TO],
MPID_NEM_IB_COM_RDMABUF_SZ);
-#endif
#ifdef HAVE_LIBDCFA
dprintf("MPID_nem_ib_com_open,fd=%d,rmem=%p\n", *condesc,
@@ -1131,14 +1110,6 @@ int MPID_nem_ib_com_open(int ib_port, int open_flag, int *condesc)
conp->icom_ah_attr[MPID_NEM_IB_COM_UD_INITIATOR].is_global = 0;
conp->icom_ah_attr[MPID_NEM_IB_COM_UD_INITIATOR].port_num = conp->icom_port;
-#if 0
- conp->icom_ah_attr[MPID_NEM_IB_COM_UD_INITIATOR].is_global = 1;
- conp->icom_ah_attr[MPID_NEM_IB_COM_UD_INITIATOR].grh.flow_label = 0;
- conp->icom_ah_attr[MPID_NEM_IB_COM_UD_INITIATOR].grh.sgid_index = 0; /* what is this? */
- conp->icom_ah_attr[MPID_NEM_IB_COM_UD_INITIATOR].grh.hop_limit = 1;
- conp->icom_ah_attr[MPID_NEM_IB_COM_UD_INITIATOR].grh.traffic_class = 0;
-#endif
-
/* SR (send request) template for MPID_NEM_IB_COM_UD_INITIATOR */
conp->icom_sr =
(struct ibv_send_wr *) MPIU_Calloc(MPID_NEM_IB_COM_UD_SR_NTEMPLATE,
@@ -1521,16 +1492,12 @@ int MPID_nem_ib_com_isend(int condesc,
off_pow2_aligned, sz_pad, num_sge);
conp->icom_sr[MPID_NEM_IB_COM_SMT_NOINLINE].num_sge = num_sge;
-#if 1
MPID_nem_ib_rc_send_request *wrap_wr_id = MPIU_Malloc(sizeof(MPID_nem_ib_rc_send_request));
wrap_wr_id->wr_id = wr_id;
wrap_wr_id->mf = MPID_NEM_IB_LAST_PKT;
wrap_wr_id->mr_cache = (void *) mr_cache;
conp->icom_sr[MPID_NEM_IB_COM_SMT_NOINLINE].wr_id = (uint64_t) wrap_wr_id;
-#else
- conp->icom_sr[MPID_NEM_IB_COM_SMT_NOINLINE].wr_id = wr_id;
-#endif
conp->icom_sr[MPID_NEM_IB_COM_SMT_NOINLINE].wr.rdma.remote_addr =
(uint64_t) conp->local_ringbuf_start +
MPID_NEM_IB_COM_RDMABUF_SZSEG * ((uint16_t) (conp->sseq_num % conp->local_ringbuf_nslot));
@@ -1549,13 +1516,6 @@ int MPID_nem_ib_com_isend(int condesc,
//dprintf("MPID_nem_ib_com_isend,condesc=%d,num_sge=%d,opcode=%08x,imm_data=%08x,wr_id=%016lx, raddr=%p, rkey=%08x\n", condesc, conp->icom_sr[MPID_NEM_IB_COM_SMT_NOINLINE].num_sge, conp->icom_sr[MPID_NEM_IB_COM_SMT_NOINLINE].opcode, conp->icom_sr[MPID_NEM_IB_COM_SMT_NOINLINE].imm_data, conp->icom_sr[MPID_NEM_IB_COM_SMT_NOINLINE].wr_id, conp->icom_sr[MPID_NEM_IB_COM_SMT_NOINLINE].wr.rdma.remote_addr, conp->icom_sr[MPID_NEM_IB_COM_SMT_NOINLINE].wr.rdma.rkey);
- /* other commands can executed RDMA-rd command */
- /* see the "Ordering and the Fence Indicator" section in "InfiniBand Architecture" by William T. Futral */
-#if 0
- if (conp->after_rdma_rd) {
- conp->icom_sr[MPID_NEM_IB_COM_SMT_NOINLINE].send_flags |= IBV_SEND_FENCE;
- }
-#endif
#ifdef MPID_NEM_IB_ENABLE_INLINE
if (sumsz <= conp->max_inline_data) {
conp->icom_sr[MPID_NEM_IB_COM_SMT_NOINLINE].send_flags |= IBV_SEND_INLINE;
@@ -1582,12 +1542,6 @@ int MPID_nem_ib_com_isend(int condesc,
conp->icom_sr[MPID_NEM_IB_COM_SMT_NOINLINE].send_flags &= ~IBV_SEND_INLINE;
}
#endif
-#if 0
- if (conp->after_rdma_rd) {
- conp->icom_sr[MPID_NEM_IB_COM_SMT_NOINLINE].send_flags &= ~IBV_SEND_FENCE;
- conp->after_rdma_rd = 0;
- }
-#endif
conp->sseq_num += 1;
conp->ncom += 1;
@@ -1597,237 +1551,6 @@ int MPID_nem_ib_com_isend(int condesc,
goto fn_exit;
}
-#if 0
-int MPID_nem_ib_com_isend_chain(int condesc, uint64_t wr_id, void *hdr, int sz_hdr, void *data,
- int sz_data)
-{
- MPID_nem_ib_com_t *conp;
- int ibcom_errno = 0;
- struct ibv_send_wr *bad_wr;
- int ib_errno;
- int sz_data_rem = sz_data;
- int i;
- struct ibv_mr *mr_data;
- uint32_t sumsz =
- sizeof(MPID_nem_ib_netmod_hdr_t) + sz_hdr + sz_data + sizeof(MPID_nem_ib_netmod_trailer_t);
- unsigned long tscs, tsce;
-
- dprintf("MPID_nem_ib_com_isend_chain,enter\n");
- MPID_NEM_IB_RANGE_CHECK_WITH_ERROR(condesc, conp);
- MPID_NEM_IB_COM_ERR_CHKANDJUMP(conp->icom_connected == 0, -1,
- printf("MPID_nem_ib_com_isend_chain,icom_connected==0\n"));
-
- void *buf_from =
- (uint8_t *) conp->icom_mem[MPID_NEM_IB_COM_RDMAWR_FROM] +
- MPID_NEM_IB_COM_RDMABUF_SZSEG *
- ((uint16_t) (conp->sseq_num % MPID_NEM_IB_COM_RDMABUF_NSEG));
-
- /* make a tail-magic position is in a fixed set */
- int off_pow2_aligned;
- MPID_NEM_IB_OFF_POW2_ALIGNED(sizeof(MPID_nem_ib_netmod_hdr_t) + sz_hdr + sz_data);
-
- /* let the last command icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAIN-1] which has IBV_WR_RDMA_WRITE_WITH_IMM */
- int s =
- MPID_NEM_IB_COM_SMT_INLINE_NCHAIN - (sizeof(MPID_nem_ib_netmod_hdr_t) + sz_hdr +
- off_pow2_aligned +
- sizeof(MPID_nem_ib_netmod_trailer_t) +
- MPID_NEM_IB_COM_INLINE_DATA -
- 1) / MPID_NEM_IB_COM_INLINE_DATA;
- MPID_NEM_IB_COM_ERR_CHKANDJUMP((sizeof(MPID_nem_ib_netmod_hdr_t) + sz_hdr +
- off_pow2_aligned) % 4 != 0, -1,
- printf
- ("MPID_nem_ib_com_isend_chain,tail-magic gets over packet-boundary\n"));
- MPID_NEM_IB_COM_ERR_CHKANDJUMP(s < 0 ||
- s >= MPID_NEM_IB_COM_SMT_INLINE_NCHAIN, -1,
- printf("MPID_nem_ib_com_isend_chain,s\n"));
- dprintf("MPID_nem_ib_com_isend_chain,sz_hdr=%d,sz_data=%d,s=%d\n", sz_hdr, sz_data, s);
-
- for (i = s; i < MPID_NEM_IB_COM_SMT_INLINE_NCHAIN; i++) {
-
- //tscs = MPID_nem_ib_rdtsc();
- int sz_used = 0; /* how much of the payload of a IB packet is used? */
- int num_sge = 0;
- if (i == s) {
- MPID_nem_ib_netmod_hdr_t *netmod_hdr = (MPID_nem_ib_netmod_hdr_t *) buf_from;
- MPID_NEM_IB_NETMOD_HDR_SZ_SET(netmod_hdr, sumsz);
- memcpy((uint8_t *) buf_from + sizeof(MPID_nem_ib_netmod_hdr_t), hdr, sz_hdr);
-#ifdef HAVE_LIBDCFA
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].sg_list[num_sge].mic_addr =
- (uint64_t) buf_from;
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].sg_list[num_sge].addr =
- conp->icom_mrlist[MPID_NEM_IB_COM_RDMAWR_FROM]->host_addr + ((uint64_t) buf_from -
- (uint64_t)
- conp->icom_mem
- [MPID_NEM_IB_COM_RDMAWR_FROM]);
-#else
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].sg_list[num_sge].addr =
- (uint64_t) buf_from;
-#endif
- buf_from = (uint8_t *) buf_from + sizeof(MPID_nem_ib_netmod_hdr_t) + sz_hdr;
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].sg_list[num_sge].length =
- sizeof(MPID_nem_ib_netmod_hdr_t) + sz_hdr;
- sz_used += sizeof(MPID_nem_ib_netmod_hdr_t) + sz_hdr;
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].sg_list[num_sge].lkey =
- conp->icom_mrlist[MPID_NEM_IB_COM_RDMAWR_FROM]->lkey;
- num_sge += 1;
- dprintf("MPID_nem_ib_com_isend_chain,i=%d,sz_used=%d\n", i, sz_used);
- }
- //tsce = MPID_nem_ib_rdtsc(); printf("0,%ld\n", tsce-tscs);
-
- //tscs = MPID_nem_ib_rdtsc();
- if (sz_data_rem > 0) {
-#ifdef HAVE_LIBDCFA
-#else
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].sg_list[num_sge].addr =
- (uint64_t) data + sz_data - sz_data_rem;
-#endif
- int sz_data_red =
- sz_used + sz_data_rem + sizeof(MPID_nem_ib_netmod_trailer_t) <=
- MPID_NEM_IB_COM_INLINE_DATA ? sz_data_rem : sz_data_rem <=
- MPID_NEM_IB_COM_INLINE_DATA - sz_used ? sz_data_rem : MPID_NEM_IB_COM_INLINE_DATA -
- sz_used;
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].sg_list[num_sge].length =
- sz_data_red;
- sz_used += sz_data_red;
- sz_data_rem -= sz_data_red;
- MPID_NEM_IB_COM_ERR_CHKANDJUMP(sz_data_rem < 0, -1,
- printf("MPID_nem_ib_com_isend_chain,sz_data_rem\n"));
-
- if (i == s) {
- MPID_NEM_IB_COM_ERR_CHKANDJUMP(!sz_data, -1,
- printf("MPID_nem_ib_com_isend_chain,sz_data==0\n"));
- mr_data = MPID_nem_ib_com_reg_mr_fetch(data, sz_data, 0);
- MPID_NEM_IB_COM_ERR_CHKANDJUMP(!mr_data, -1,
- printf
- ("MPID_nem_ib_com_isend,ibv_reg_mr_fetch failed\n"));
- }
-#ifdef HAVE_LIBDCFA
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].sg_list[num_sge].mic_addr =
- (uint64_t) data + sz_data - sz_data_rem;
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].sg_list[num_sge].addr =
- mr_data->host_addr + ((uint64_t) data + sz_data - sz_data_rem - (uint64_t) data);
-#endif
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].sg_list[num_sge].lkey =
- mr_data->lkey;
- num_sge += 1;
- dprintf("MPID_nem_ib_com_isend_chain,i=%d,sz_used=%d,sz_data_rem=%d\n", i, sz_used,
- sz_data_rem);
- }
- else { /* netmod_trailer only packet is being generated */
-
- }
- //tsce = MPID_nem_ib_rdtsc(); printf("1,%ld\n", tsce-tscs);
-
- //tscs = MPID_nem_ib_rdtsc();
- if (i == MPID_NEM_IB_COM_SMT_INLINE_NCHAIN - 1) { /* append netmod_trailer */
- int sz_pad = off_pow2_aligned - sz_data;
- MPID_nem_ib_netmod_trailer_t *netmod_trailer =
- (MPID_nem_ib_netmod_trailer_t *) ((uint8_t *) buf_from + sz_pad);
- netmod_trailer->tail_flag = MPID_NEM_IB_COM_MAGIC;
-#ifdef HAVE_LIBDCFA
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].sg_list[num_sge].mic_addr =
- (uint64_t) buf_from;
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].sg_list[num_sge].addr =
- conp->icom_mrlist[MPID_NEM_IB_COM_RDMAWR_FROM]->host_addr + ((uint64_t) buf_from -
- (uint64_t)
- conp->icom_mem
- [MPID_NEM_IB_COM_RDMAWR_FROM]);
-#else
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].sg_list[num_sge].addr =
- (uint64_t) buf_from;
-#endif
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].sg_list[num_sge].length =
- sz_pad + sizeof(MPID_nem_ib_netmod_trailer_t);
- sz_used += sz_pad + sizeof(MPID_nem_ib_netmod_trailer_t);
- MPID_NEM_IB_COM_ERR_CHKANDJUMP(sz_data_rem != 0, -1,
- printf("MPID_nem_ib_com_isend_chain, sz_data_rem\n"));
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].sg_list[num_sge].lkey =
- conp->icom_mrlist[MPID_NEM_IB_COM_RDMAWR_FROM]->lkey;
- num_sge += 1;
-
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].imm_data = conp->sseq_num;
- dprintf("MPID_nem_ib_com_isend_chain,i=%d,sz_pad=%d,sz_used=%d,num_sge=%d\n", i, sz_pad,
- sz_used, num_sge);
- }
- else if (MPID_NEM_IB_COM_INLINE_DATA - sz_used > 0) { /* data fell short of the packet, so pad */
- MPID_NEM_IB_COM_ERR_CHKANDJUMP(1, -1,
- printf
- ("MPID_nem_ib_com_isend_chain,tail-magic gets over packet-boundary\n"));
- int sz_pad = MPID_NEM_IB_COM_INLINE_DATA - sz_used;
-#ifdef HAVE_LIBDCFA
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].sg_list[num_sge].mic_addr =
- (uint64_t) buf_from;
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].sg_list[num_sge].addr =
- conp->icom_mrlist[MPID_NEM_IB_COM_RDMAWR_FROM]->host_addr + ((uint64_t) buf_from -
- (uint64_t)
- conp->icom_mem
- [MPID_NEM_IB_COM_RDMAWR_FROM]);
-#else
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].sg_list[num_sge].addr =
- (uint64_t) buf_from;
-#endif
- buf_from = (uint8_t *) buf_from + sz_pad;
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].sg_list[num_sge].length = sz_pad;
- sz_used += sz_pad;
- MPID_NEM_IB_COM_ERR_CHKANDJUMP(sz_used != MPID_NEM_IB_COM_INLINE_DATA, -1,
- printf("MPID_nem_ib_com_isend_chain, sz_used\n"));
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].sg_list[num_sge].lkey =
- conp->icom_mrlist[MPID_NEM_IB_COM_RDMAWR_FROM]->lkey;
- num_sge += 1;
- dprintf("MPID_nem_ib_com_isend_chain,i=%d,sz_pad=%d,sz_used=%d\n", i, sz_pad, sz_used);
- }
- else { /* packet is full with data */
- MPID_NEM_IB_COM_ERR_CHKANDJUMP(sz_used != MPID_NEM_IB_COM_INLINE_DATA, -1,
- printf("MPID_nem_ib_com_isend_chain, sz_used\n"));
- }
- //tsce = MPID_nem_ib_rdtsc(); printf("2,%ld\n", tsce-tscs);
-
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].num_sge = num_sge;
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].wr_id = wr_id;
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + i].wr.rdma.remote_addr =
- (uint64_t) conp->icom_rmem[MPID_NEM_IB_COM_RDMAWR_TO] +
- MPID_NEM_IB_COM_RDMABUF_SZSEG *
- ((uint16_t) (conp->sseq_num % MPID_NEM_IB_COM_RDMABUF_NSEG)) +
- MPID_NEM_IB_COM_INLINE_DATA * (i - s);
- }
-#if 0
- if (conp->after_rdma_rd) {
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + s].send_flags |= IBV_SEND_FENCE;
- }
-#endif
-#ifdef HAVE_LIBDCFA
- ib_errno =
- ibv_post_send(conp->icom_qp, &conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + s]);
-#else
- ib_errno =
- ibv_post_send(conp->icom_qp, &conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + s],
- &bad_wr);
-#endif
-#if 0
- if (i == 0 && conp->after_rdma_rd) {
- conp->icom_sr[MPID_NEM_IB_COM_SMT_INLINE_CHAINED0 + s].send_flags &= ~IBV_SEND_FENCE;
- conp->after_rdma_rd = 0;
- }
-#endif
-#ifdef HAVE_LIBDCFA
- MPID_NEM_IB_COM_ERR_CHKANDJUMP(ib_errno, -1,
- dprintf("MPID_nem_ib_com_isend, ibv_post_send, rc=%d\n",
- ib_errno));
-#else
- MPID_NEM_IB_COM_ERR_CHKANDJUMP(ib_errno, -1,
- dprintf
- ("MPID_nem_ib_com_isend, ibv_post_send, rc=%d, bad_wr=%p\n",
- ib_errno, bad_wr));
-#endif
- conp->ncom += (MPID_NEM_IB_COM_SMT_INLINE_NCHAIN - s);
- conp->sseq_num += 1;
- fn_exit:
- return ibcom_errno;
- fn_fail:
- goto fn_exit;
-}
-#endif
-
int MPID_nem_ib_com_irecv(int condesc, uint64_t wr_id)
{
@@ -1880,9 +1603,6 @@ int MPID_nem_ib_com_udsend(int condesc, union ibv_gid *remote_gid, uint16_t remo
#else
/* prepare ibv_ah_attr */
conp->icom_ah_attr[MPID_NEM_IB_COM_UD_INITIATOR].dlid = remote_lid;
-#if 0
- conp->icom_ah_attr[MPID_NEM_IB_COM_UD_INITIATOR].grh.dgid = *remote_gid;
-#endif
/* prepare ibv_ah */
struct ibv_ah *ah;
@@ -1902,12 +1622,6 @@ int MPID_nem_ib_com_udsend(int condesc, union ibv_gid *remote_gid, uint16_t remo
conp->icom_sr[MPID_NEM_IB_COM_UD_INITIATOR].wr_id = wr_id;
conp->icom_sr[MPID_NEM_IB_COM_UD_INITIATOR].imm_data = imm_data;
-#if 0
- if (length <= qpinfo->max_inline_data) {
- conp->icom_sr[MPID_NEM_IB_COM_UD_INITIATOR].send_flags |= IBV_SEND_INLINE;
- }
-#endif
-
#ifdef HAVE_LIBDCFA
ib_errno = ibv_post_send(conp->icom_qp, &conp->icom_sr[MPID_NEM_IB_COM_UD_INITIATOR]);
#else
@@ -2010,11 +1724,6 @@ int MPID_nem_ib_com_lrecv(int condesc, uint64_t wr_id, void *raddr, long sz_data
ib_errno, bad_wr));
#endif
- /* other commands can be executed before RDMA-rd command */
- /* see the "Ordering and the Fence Indicator" section in "InfiniBand Architecture" by William T. Futral */
-#if 0
- conp->after_rdma_rd = 1;
-#endif
conp->ncom += 1;
fn_exit:
@@ -2061,16 +1770,12 @@ int MPID_nem_ib_com_put_lmt(int condesc, uint64_t wr_id, void *raddr, int sz_dat
num_sge += 1;
conp->icom_sr[MPID_NEM_IB_COM_LMT_PUT].num_sge = num_sge;
-#if 1
MPID_nem_ib_rc_send_request *wrap_wr_id = MPIU_Malloc(sizeof(MPID_nem_ib_rc_send_request));
wrap_wr_id->wr_id = wr_id;
wrap_wr_id->mf = MPID_NEM_IB_LAST_PKT;
wrap_wr_id->mr_cache = (void *) mr_cache;
conp->icom_sr[MPID_NEM_IB_COM_LMT_PUT].wr_id = (uint64_t) wrap_wr_id;
-#else
- conp->icom_sr[MPID_NEM_IB_COM_LMT_PUT].wr_id = wr_id;
-#endif
conp->icom_sr[MPID_NEM_IB_COM_LMT_PUT].wr.rdma.remote_addr = (uint64_t) raddr;
conp->icom_sr[MPID_NEM_IB_COM_LMT_PUT].wr.rdma.rkey = rkey;
@@ -2639,24 +2344,6 @@ int MPID_nem_ib_com_mem_rdmawr_from(int condesc, void **out)
goto fn_exit;
}
-#if 0
-int MPID_nem_ib_com_mem_rdmawr_to(int condesc, int seq_num, void **out)
-{
- MPID_nem_ib_com_t *conp;
- int ibcom_errno = 0;
-
- MPID_NEM_IB_RANGE_CHECK_WITH_ERROR(condesc, conp);
- *out =
- (uint8_t *) conp->icom_mem[MPID_NEM_IB_COM_RDMAWR_TO] +
- MPID_NEM_IB_COM_RDMABUF_SZSEG * (seq_num % MPID_NEM_IB_COM_RDMABUF_NSEG);
-
- fn_exit:
- return ibcom_errno;
- fn_fail:
- goto fn_exit;
-}
-#endif
-
int MPID_nem_ib_com_mem_udwr_from(int condesc, void **out)
{
MPID_nem_ib_com_t *conp;
@@ -2753,29 +2440,6 @@ int MPID_nem_ib_com_obtain_pointer(int condesc, MPID_nem_ib_com_t ** MPID_nem_ib
goto fn_exit;
}
-#if 0
-static void MPID_nem_ib_comShow(int condesc)
-{
- MPID_nem_ib_com_t *conp;
- uint8_t *p;
- int i;
-
- MPID_NEM_IB_RANGE_CHECK(condesc, conp);
- fprintf(stdout, "qp_num = %d\n", conp->icom_qp->qp_num);
-#ifdef HAVE_LIBDCFA
- fprintf(stdout, "lid = %d\n", ib_ctx->lid);
-#else
- fprintf(stdout, "lid = %d\n", conp->icom_pattr.lid);
-#endif
- p = (uint8_t *) & conp->icom_gid;
- fprintf(stdout, "gid = %02x", p[0]);
- for (i = 1; i < 16; i++) {
- fprintf(stdout, ":%02x", p[i]);
- }
- fprintf(stdout, "\n");
-}
-#endif
-
static const char *strerror_tbl[] = {
[0] = "zero",
[1] = "one",
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
index bfa0a3f..889d3ba 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h
@@ -698,9 +698,6 @@ extern uint8_t MPID_nem_ib_lmt_tail_addr_cbf[MPID_nem_ib_cbf_nslot *
typedef struct {
void *addr;
uint32_t rkey;
-#if 0 /* moving to packet header */
- int seq_num_tail; /* notify RDMA-write-to buffer occupation */
-#endif
uint8_t tail; /* last word of payload */
uint32_t max_msg_sz; /* max message size */
int seg_seq_num;
@@ -718,9 +715,6 @@ typedef struct {
typedef enum MPID_nem_ib_pkt_subtype {
MPIDI_NEM_IB_PKT_EAGER_SEND,
-#if 0 /* modification of mpid_nem_lmt.c is required */
- MPIDI_NEM_IB_PKT_LMT_RTS,
-#endif
MPIDI_NEM_IB_PKT_RMA_LMT_RTS,
MPIDI_NEM_IB_PKT_PUT,
MPIDI_NEM_IB_PKT_ACCUMULATE,
@@ -791,28 +785,9 @@ typedef struct MPID_nem_ib_pkt_change_rdmabuf_occupancy_notify_state_t {
int MPID_nem_ib_PktHandler_EagerSend(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
MPIDI_msg_sz_t * buflen /* out */ ,
MPID_Request ** rreqp /* out */);
-#if 0 /* modification of mpid_nem_lmt.c is required */
-int MPID_nem_ib_pkt_RTS_handler(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
- MPIDI_msg_sz_t * buflen /* out */ ,
- MPID_Request ** rreqp /* out */);
-#endif
int MPID_nem_ib_PktHandler_rma_lmt_rts(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
MPIDI_msg_sz_t * buflen /* out */ ,
MPID_Request ** rreqp /* out */);
-#if 0
-int MPID_nem_ib_PktHandler_Put(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
- MPIDI_msg_sz_t * buflen /* out */ ,
- MPID_Request ** rreqp /* out */);
-int MPID_nem_ib_PktHandler_Accumulate(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
- MPIDI_msg_sz_t * buflen /* out */ ,
- MPID_Request ** rreqp /* out */);
-int MPID_nem_ib_PktHandler_Get(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
- MPIDI_msg_sz_t * buflen /* out */ ,
- MPID_Request ** rreqp /* out */);
-int MPID_nem_ib_PktHandler_GetResp(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
- MPIDI_msg_sz_t * buflen /* out */ ,
- MPID_Request ** rreqp /* out */);
-#endif
int MPID_nem_ib_PktHandler_lmt_done(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
MPIDI_msg_sz_t * buflen, MPID_Request ** rreqp);
int MPID_nem_ib_pkt_GET_DONE_handler(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_init.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_init.c
index b7adeab..62d46eb 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_init.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_init.c
@@ -499,12 +499,6 @@ int MPID_nem_ib_init(MPIDI_PG_t * pg_p, int pg_rank, char **bc_val_p, int *val_m
}
}
-#if 0
- MPIU_CHKPMEM_MALLOC(MPID_nem_ib_pollingset, MPIDI_VC_t **,
- MPID_NEM_IB_MAX_POLLINGSET * sizeof(MPIDI_VC_t *), mpi_errno,
- "connection table");
- memset(MPID_nem_ib_pollingset, 0, MPID_NEM_IB_MAX_POLLINGSET * sizeof(MPIDI_VC_t *));
-#endif
#ifndef MPID_NEM_IB_ONDEMAND
/* prepare eager-send QP */
for (i = 0; i < MPID_nem_ib_nranks; i++) {
@@ -596,12 +590,6 @@ int MPID_nem_ib_init(MPIDI_PG_t * pg_p, int pg_rank, char **bc_val_p, int *val_m
}
}
-
-#if 0 /* debug */
- for (i = 0; i < MPID_nem_ib_nranks; i++) {
- dprintf("init,fd[%d]=%d\n", i, MPID_nem_ib_conns[i].fd);
- }
-#endif
#else /* define(MPID_NEM_IB_ONDEMAND) */
/* We need to communicate with all other ranks in close sequence. */
MPID_nem_ib_conns_ref_count = MPID_nem_ib_nranks - MPID_nem_mem_region.num_local;
@@ -821,13 +809,6 @@ int MPID_nem_ib_vc_onconnect(MPIDI_VC_t * vc)
MPID_nem_ib_com_obtain_pointer(MPID_nem_ib_conns[vc->pg_rank].fd, &VC_FIELD(vc, ibcom));
MPIU_ERR_CHKANDJUMP(ibcom_errno, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_obtain_pointer");
-#if 0
- /* Insert into polling set */
- MPIU_ERR_CHKANDJUMP(MPID_nem_ib_npollingset + 1 > MPID_NEM_IB_MAX_POLLINGSET, mpi_errno,
- MPI_ERR_OTHER, "**MPID_nem_ib_npollingset");
- MPID_nem_ib_pollingset[MPID_nem_ib_npollingset++] = vc;
- //printf("vc_init,%d->%d,vc=%p,npollingset=%d\n", MPID_nem_ib_myrank, vc->pg_rank, vc, MPID_nem_ib_npollingset);
-#endif
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_IB_VC_ONCONNECT);
return mpi_errno;
@@ -903,29 +884,12 @@ int MPID_nem_ib_vc_init(MPIDI_VC_t * vc)
#endif
MPIDI_CHANGE_VC_STATE(vc, ACTIVE);
-#if 0 /* dead code */
- uint32_t max_msg_sz;
- MPID_nem_ib_com_get_info_conn(MPID_nem_ib_conns[vc->pg_rank].fd,
- MPID_NEM_IB_COM_INFOKEY_PATTR_MAX_MSG_SZ, &max_msg_sz,
- sizeof(max_msg_sz));
-#endif
VC_FIELD(vc, pending_sends) = 0;
//MPIU_Assert(sizeof(MPID_nem_ib_netmod_hdr_t) == 8); /* assumption in ib_ibcom.h */
MPIU_Assert(sizeof(MPID_nem_ib_netmod_trailer_t) == 1); /* assumption in ib_ibcom.h */
uint32_t sz;
-#if 0
- /* assumption in released(), must be power of two */
- sz = MPID_NEM_IB_COM_RDMABUF_NSEG;
- while ((sz & 1) == 0) {
- sz >>= 1;
- }
- sz >>= 1;
- if (sz) {
- MPIU_Assert(0);
- }
-#endif
/* assumption in ib_poll.c, must be power of two */
for (sz = MPID_NEM_IB_COM_RDMABUF_SZSEG; sz > 0; sz >>= 1) {
@@ -951,16 +915,7 @@ int MPID_nem_ib_vc_init(MPIDI_VC_t * vc)
vc_ch->pkt_handler = MPID_nem_ib_pkt_handler;
vc_ch->num_pkt_handlers = MPIDI_NEM_IB_PKT_NUM_PKT_HANDLERS;
MPID_nem_ib_pkt_handler[MPIDI_NEM_IB_PKT_EAGER_SEND] = MPID_nem_ib_PktHandler_EagerSend;
-#if 0 /* modification of mpid_nem_lmt.c is required */
- MPID_nem_ib_pkt_handler[MPIDI_NEM_IB_PKT_LMT_RTS] = MPID_nem_ib_pkt_RTS_handler;
-#endif
MPID_nem_ib_pkt_handler[MPIDI_NEM_IB_PKT_RMA_LMT_RTS] = MPID_nem_ib_PktHandler_rma_lmt_rts;
-#if 0
- MPID_nem_ib_pkt_handler[MPIDI_NEM_IB_PKT_PUT] = MPID_nem_ib_PktHandler_Put;
- MPID_nem_ib_pkt_handler[MPIDI_NEM_IB_PKT_GET] = MPID_nem_ib_PktHandler_Get;
- MPID_nem_ib_pkt_handler[MPIDI_NEM_IB_PKT_GET_RESP] = MPID_nem_ib_PktHandler_GetResp;
- MPID_nem_ib_pkt_handler[MPIDI_NEM_IB_PKT_ACCUMULATE] = MPID_nem_ib_PktHandler_Accumulate;
-#endif
MPID_nem_ib_pkt_handler[MPIDI_NEM_IB_PKT_LMT_GET_DONE] = MPID_nem_ib_pkt_GET_DONE_handler;
MPID_nem_ib_pkt_handler[MPIDI_NEM_IB_PKT_LMT_RTS] = MPID_nem_ib_pkt_RTS_handler;
MPID_nem_ib_pkt_handler[MPIDI_NEM_IB_PKT_REQ_SEQ_NUM] = MPID_nem_ib_PktHandler_req_seq_num;
@@ -1055,21 +1010,6 @@ int MPID_nem_ib_vc_terminate(MPIDI_VC_t * vc)
MPID_nem_ib_diff16(vc_ib->ibcom->sseq_num, vc_ib->ibcom->lsr_seq_num_tail),
MPID_nem_ib_sendq_empty(vc_ib->sendq), MPID_nem_ib_ncqe, VC_FIELD(vc, pending_sends));
- /* update remote RDMA-write-to buffer occupancy */
-#if 0 /* we can't send it when the other party has closed QP */
- while (MPID_nem_ib_diff16
- (vc_ib->ibcom->rsr_seq_num_tail, vc_ib->ibcom->rsr_seq_num_tail_last_sent) > 0) {
- MPID_nem_ib_send_reply_seq_num(vc);
- }
-#endif
-
- /* update local RDMA-write-to buffer occupancy */
-#if 0
- while (MPID_nem_ib_diff16(vc_ib->ibcom->sseq_num, vc_ib->ibcom->lsr_seq_num_tail) > 0) {
- MPID_nem_ib_poll_eager(vc);
- }
-#endif
-
#ifdef MPID_NEM_IB_ONDEMAND
MPID_nem_ib_cm_notify_send_req_t *req = MPIU_Malloc(sizeof(MPID_nem_ib_cm_notify_send_req_t));
req->ibcom = MPID_nem_ib_scratch_pad_ibcoms[vc->pg_rank];
@@ -1116,13 +1056,6 @@ int MPID_nem_ib_vc_terminate(MPIDI_VC_t * vc)
MPID_nem_ib_diff16(vc_ib->ibcom->sseq_num, vc_ib->ibcom->lsr_seq_num_tail),
MPID_nem_ib_sendq_empty(vc_ib->sendq), MPID_nem_ib_ncqe, VC_FIELD(vc, pending_sends));
-#if 0
- if (MPID_nem_ib_ncqe > 0 || VC_FIELD(vc, pending_sends) > 0) {
- usleep(1000);
- MPID_nem_ib_drain_scq(0);
- }
-#endif
-
dprintf("init,middle2,%d->%d,r rdmaocc=%d,l rdmaocc=%d,sendq=%d,ncqe=%d,pending_sends=%d\n",
MPID_nem_ib_myrank, vc->pg_rank,
MPID_nem_ib_diff16(vc_ib->ibcom->rsr_seq_num_tail,
@@ -1134,15 +1067,6 @@ int MPID_nem_ib_vc_terminate(MPIDI_VC_t * vc)
usleep(1000);
MPID_nem_ib_drain_scq(0);
}
-#if 0
- /* drain scq */
- while (MPID_nem_ib_ncqe > 0 || VC_FIELD(vc, pending_sends) > 0) {
- usleep(1000);
- MPID_nem_ib_drain_scq(0);
- //printf("%d\n", VC_FIELD(vc, pending_sends));
- //printf("%d\n", MPID_nem_ib_ncqe);
- }
-#endif
dprintf("init,after ,%d->%d,r rdmaocc=%d,l rdmaocc=%d,sendq=%d,ncqe=%d,pending_sends=%d\n",
MPID_nem_ib_myrank, vc->pg_rank,
@@ -1170,50 +1094,6 @@ int MPID_nem_ib_vc_terminate(MPIDI_VC_t * vc)
MPIU_ERR_POP(mpi_errno);
}
-#if 0 /* We move this code to the end of poll_eager. */
- /* Destroy VC QP */
-
- /* Destroy ring-buffer */
- ibcom_errno = MPID_nem_ib_ringbuf_free(vc);
- MPIU_ERR_CHKANDJUMP(ibcom_errno, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_ringbuf_free");
-
- /* Check connection status stored in VC when on-demand connection is used */
- dprintf("vc_terminate,%d->%d,close\n", MPID_nem_ib_myrank, vc->pg_rank);
- ibcom_errno = MPID_nem_ib_com_close(vc_ib->sc->fd);
- MPIU_ERR_CHKANDJUMP(ibcom_errno, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_close");
-
- /* Destroy array of scratch-pad QPs */
- MPIU_Assert(MPID_nem_ib_conns_ref_count > 0);
- if (--MPID_nem_ib_conns_ref_count == 0) {
- MPIU_Free(MPID_nem_ib_conns);
- }
-
- /* TODO don't create them for shared memory vc */
-
- /* Destroy scratch-pad */
- ibcom_errno = MPID_nem_ib_com_free(MPID_nem_ib_scratch_pad_fds[vc->pg_rank],
-#ifdef MPID_NEM_IB_ONDEMAND
- MPID_NEM_IB_CM_OFF_CMD +
- MPID_NEM_IB_CM_NSEG * sizeof(MPID_nem_ib_cm_cmd_t) +
- sizeof(MPID_nem_ib_ringbuf_headtail_t)
-#else
- MPID_nem_ib_nranks * sizeof(MPID_nem_ib_com_qp_state_t)
-#endif
-);
-
- MPIU_ERR_CHKANDJUMP(ibcom_errno, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_free");
-
- /* Destroy scratch-pad QP */
- ibcom_errno = MPID_nem_ib_com_close(MPID_nem_ib_scratch_pad_fds[vc->pg_rank]);
- MPIU_ERR_CHKANDJUMP(ibcom_errno, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_close");
-
- /* Destroy array of scratch-pad QPs */
- MPIU_Assert(MPID_nem_ib_scratch_pad_fds_ref_count > 0);
- if (--MPID_nem_ib_scratch_pad_fds_ref_count == 0) {
- MPIU_Free(MPID_nem_ib_scratch_pad_fds);
- MPIU_Free(MPID_nem_ib_scratch_pad_ibcoms);
- }
-#endif
dprintf("vc_terminate,exit\n");
fn_exit:
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
index 4941ccb..716ac03 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c
@@ -30,9 +30,6 @@ int MPID_nem_ib_lmt_initiate_lmt(struct MPIDI_VC *vc, union MPIDI_CH3_Pkt *rts_p
MPIDI_msg_sz_t data_sz;
MPID_Datatype *dt_ptr;
MPI_Aint dt_true_lb;
-#if 0
- MPID_nem_ib_vc_area *vc_ib = VC_IB(vc);
-#endif
MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_IB_LMT_INITIATE_LMT);
MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_IB_LMT_INITIATE_LMT);
@@ -101,15 +98,6 @@ int MPID_nem_ib_lmt_initiate_lmt(struct MPIDI_VC *vc, union MPIDI_CH3_Pkt *rts_p
/* prepare magic */
//*((uint32_t*)(write_from_buf + data_sz - sizeof(tailmagic_t))) = MPID_NEM_IB_COM_MAGIC;
-#if 0 /* moving to packet header */ /* embed RDMA-write-to buffer occupancy information */
- dprintf("lmt_initiate_lmt,rsr_seq_num_tail=%d\n", vc_ib->ibcom->rsr_seq_num_tail);
- /* embed RDMA-write-to buffer occupancy information */
- s_cookie_buf->seq_num_tail = vc_ib->ibcom->rsr_seq_num_tail;
-
- /* remember the last one sent */
- vc_ib->ibcom->rsr_seq_num_tail_last_sent = vc_ib->ibcom->rsr_seq_num_tail;
-#endif
-
int post_num;
uint32_t max_msg_sz;
MPID_nem_ib_vc_area *vc_ib = VC_IB(vc);
@@ -367,14 +355,6 @@ int MPID_nem_ib_lmt_start_recv(struct MPIDI_VC *vc, struct MPID_Request *req, MP
MPID_nem_ib_sendq_enqueue(&vc_ib->sendq, req);
}
-#if 0 /* moving to packet header */
- /* extract embeded RDMA-write-to buffer occupancy information */
- dprintf("lmt_start_recv,old lsr_seq_num=%d,s_cookie_buf->seq_num_tail=%d\n",
- vc_ib->ibcom->lsr_seq_num_tail, s_cookie_buf->seq_num_tail);
- vc_ib->ibcom->lsr_seq_num_tail = s_cookie_buf->seq_num_tail;
- //dprintf("lmt_start_recv,new lsr_seq_num=%d\n", vc_ib->ibcom->lsr_seq_num_tail);
-#endif
-
#ifndef MPID_NEM_IB_DISABLE_VAR_OCC_NOTIFY_RATE
/* change remote notification policy of RDMA-write-to buf */
//dprintf("lmt_start_recv,reply_seq_num,old rstate=%d\n", vc_ib->ibcom->rdmabuf_occupancy_notify_rstate);
@@ -404,83 +384,6 @@ int MPID_nem_ib_lmt_start_recv(struct MPIDI_VC *vc, struct MPID_Request *req, MP
goto fn_exit;
}
-#if 0 /* unused function */
-/* fall-back to lmt-get if end-flag of send-buf has the same value as the end-flag of recv-buf */
-#undef FUNCNAME
-#define FUNCNAME MPID_nem_ib_lmt_switch_send
-#undef FCNAME
-#define FCNAME MPIDI_QUOTE(FUNCNAME)
-int MPID_nem_ib_lmt_switch_send(struct MPIDI_VC *vc, struct MPID_Request *req)
-{
- int mpi_errno = MPI_SUCCESS;
- int dt_contig;
- MPIDI_msg_sz_t data_sz;
- MPID_Datatype *dt_ptr;
- MPI_Aint dt_true_lb;
- MPID_IOV r_cookie = req->ch.lmt_tmp_cookie;
- MPID_nem_ib_lmt_cookie_t *r_cookie_buf = r_cookie.iov_base;
-
- MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_IB_LMT_SWITCH_SEND);
- MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_IB_LMT_SWITCH_SEND);
-
- MPIDI_Datatype_get_info(req->dev.user_count, req->dev.datatype, dt_contig, data_sz, dt_ptr,
- dt_true_lb);
-
- void *write_from_buf;
- if (dt_contig) {
- write_from_buf = req->dev.user_buf;
- }
- else {
- /* see MPIDI_CH3_EagerNoncontigSend (in ch3u_eager.c) */
- req->dev.segment_ptr = MPID_Segment_alloc();
- MPIU_ERR_CHKANDJUMP((req->dev.segment_ptr == NULL), mpi_errno, MPI_ERR_OTHER,
- "**outofmemory");
-
- MPID_Segment_init(req->dev.user_buf, req->dev.user_count, req->dev.datatype,
- req->dev.segment_ptr, 0);
- req->dev.segment_first = 0;
- req->dev.segment_size = data_sz;
-
- MPIDI_msg_sz_t last;
- last = req->dev.segment_size; /* segment_size is byte offset */
- MPIU_Assert(last > 0);
-
- REQ_FIELD(req, lmt_pack_buf) = MPIU_Malloc(data_sz);
- MPIU_ERR_CHKANDJUMP(!REQ_FIELD(req, lmt_pack_buf), mpi_errno, MPI_ERR_OTHER,
- "**outofmemory");
-
- MPID_Segment_pack(req->dev.segment_ptr, req->dev.segment_first, &last,
- (char *) (REQ_FIELD(req, lmt_pack_buf)));
- MPIU_Assert(last == req->dev.segment_size);
-
- write_from_buf = REQ_FIELD(req, lmt_pack_buf);
- }
-
- //assert(dt_true_lb == 0);
- uint8_t *tailp =
- (uint8_t *) ((uint8_t *) write_from_buf /*+ dt_true_lb */ + data_sz - sizeof(uint8_t));
-#if 0
- *is_end_flag_same = (r_cookie_buf->tail == *tailp) ? 1 : 0;
-#else
- REQ_FIELD(req, lmt_receiver_tail) = r_cookie_buf->tail;
- REQ_FIELD(req, lmt_sender_tail) = *tailp;
- dprintf("lmt_switch_send,tail on sender=%02x,tail onreceiver=%02x,req=%p\n", *tailp,
- r_cookie_buf->tail, req);
-#ifdef MPID_NEM_IB_DEBUG_LMT
- uint8_t *tail_wordp = (uint8_t *) ((uint8_t *) write_from_buf + data_sz - sizeof(uint32_t) * 2);
-#endif
- dprintf("lmt_switch_send,tail on sender=%d\n", *tail_wordp);
- fflush(stdout);
-#endif
-
- fn_exit:
- MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_IB_LMT_SWITCH_SEND);
- return mpi_errno;
- fn_fail:
- goto fn_exit;
-}
-#endif
-
/* when cookie is received in the middle of the lmt */
#undef FUNCNAME
#define FUNCNAME MPID_nem_ib_lmt_handle_cookie
@@ -531,9 +434,7 @@ int MPID_nem_ib_lmt_done_send(struct MPIDI_VC *vc, struct MPID_Request *req)
MPID_Datatype_is_contig(req->dev.datatype, &is_contig);
if (!is_contig && REQ_FIELD(req, lmt_pack_buf)) {
dprintf("lmt_done_send,lmt-get,non-contiguous,free lmt_pack_buf\n");
-#if 1 /* debug, enable again later */
MPIU_Free(REQ_FIELD(req, lmt_pack_buf));
-#endif
}
/* mark completion on sreq */
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
index fa2f3c9..0e64960 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c
@@ -20,9 +20,6 @@
static int entered_drain_scq = 0;
-#if 0
-#define MPID_NEM_IB_SEND_PROGRESS_POLLINGSET MPID_nem_ib_send_progress(vc);
-#else
#define MPID_NEM_IB_SEND_PROGRESS_POLLINGSET { \
do { \
int n; \
@@ -35,29 +32,13 @@ static int entered_drain_scq = 0;
} \
} while (0); \
}
-#if 0
- int n; \
- for(n = 0; n < MPID_nem_ib_npollingset; n++) { \
- MPIDI_VC_t *vc_n = MPID_nem_ib_pollingset[n]; \
- /*MPID_nem_ib_debug_current_vc_ib = vc_ib;*/ \
- MPID_nem_ib_send_progress(vc_n); \
- } \
-#endif
-#endif
-#if 1
#define MPID_NEM_IB_CHECK_AND_SEND_PROGRESS \
do { \
if (!MPID_nem_ib_sendq_empty(vc_ib->sendq) && MPID_nem_ib_sendq_ready_to_send_head(vc_ib)) { \
MPID_nem_ib_send_progress(vc); \
} \
} while (0)
-#else
-#define MPID_NEM_IB_CHECK_AND_SEND_PROGRESS \
- do { \
- MPID_NEM_IB_SEND_PROGRESS_POLLINGSET; \
- } while (0)
-#endif
#undef FUNCNAME
#define FUNCNAME MPID_nem_ib_drain_scq
@@ -90,12 +71,8 @@ int MPID_nem_ib_drain_scq(int dont_call_progress)
}
#endif
-#if 0 /*def HAVE_LIBDCFA */
- result = ibv_poll_cq(MPID_nem_ib_rc_shared_scq, 1, &cqe[0]);
-#else
result =
ibv_poll_cq(MPID_nem_ib_rc_shared_scq, /*3 */ MPID_NEM_IB_COM_MAX_CQ_HEIGHT_DRAIN, &cqe[0]);
-#endif
MPIU_ERR_CHKANDJUMP(result < 0, mpi_errno, MPI_ERR_OTHER, "**netmod,ib,ibv_poll_cq");
@@ -457,191 +434,6 @@ int MPID_nem_ib_drain_scq(int dont_call_progress)
//MPID_NEM_IB_SEND_PROGRESS_POLLINGSET
//}
}
-#if 0
- else if (req_type == 13 && cqe[i].opcode == IBV_WC_RDMA_READ) {
- MPID_nem_ib_vc_area *vc_ib = VC_IB(req->ch.vc);
-
- /* end of packet */
- if (req_wrap->mf == MPID_NEM_IB_LMT_LAST_PKT) {
- MPIDI_msg_sz_t data_len = req->ch.lmt_data_sz;
- MPI_Aint type_size;
-
- MPID_Datatype_get_size_macro(req->dev.datatype, type_size);
- req->dev.recv_data_sz = type_size * req->dev.user_count;
-
- int complete = 0;
- int (*reqFn) (MPIDI_VC_t *, MPID_Request *, int *);
- mpi_errno =
- MPIDI_CH3U_Receive_data_found(req, REQ_FIELD(req, lmt_pack_buf), &data_len,
- &complete);
-
- /* Data receive must be completed */
- MPIU_Assert(complete == TRUE);
-
- MPIU_Free(REQ_FIELD(req, lmt_pack_buf));
-
- MPID_nem_ib_lmt_send_PKT_LMT_DONE(req->ch.vc, req);
- reqFn = req->dev.OnFinal;
- if (reqFn) {
- reqFn(req->ch.vc, req, &complete);
- } else {
- MPIDI_CH3U_Request_complete(req);
- }
- }
-
- /* decrement the number of entries in IB command queue */
- vc_ib->ibcom->ncom -= 1;
- MPID_nem_ib_ncqe -= 1;
-
- MPIU_Free(req_wrap);
- }
- else if (req_type == MPIDI_REQUEST_TYPE_PUT_RESP && cqe[i].opcode == IBV_WC_RDMA_READ) {
- MPID_nem_ib_vc_area *vc_ib = VC_IB(req->ch.vc);
-
- /* end of packet */
- if (req_wrap->mf == MPID_NEM_IB_LMT_LAST_PKT) {
- MPIDI_msg_sz_t data_len = req->ch.lmt_data_sz;
- int complete = 0;
- mpi_errno =
- MPIDI_CH3U_Receive_data_found(req, REQ_FIELD(req, lmt_pack_buf), &data_len,
- &complete);
-
- /* Data receive must be completed */
- MPIU_Assert(complete == TRUE);
-
- MPIU_Free(REQ_FIELD(req, lmt_pack_buf));
-
- complete = 0;
- mpi_errno = MPIDI_CH3_ReqHandler_PutRecvComplete(req->ch.vc, req, &complete); // call MPIDI_CH3U_Request_complete()
- if (mpi_errno)
- MPIU_ERR_POP(mpi_errno);
- MPIU_Assert(complete == TRUE);
-
- MPID_nem_ib_lmt_send_PKT_LMT_DONE(req->ch.vc, req);
- MPIDI_CH3U_Request_complete(req);
- }
-
- /* decrement the number of entries in IB command queue */
- vc_ib->ibcom->ncom -= 1;
- MPID_nem_ib_ncqe -= 1;
-
- MPIU_Free(req_wrap);
- }
- else if (req_type == MPIDI_REQUEST_TYPE_PUT_RESP_DERIVED_DT &&
- cqe[i].opcode == IBV_WC_RDMA_READ) {
- MPID_nem_ib_vc_area *vc_ib = VC_IB(req->ch.vc);
- /* end of packet */
- if (req_wrap->mf == MPID_NEM_IB_LMT_LAST_PKT) {
- MPIDI_msg_sz_t buflen = req->ch.lmt_data_sz;
- char *buf = (char *) REQ_FIELD(req, lmt_pack_buf);
- int complete = 0;
- int dataloop_size = *(int *) req->dev.dtype_info; /* copy from temp store area */
-
- /* copy all of dtype_info and dataloop */
- MPIU_Memcpy(req->dev.dtype_info, buf, sizeof(MPIDI_RMA_dtype_info));
- MPIU_Memcpy(req->dev.dataloop, buf + sizeof(MPIDI_RMA_dtype_info), dataloop_size);
-
-
- /* All dtype data has been received, call req handler */
- mpi_errno =
- MPIDI_CH3_ReqHandler_PutDerivedDTRecvComplete(req->ch.vc, req, &complete);
- MPIU_ERR_CHKANDJUMP1(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|postrecv",
- "**ch3|postrecv %s", "MPIDI_CH3_PKT_PUT");
- /* return 'complete == FALSE' */
-
- buflen -= (sizeof(MPIDI_RMA_dtype_info) + dataloop_size);
- buf += (sizeof(MPIDI_RMA_dtype_info) + dataloop_size);
-
- mpi_errno = MPID_nem_ib_handle_pkt_bh(req->ch.vc, req, buf, buflen);
- MPIU_ERR_CHKANDJUMP(mpi_errno, mpi_errno, MPI_ERR_OTHER,
- "**MPID_nem_ib_handle_pkt_bh");
-
- MPID_nem_ib_lmt_send_PKT_LMT_DONE(req->ch.vc, req);
-
- MPIU_Free(REQ_FIELD(req, lmt_pack_buf));
- MPIDI_CH3U_Request_complete(req);
- }
-
- /* decrement the number of entries in IB command queue */
- vc_ib->ibcom->ncom -= 1;
- MPID_nem_ib_ncqe -= 1;
-
- MPIU_Free(req_wrap);
- }
- else if (req_type == MPIDI_REQUEST_TYPE_ACCUM_RESP && cqe[i].opcode == IBV_WC_RDMA_READ) {
- MPID_nem_ib_vc_area *vc_ib = VC_IB(req->ch.vc);
-
- /* end of packet */
- if (req_wrap->mf == MPID_NEM_IB_LMT_LAST_PKT) {
- MPIDI_msg_sz_t data_len = req->ch.lmt_data_sz;
- int complete = 0;
- mpi_errno =
- MPIDI_CH3U_Receive_data_found(req, REQ_FIELD(req, lmt_pack_buf), &data_len,
- &complete);
-
- /* Data receive must be completed */
- MPIU_Assert(complete == TRUE);
-
- MPIU_Free(REQ_FIELD(req, lmt_pack_buf));
-
- complete = 0;
- mpi_errno = MPIDI_CH3_ReqHandler_AccumRecvComplete(req->ch.vc, req, &complete); // call MPIDI_CH3U_Request_complete()
- if (mpi_errno)
- MPIU_ERR_POP(mpi_errno);
- MPIU_Assert(complete == TRUE);
-
- MPID_nem_ib_lmt_send_PKT_LMT_DONE(req->ch.vc, req);
- MPIDI_CH3U_Request_complete(req);
- }
-
- /* decrement the number of entries in IB command queue */
- vc_ib->ibcom->ncom -= 1;
- MPID_nem_ib_ncqe -= 1;
-
- MPIU_Free(req_wrap);
- }
- else if (req_type == MPIDI_REQUEST_TYPE_ACCUM_RESP_DERIVED_DT &&
- cqe[i].opcode == IBV_WC_RDMA_READ) {
- MPID_nem_ib_vc_area *vc_ib = VC_IB(req->ch.vc);
- /* end of packet */
- if (req_wrap->mf == MPID_NEM_IB_LMT_LAST_PKT) {
- MPIDI_msg_sz_t buflen = req->ch.lmt_data_sz;
- char *buf = (char *) REQ_FIELD(req, lmt_pack_buf);
- int complete = 0;
- int dataloop_size = *(int *) req->dev.dtype_info; /* copy from temp store area */
-
- /* copy all of dtype_info and dataloop */
- MPIU_Memcpy(req->dev.dtype_info, buf, sizeof(MPIDI_RMA_dtype_info));
- MPIU_Memcpy(req->dev.dataloop, buf + sizeof(MPIDI_RMA_dtype_info), dataloop_size);
-
-
- /* All dtype data has been received, call req handler */
- mpi_errno =
- MPIDI_CH3_ReqHandler_AccumDerivedDTRecvComplete(req->ch.vc, req, &complete);
- MPIU_ERR_CHKANDJUMP1(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|postrecv",
- "**ch3|postrecv %s", "MPIDI_CH3_ACCUMULATE");
- /* return 'complete == FALSE' */
-
- buflen -= (sizeof(MPIDI_RMA_dtype_info) + dataloop_size);
- buf += (sizeof(MPIDI_RMA_dtype_info) + dataloop_size);
-
- mpi_errno = MPID_nem_ib_handle_pkt_bh(req->ch.vc, req, buf, buflen);
- MPIU_ERR_CHKANDJUMP(mpi_errno, mpi_errno, MPI_ERR_OTHER,
- "**MPID_nem_ib_handle_pkt_bh");
-
- MPID_nem_ib_lmt_send_PKT_LMT_DONE(req->ch.vc, req);
-
- MPIU_Free(REQ_FIELD(req, lmt_pack_buf));
- MPIDI_CH3U_Request_complete(req);
- }
-
- /* decrement the number of entries in IB command queue */
- vc_ib->ibcom->ncom -= 1;
- MPID_nem_ib_ncqe -= 1;
-
- MPIU_Free(req_wrap);
- }
-#endif
else if (req_type == MPIDI_REQUEST_TYPE_SEND && msg_type == MPIDI_REQUEST_RNDV_MSG &&
cqe[i].opcode == IBV_WC_RDMA_READ) {
MPID_nem_ib_vc_area *vc_ib = VC_IB(req->ch.vc);
@@ -666,11 +458,7 @@ int MPID_nem_ib_drain_scq(int dont_call_progress)
else {
printf("drain_scq,unknown kind=%d,req_type=%d,msg_type=%d\n", kind, req_type, msg_type);
assert(0);
-#if 1 // lazy consulting of completion queue
MPIU_ERR_CHKANDJUMP(1, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_drain_scq");
-#else
- //printf("kind=%d\n", kind);
-#endif
MPIU_Free(req_wrap);
}
}
@@ -774,13 +562,9 @@ int MPID_nem_ib_drain_scq_scratch_pad()
goto fn_exit;
}
-#if 0 /*def HAVE_LIBDCFA */
- result = ibv_poll_cq(MPID_nem_ib_rc_shared_scq_scratch_pad, 1, &cqe[0]);
-#else
result =
ibv_poll_cq(MPID_nem_ib_rc_shared_scq_scratch_pad, MPID_NEM_IB_COM_MAX_CQ_HEIGHT_DRAIN,
&cqe[0]);
-#endif
MPIU_ERR_CHKANDJUMP(result < 0, mpi_errno, MPI_ERR_OTHER, "**netmod,ib,ibv_poll_cq");
if (result > 0) {
@@ -856,10 +640,6 @@ int MPID_nem_ib_poll_eager(MPID_nem_ib_ringbuf_t * ringbuf)
dprintf("ib_poll_eager,remote_poll=%d,buf=%p,sz=%d\n", *remote_poll, buf,
MPID_NEM_IB_NETMOD_HDR_SZ_GET(buf));
-#if 0
- ibcom_errno = MPID_nem_ib_com_poll_cq(MPID_NEM_IB_COM_RC_SHARED_RCQ, &cqe, &result);
- MPIU_ERR_CHKANDJUMP(ibcom_errno, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_poll_cq");
-#endif
dprintf("ib_poll_eager,eager-send,found\n");
fflush(stdout);
@@ -879,15 +659,6 @@ int MPID_nem_ib_poll_eager(MPID_nem_ib_ringbuf_t * ringbuf)
int tlb_pref_ahd = (uint64_t) tailmagic + 4096 * MPID_NEM_IB_TLBPREF_POLL - (uint64_t) buf;
#endif
while (netmod_trailer->tail_flag != MPID_NEM_IB_COM_MAGIC) {
- //k++;
-#if 0 /* pre-fetch next RDMA-write-buf slot to cover TLB miss latency */
- __asm__ __volatile__
- ("movq %0, %%rsi;"
- "movq 0(%%rsi), %%rsi;"::"r"(ringbuf->start + MPID_NEM_IB_COM_RDMABUF_SZSEG *
- ((uint16_t)
- ((*remote_poll + 1) % MPID_NEM_IB_COM_RDMABUF_NSEG)))
- :"%rsi");
-#endif
#ifdef MPID_NEM_IB_TLBPREF_POLL
__asm__ __volatile__
("movq %0, %%rsi;" "movq 0(%%rsi), %%rax;"::"r"(buf + tlb_pref_ahd):"%rsi", "%rax");
@@ -906,7 +677,6 @@ int MPID_nem_ib_poll_eager(MPID_nem_ib_ringbuf_t * ringbuf)
* 600 cycle for 512B!!! --> 284 cycle with prefetch
*/
-#if 1
void *rsi;
for (rsi = (void *) buf; rsi < (void *) ((uint8_t *) buf + MPID_NEM_IB_NETMOD_HDR_SZ_GET(buf));
rsi = (uint8_t *) rsi + 64 * 4) {
@@ -925,7 +695,6 @@ int MPID_nem_ib_poll_eager(MPID_nem_ib_ringbuf_t * ringbuf)
:"%rsi");
#endif
}
-#endif
/* Increment here because handle_pkt of CLOSE calls poll_eager recursively */
(*remote_poll) += 1;
@@ -968,7 +737,6 @@ int MPID_nem_ib_poll_eager(MPID_nem_ib_ringbuf_t * ringbuf)
/* this includes local RDMA-wr-to buf occupation
* because MPID_nem_handle_pkt releases RDMA-wr-to buf by copying data out */
/* responder releases resource and then embed largest sequence number into MPI message bound to initiator */
-#if 1
if ((vc->state != MPIDI_VC_STATE_INACTIVE) ||
(vc->state == MPIDI_VC_STATE_INACTIVE && vc_ib->vc_terminate_buf == buf)) {
dprintf
@@ -1031,7 +799,6 @@ int MPID_nem_ib_poll_eager(MPID_nem_ib_ringbuf_t * ringbuf)
}
}
}
-#endif
if ((vc->state != MPIDI_VC_STATE_INACTIVE) ||
(vc->state == MPIDI_VC_STATE_INACTIVE && vc_ib->vc_terminate_buf == buf)) {
@@ -1049,7 +816,6 @@ int MPID_nem_ib_poll_eager(MPID_nem_ib_ringbuf_t * ringbuf)
(vc->state == MPIDI_VC_STATE_INACTIVE && vc_ib->vc_terminate_buf == buf))
MPID_NEM_IB_NETMOD_HDR_HEAD_FLAG_SET(buf, 0);
-#if 1 /* We move this code from the end of vc_terminate. */
if (vc->state == MPIDI_VC_STATE_INACTIVE && vc_ib->vc_terminate_buf == buf) {
/* clear stored data */
vc_ib->vc_terminate_buf = NULL;
@@ -1095,7 +861,6 @@ int MPID_nem_ib_poll_eager(MPID_nem_ib_ringbuf_t * ringbuf)
MPIU_Free(MPID_nem_ib_scratch_pad_ibcoms);
}
}
-#endif
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_IB_POLL_EAGER);
@@ -1118,9 +883,7 @@ int MPID_nem_ib_poll(int in_blocking_poll)
MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_IB_POLL);
MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_IB_POLL);
-#if 1
unsigned int progress_completion_count_old = MPIDI_CH3I_progress_completion_count.v;
-#endif
/* poll lmt */
/* when receiver side sends CTS to sender side
@@ -1200,16 +963,9 @@ int MPID_nem_ib_poll(int in_blocking_poll)
MPI_ERR_TYPE, "**MPID_nem_ib_poll", 0);
/* --END ERROR HANDLING-- */
}
-#if 1 /* debug, enable again later, polling waits forever when freeing it here. */
- //if (rreq->ref_count == 1) {
dprintf("ib_poll,lmt,ref_count=%d,lmt_pack_buf=%p\n", rreq->ref_count,
REQ_FIELD(rreq, lmt_pack_buf));
- //MPIU_Free(REQ_FIELD(rreq, lmt_pack_buf));
MPID_nem_ib_stfree(REQ_FIELD(rreq, lmt_pack_buf), (size_t) rreq->ch.lmt_data_sz);
- //} else {
- // dprintf("ib_poll,lmt,ref_count=%d,lmt_pack_buf=%p\n", rreq->ref_count, REQ_FIELD(rreq, lmt_pack_buf));
- //}
-#endif
}
/* send done to sender. vc is stashed in MPID_nem_ib_lmt_start_recv (in ib_lmt.c) */
@@ -1309,12 +1065,6 @@ int MPID_nem_ib_poll(int in_blocking_poll)
(VC_FIELD(MPID_nem_ib_ringbuf[i].vc, ibcom->ncom) >=
MPID_NEM_IB_COM_MAX_SQ_HEIGHT_DRAIN);
}
-
-
-#if 0
- /* aggressively perform drain_scq */
- ncom_almost_full |= !(MPID_nem_ib_sendq_empty(VC_FIELD(MPID_nem_ib_ringbuf[i].vc, sendq)));
-#endif
}
#if defined (MPID_NEM_IB_TIMER_WAIT_IB_POLL)
if (in_blocking_poll) {
@@ -1346,11 +1096,10 @@ int MPID_nem_ib_poll(int in_blocking_poll)
}
#endif
}
-#if 1
/* aggressively perform drain_scq */
ibcom_errno = MPID_nem_ib_drain_scq(0);
MPIU_ERR_CHKANDJUMP(ibcom_errno, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_drain_scq");
-#endif
+
#ifdef MPID_NEM_IB_ONDEMAND
/* process incoming connection request */
MPID_nem_ib_cm_poll_syn();
@@ -1369,13 +1118,11 @@ int MPID_nem_ib_poll(int in_blocking_poll)
#endif
MPID_nem_ib_ringbuf_progress();
MPID_nem_ib_progress_engine_vt += 1; /* Progress virtual time */
-#if 1
+
/* if polling on eager-send and lmt would repeat frequently, perform "pause" to yield instruction issue bandwitdh to other logical-core */
if (in_blocking_poll && progress_completion_count_old == MPIDI_CH3I_progress_completion_count.v) {
__asm__ __volatile__("pause;":::"memory");
}
-#endif
- //if (in_blocking_poll) { goto prev; }
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_IB_POLL);
@@ -1406,12 +1153,6 @@ int MPID_nem_ib_recv_posted(struct MPIDI_VC *vc, struct MPID_Request *req)
}
#endif
-#if 0
- int ibcom_errno;
- ibcom_errno = MPID_nem_ib_com_irecv(vc_ib->sc->fd, (uint64_t) vc->pg_rank);
- MPIU_ERR_CHKANDJUMP(ibcom_errno, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_com_irecv");
-#endif
-#if 1 /*takagi */
MPIDI_msg_sz_t data_sz;
int dt_contig;
MPI_Aint dt_true_lb;
@@ -1422,37 +1163,23 @@ int MPID_nem_ib_recv_posted(struct MPIDI_VC *vc, struct MPID_Request *req)
/* anticipating received message finds maching request in the posted-queue */
if (data_sz + sizeof(MPIDI_CH3_Pkt_eager_send_t) > vc->eager_max_msg_sz) {
//if (MPID_nem_ib_tsc_poll - MPID_nem_ib_rdtsc() > MPID_NEM_IB_POLL_PERIOD_RECV_POSTED) {
-//#if 1
if (VC_FIELD(vc, ibcom->remote_ringbuf)) {
mpi_errno = MPID_nem_ib_poll_eager(VC_FIELD(vc, ibcom->remote_ringbuf));
-//#else
-// mpi_errno = MPID_nem_ib_poll(0);
-//#endif
if (mpi_errno) {
MPIU_ERR_POP(mpi_errno);
}
}
- //}
}
else {
-#if 1
/* anticipating received message finds maching request in the posted-queue */
- //if (MPID_nem_ib_tsc_poll - MPID_nem_ib_rdtsc() > MPID_NEM_IB_POLL_PERIOD_RECV_POSTED) {
if (VC_FIELD(vc, ibcom->remote_ringbuf)) {
-#if 1
mpi_errno = MPID_nem_ib_poll_eager(VC_FIELD(vc, ibcom->remote_ringbuf));
-#else
- mpi_errno = MPID_nem_ib_poll(0);
-#endif
if (mpi_errno) {
MPIU_ERR_POP(mpi_errno);
}
}
- //}
-#endif
}
-#endif
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_IB_RECV_POSTED);
@@ -1480,7 +1207,7 @@ int MPID_nem_ib_recv_buf_released(struct MPIDI_VC *vc, void *user_data)
MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_IB_RECV_BUF_RELEASED);
MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_IB_RECV_BUF_RELEASED);
dprintf("recv_buf_released,%d<-%d,user_data=%p\n", MPID_nem_ib_myrank, vc->pg_rank, user_data);
-#if 1 /* moving from ib_poll */
+
/* Clear all possible tail flag slots */
/* tail flag is located at MPID_NEM_IB_COM_INLINE_DATA boundary and variable length entails multiple prospective locations for the future use */
/* see MPIDI_CH3_PktHandler_EagerShortSend (in src/mpid/ch3/src/ch3u_eager.c */
@@ -1506,7 +1233,6 @@ int MPID_nem_ib_recv_buf_released(struct MPIDI_VC *vc, void *user_data)
int off_pow2_aligned;
MPID_NEM_IB_OFF_POW2_ALIGNED(MPID_NEM_IB_NETMOD_HDR_SZ_GET(buf));
//dprintf("recv_buf_released,sz=%d,pow2=%d\n", MPID_NEM_IB_NETMOD_HDR_SZ_GET(buf), off_pow2_aligned);
-#if 1
uint32_t offset;
for (offset = 15;;
offset =
@@ -1524,10 +1250,7 @@ int MPID_nem_ib_recv_buf_released(struct MPIDI_VC *vc, void *user_data)
break;
}
}
-#endif
-#endif
-#if 1 /* moving from ib_poll */
/* mark that one eager-send RDMA-write-to buffer has been released */
uint16_t index_slot =
(unsigned long) ((uint8_t *) user_data -
@@ -1625,7 +1348,6 @@ int MPID_nem_ib_recv_buf_released(struct MPIDI_VC *vc, void *user_data)
MPID_nem_ib_send_reply_seq_num(vc);
skip:;
}
-#endif
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_IB_RECV_BUF_RELEASED);
@@ -1634,54 +1356,6 @@ int MPID_nem_ib_recv_buf_released(struct MPIDI_VC *vc, void *user_data)
goto fn_exit;
}
-#if 0
-/* packet handler for wrapper packet of MPIDI_NEM_PKT_LMT_DONE */
-/* see pkt_DONE_handler (in src/mpid/ch3/channels/nemesis/src/mpid_nem_lmt.c) */
-#undef FUNCNAME
-#define FUNCNAME MPID_nem_ib_PktHandler_lmt_done
-#undef FCNAME
-#define FCNAME MPIDI_QUOTE(FUNCNAME)
-int MPID_nem_ib_PktHandler_lmt_done(MPIDI_VC_t * vc,
- MPIDI_CH3_Pkt_t * pkt,
- MPIDI_msg_sz_t * buflen, MPID_Request ** rreqp)
-{
- int mpi_errno = MPI_SUCCESS;
- int ibcom_errno;
- MPID_nem_ib_pkt_lmt_done_t *const done_pkt = (MPID_nem_ib_pkt_lmt_done_t *) pkt;
- MPID_Request *req;
- MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_IB_PKTHANDLER_LMT_DONE);
- MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_IB_PKTHANDLER_LMT_DONE);
- /* Check the assumption on sizeof(MPIDI_CH3_Pkt_t).
- * It is utilized in pkt_DONE_handler (in src/mpid/ch3/channels/nemesis/src/mpid_nem_lmt.c)
- * that must be larger than sizeof(MPID_nem_ib_pkt_lmt_done_t) */
- if (sizeof(MPID_nem_ib_pkt_lmt_done_t) > sizeof(MPIDI_CH3_Pkt_t)) {
- MPIU_ERR_SETFATALANDJUMP(mpi_errno, MPI_ERR_INTERN, "**sizeof(MPIDI_CH3_Pkt_t)");
- }
-
- /* fall back to the original handler */
- /* we don't need to worry about the difference caused by embedding seq_num
- * because the handler does not use it (e.g. applying sizeof operator to it) */
- MPID_nem_pkt_lmt_done_t *pkt_parent_class = (MPID_nem_pkt_lmt_done_t *) pkt;
- pkt_parent_class->type = MPIDI_NEM_PKT_LMT_DONE;
-#if 0
- mpi_errno = MPID_nem_handle_pkt(vc, (char *) pkt_parent_class, *buflen);
-#else
- MPIU_ERR_CHKANDJUMP(1, mpi_errno, MPI_ERR_OTHER, "**notimplemented");
- /* you need to modify mpid_nem_lmt.c to make pkt_DONE_handler visible to me */
- //mpi_errno = pkt_DONE_handler(vc, pkt, buflen, rreqp);
-#endif
- if (mpi_errno) {
- MPIU_ERR_POP(mpi_errno);
- }
-
- fn_exit:
- MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_IB_PKTHANDLER_LMT_DONE);
- return mpi_errno;
- fn_fail:
- goto fn_exit;
-}
-#endif
-
/* packet handler for wrapper packet of MPIDI_CH3_PKT_EAGER_SEND */
/* see MPIDI_CH3_PktHandler_EagerSend (in src/mpid/ch3/src/ch3u_eager.c) */
#undef FUNCNAME
@@ -1740,16 +1414,12 @@ int MPID_nem_ib_PktHandler_EagerSend(MPIDI_VC_t * vc,
* see MPID_nem_ib_iSendContig
*/
//ch3_pkt->type = MPIDI_CH3_PKT_EAGER_SEND;
-#if 0
- mpi_errno = MPID_nem_handle_pkt(vc, (char *) pkt_parent_class, *buflen);
-#else
dprintf("ib_poll.c,before PktHandler_EagerSend,buflen=%ld\n", *buflen);
MPIDI_msg_sz_t ch3_buflen = *buflen - sizeof(MPID_nem_ib_pkt_prefix_t);
mpi_errno = MPIDI_CH3_PktHandler_EagerSend(vc, (MPIDI_CH3_Pkt_t *) ch3_pkt, &ch3_buflen, rreqp);
dprintf("ib_poll.c,after PktHandler_EagerSend,buflen=%ld\n", ch3_buflen);
*buflen = ch3_buflen + sizeof(MPID_nem_ib_pkt_prefix_t);
dprintf("ib_poll.c,after addition,buflen=%ld\n", *buflen);
-#endif
if (mpi_errno) {
MPIU_ERR_POP(mpi_errno);
}
@@ -1761,70 +1431,6 @@ int MPID_nem_ib_PktHandler_EagerSend(MPIDI_VC_t * vc,
goto fn_exit;
}
-#if 0 /* modification of mpid_nem_lmt.c is required */
-
-/* Temporary fix because it's static */
-int pkt_RTS_handler(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
- MPIDI_msg_sz_t * buflen, MPID_Request ** rreqp);
-/* packet handler for wrapper packet of MPIDI_NEM_PKT_LMT_RTS */
-/* see pkt_RTS_handler (in src/mpid/ch3/channels/nemesis/src/mpid_nem_lmt.c) */
-#undef FUNCNAME
-#define FUNCNAME MPID_nem_ib_pkt_RTS_handler
-#undef FCNAME
-#define FCNAME MPIDI_QUOTE(FUNCNAME)
-int MPID_nem_ib_pkt_RTS_handler(MPIDI_VC_t * vc,
- MPIDI_CH3_Pkt_t * pkt, MPIDI_msg_sz_t * buflen /* out */ ,
- MPID_Request ** rreqp /* out */)
-{
- MPID_nem_ib_pkt_prefix_t *netmod_pkt = (MPID_nem_ib_pkt_prefix_t *) pkt;
- MPIDI_CH3_Pkt_t *ch3_pkt =
- (MPIDI_CH3_Pkt_t *) ((uint8_t *) pkt + sizeof(MPID_nem_ib_pkt_prefix_t));
- int mpi_errno = MPI_SUCCESS;
- int ibcom_errno;
- MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_IB_PKT_RTS_HANDLER);
- MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_IB_PKT_RTS_HANDLER);
- /* Update occupation status of local SR (send request) queue */
- MPID_nem_ib_vc_area *vc_ib = VC_IB(vc);
- dprintf
- ("MPID_nem_ib_pkt_RTS_handler,lsr_seq_num_tail=%d,netmod_pkt->seq_num_tail=%d\n",
- vc_ib->ibcom->lsr_seq_num_tail, netmod_pkt->seq_num_tail);
- vc_ib->ibcom->lsr_seq_num_tail = netmod_pkt->seq_num_tail;
- dprintf
- ("MPID_nem_ib_pkt_RTS_handler,lsr_seq_num_tail updated to %d\n",
- vc_ib->ibcom->lsr_seq_num_tail);
-#ifndef MPID_NEM_IB_DISABLE_VAR_OCC_NOTIFY_RATE
- /* change remote notification policy of RDMA-write-to buf */
- dprintf("pkthandler,rts,old rstate=%d\n", vc_ib->ibcom->rdmabuf_occupancy_notify_rstate);
- MPID_nem_ib_change_rdmabuf_occupancy_notify_policy_lw(vc_ib, &vc_ib->ibcom->lsr_seq_num_tail);
- dprintf("pkthandler,rts,new rstate=%d\n", vc_ib->ibcom->rdmabuf_occupancy_notify_rstate);
-#endif
- dprintf("pkthandler,rts,sendq_empty=%d,ncom=%d,rdmabuf_occ=%d\n",
- MPID_nem_ib_sendq_empty(vc_ib->sendq), vc_ib->ibcom->ncom,
- MPID_nem_ib_diff16(vc_ib->ibcom->sseq_num, vc_ib->ibcom->lsr_seq_num_tail));
- /* try to send from sendq because at least one RDMA-write-to buffer has been released */
- dprintf("pkthandler,eagersend,send_progress\n");
- fflush(stdout);
- MPID_NEM_IB_CHECK_AND_SEND_PROGRESS;
- /* fall back to the original handler */
- /* we don't need to worry about the difference caused by embedding seq_num
- * because size of MPI-header of MPIDI_CH3_PKT_EAGER_SEND equals to sizeof(MPIDI_CH3_Pkt_t)
- * see MPID_nem_ib_iSendContig
- */
- MPIDI_msg_sz_t ch3_buflen = *buflen - sizeof(MPID_nem_ib_pkt_prefix_t);
- mpi_errno = pkt_RTS_handler(vc, ch3_pkt, &ch3_buflen, rreqp);
- *buflen = ch3_buflen + sizeof(MPID_nem_ib_pkt_prefix_t);
- if (mpi_errno) {
- MPIU_ERR_POP(mpi_errno);
- }
-
- fn_exit:
- MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_IB_PKT_RTS_HANDLER);
- return mpi_errno;
- fn_fail:
- goto fn_exit;
-}
-#endif
-
#undef FUNCNAME
#define FUNCNAME MPID_nem_ib_PktHandler_rma_lmt_rts
#undef FCNAME
@@ -1915,443 +1521,6 @@ int MPID_nem_ib_PktHandler_rma_lmt_rts(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
goto fn_exit;
}
-#if 0
-/* packet handler for wrapper packet of MPIDI_CH3_PKT_PUT */
-/* see MPIDI_CH3_PktHandler_EagerSend (in src/mpid/ch3/src/ch3u_rma_sync.c) */
-#undef FUNCNAME
-#define FUNCNAME MPID_nem_ib_PktHandler_Put
-#undef FCNAME
-#define FCNAME MPIDI_QUOTE(FUNCNAME)
-int MPID_nem_ib_PktHandler_Put(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
- MPIDI_msg_sz_t * buflen /* out */ ,
- MPID_Request ** rreqp /* out */)
-{
- MPID_nem_ib_vc_area *vc_ib = VC_IB(vc);
- int mpi_errno = MPI_SUCCESS;
- MPID_Request *req = NULL;
- MPIDI_CH3_Pkt_put_t *put_pkt =
- (MPIDI_CH3_Pkt_put_t *) ((uint8_t *) pkt + sizeof(MPIDI_CH3_Pkt_t));
- MPID_nem_ib_rma_lmt_cookie_t *s_cookie_buf =
- (MPID_nem_ib_rma_lmt_cookie_t *) ((uint8_t *) pkt + sizeof(MPIDI_CH3_Pkt_t) +
- sizeof(MPIDI_CH3_Pkt_t));
-
- /* ref. MPIDI_CH3_PktHandler_Put (= pktArray[MPIDI_CH3_PKT_PUT]) */
- MPI_Aint type_size;
-
- MPID_Win *win_ptr;
-
- MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_IB_PKTHANDLER_PUT);
- MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_IB_PKTHANDLER_PUT);
-
- MPIU_Assert(put_pkt->target_win_handle != MPI_WIN_NULL);
- MPID_Win_get_ptr(put_pkt->target_win_handle, win_ptr);
-
- req = MPID_Request_create();
- MPIU_Object_set_ref(req, 1); /* decrement only in drain_scq ? */
- int incomplete;
- MPIDI_CH3U_Request_increment_cc(req, &incomplete); // decrement in drain_scq
-
- req->dev.user_buf = put_pkt->addr;
- req->dev.user_count = put_pkt->count;
- req->dev.target_win_handle = put_pkt->target_win_handle;
- req->dev.source_win_handle = put_pkt->source_win_handle;
- req->dev.flags = put_pkt->flags;
- req->dev.OnFinal = MPIDI_CH3_ReqHandler_PutRecvComplete;
-
- if (MPIR_DATATYPE_IS_PREDEFINED(put_pkt->datatype)) {
- MPIDI_Request_set_type(req, MPIDI_REQUEST_TYPE_PUT_RESP);
- req->dev.datatype = put_pkt->datatype;
-
- MPID_Datatype_get_size_macro(put_pkt->datatype, type_size);
- req->dev.recv_data_sz = type_size * put_pkt->count;
- if (put_pkt->immed_len > 0) {
- /* See if we can receive some data from packet header. */
- MPIU_Memcpy(req->dev.user_buf, put_pkt->data, put_pkt->immed_len);
- req->dev.user_buf = (void*)((char*)req->dev.user_buf + put_pkt->immed_len);
- req->dev.recv_data_sz -= put_pkt->immed_len;
- }
- }
- else {
- /* derived datatype */
- MPIDI_Request_set_type(req, MPIDI_REQUEST_TYPE_PUT_RESP_DERIVED_DT);
- req->dev.datatype = MPI_DATATYPE_NULL;
-
- req->dev.dtype_info = (MPIDI_RMA_dtype_info *) MPIU_Malloc(sizeof(MPIDI_RMA_dtype_info));
- req->dev.dataloop = MPIU_Malloc(put_pkt->dataloop_size);
-
- /* We have to store the value of 'put_pkt->dataloop_size' which we use in drain_scq.
- * Temporarily, put it in req->dev.dtype_info.
- */
- *(int *) req->dev.dtype_info = put_pkt->dataloop_size;
- }
-
- /* ref. pkt_RTS_handler (= pktArray[MPIDI_NEM_PKT_LMT_RTS]) */
-
- void *write_to_buf;
-
- req->ch.lmt_data_sz = s_cookie_buf->len;
- req->ch.lmt_req_id = s_cookie_buf->sender_req_id;
-
- REQ_FIELD(req, lmt_pack_buf) = MPIU_Malloc((size_t) req->ch.lmt_data_sz);
- write_to_buf = REQ_FIELD(req, lmt_pack_buf);
-
- /* stash vc for ib_poll */
- req->ch.vc = vc;
-
- REQ_FIELD(req, lmt_tail) = s_cookie_buf->tail;
-
- /* try to issue RDMA-read command */
- int slack = 1; /* slack for control packet bringing sequence number */
- if (MPID_nem_ib_sendq_empty(vc_ib->sendq) &&
- vc_ib->ibcom->ncom < MPID_NEM_IB_COM_MAX_SQ_CAPACITY - slack &&
- MPID_nem_ib_ncqe < MPID_NEM_IB_COM_MAX_CQ_CAPACITY - slack) {
- mpi_errno =
- MPID_nem_ib_lmt_start_recv_core(req, s_cookie_buf->addr, s_cookie_buf->rkey,
- s_cookie_buf->len, write_to_buf,
- s_cookie_buf->max_msg_sz, 1);
- if (mpi_errno) {
- MPIU_ERR_POP(mpi_errno);
- }
- }
- else {
- /* enqueue command into send_queue */
- dprintf("lmt_start_recv, enqueuing,sendq_empty=%d,ncom=%d,ncqe=%d\n",
- MPID_nem_ib_sendq_empty(vc_ib->sendq),
- vc_ib->ibcom->ncom < MPID_NEM_IB_COM_MAX_SQ_CAPACITY,
- MPID_nem_ib_ncqe < MPID_NEM_IB_COM_MAX_CQ_CAPACITY);
-
- /* make raddr, (sz is in rreq->ch.lmt_data_sz), rkey, (user_buf is in req->dev.user_buf) survive enqueue, free cookie, dequeue */
- REQ_FIELD(req, lmt_raddr) = s_cookie_buf->addr;
- REQ_FIELD(req, lmt_rkey) = s_cookie_buf->rkey;
- REQ_FIELD(req, lmt_write_to_buf) = write_to_buf;
- REQ_FIELD(req, lmt_szsend) = s_cookie_buf->len;
- REQ_FIELD(req, max_msg_sz) = s_cookie_buf->max_msg_sz;
- REQ_FIELD(req, last) = 1; /* not support segmentation */
-
- /* set for send_progress */
- MPIDI_Request_set_msg_type(req, MPIDI_REQUEST_RNDV_MSG);
- req->kind = MPID_REQUEST_RECV;
-
- MPID_nem_ib_sendq_enqueue(&vc_ib->sendq, req);
- }
-
- /* prefix + header + data */
- *buflen =
- sizeof(MPIDI_CH3_Pkt_t) + sizeof(MPIDI_CH3_Pkt_t) + sizeof(MPID_nem_ib_rma_lmt_cookie_t);
- *rreqp = NULL;
-
- fn_exit:
- MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_IB_PKTHANDLER_PUT);
- return mpi_errno;
- fn_fail:
- goto fn_exit;
-}
-#endif
-
-#if 0
-/* packet handler for wrapper packet of MPIDI_CH3_PKT_ACCUMULATE */
-/* see MPIDI_CH3_PktHandler_Accumulate (in src/mpid/ch3/src/ch3u_rma_sync.c) */
-#undef FUNCNAME
-#define FUNCNAME MPID_nem_ib_PktHandler_Accumulate
-#undef FCNAME
-#define FCNAME MPIDI_QUOTE(FUNCNAME)
-int MPID_nem_ib_PktHandler_Accumulate(MPIDI_VC_t * vc,
- MPIDI_CH3_Pkt_t * pkt, MPIDI_msg_sz_t * buflen /* out */ ,
- MPID_Request ** rreqp /* out */)
-{
- MPID_nem_ib_vc_area *vc_ib = VC_IB(vc);
- int mpi_errno = MPI_SUCCESS;
- MPID_Request *req = NULL;
- MPIDI_CH3_Pkt_accum_t *accum_pkt =
- (MPIDI_CH3_Pkt_accum_t *) ((uint8_t *) pkt + sizeof(MPIDI_CH3_Pkt_t));
- MPID_nem_ib_rma_lmt_cookie_t *s_cookie_buf =
- (MPID_nem_ib_rma_lmt_cookie_t *) ((uint8_t *) pkt + sizeof(MPIDI_CH3_Pkt_t) +
- sizeof(MPIDI_CH3_Pkt_t));
-
- /* ref. MPIDI_CH3_PktHandler_Accumulate */
- MPI_Aint true_lb, true_extent, extent;
- MPI_Aint type_size;
- MPID_Win *win_ptr;
-
- MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_IB_PKTHANDLER_ACCUMULATE);
- MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_IB_PKTHANDLER_ACCUMULATE);
-
- MPIU_Assert(accum_pkt->target_win_handle != MPI_WIN_NULL);
- MPID_Win_get_ptr(accum_pkt->target_win_handle, win_ptr);
-
- req = MPID_Request_create();
- MPIU_Object_set_ref(req, 1);
-
- int incomplete;
- MPIDI_CH3U_Request_increment_cc(req, &incomplete); // decrement in drain_scq
-
- req->dev.user_count = accum_pkt->count;
- req->dev.op = accum_pkt->op;
- req->dev.real_user_buf = accum_pkt->addr;
- req->dev.target_win_handle = accum_pkt->target_win_handle;
- req->dev.source_win_handle = accum_pkt->source_win_handle;
- req->dev.flags = accum_pkt->flags;
-
- req->dev.resp_request_handle = MPI_REQUEST_NULL;
- req->dev.OnFinal = MPIDI_CH3_ReqHandler_AccumRecvComplete;
-
- if (MPIR_DATATYPE_IS_PREDEFINED(accum_pkt->datatype)) {
- MPIDI_Request_set_type(req, MPIDI_REQUEST_TYPE_ACCUM_RESP);
- req->dev.datatype = accum_pkt->datatype;
-
- MPIR_Type_get_true_extent_impl(accum_pkt->datatype, &true_lb, &true_extent);
- MPID_Datatype_get_extent_macro(accum_pkt->datatype, extent);
-
- /* Predefined types should always have zero lb */
- MPIU_Assert(true_lb == 0);
-
- req->dev.user_buf = MPIU_Malloc(accum_pkt->count * (MPIR_MAX(extent, true_extent)));
- req->dev.final_user_buf = req->dev.user_buf;
-
- MPID_Datatype_get_size_macro(accum_pkt->datatype, type_size);
- req->dev.recv_data_sz = type_size * accum_pkt->count;
-
- if (accum_pkt->immed_len > 0) {
- /* See if we can receive some data from packet header. */
- MPIU_Memcpy(req->dev.user_buf, accum_pkt->data, accum_pkt->immed_len);
- req->dev.user_buf = (void*)((char*)req->dev.user_buf + accum_pkt->immed_len);
- req->dev.recv_data_sz -= accum_pkt->immed_len;
- }
-
- }
- else {
- MPIDI_Request_set_type(req, MPIDI_REQUEST_TYPE_ACCUM_RESP_DERIVED_DT);
- req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_AccumDerivedDTRecvComplete;
- req->dev.datatype = MPI_DATATYPE_NULL;
-
- req->dev.dtype_info = (MPIDI_RMA_dtype_info *) MPIU_Malloc(sizeof(MPIDI_RMA_dtype_info));
- req->dev.dataloop = MPIU_Malloc(accum_pkt->dataloop_size);
-
- /* We have to store the value of 'put_pkt->dataloop_size' which we use in drain_scq.
- * Temporarily, put it in req->dev.dtype_info.
- */
- *(int *) req->dev.dtype_info = accum_pkt->dataloop_size;
- }
-
- /* ref. pkt_RTS_handler (= pktArray[MPIDI_NEM_PKT_LMT_RTS]) */
- void *write_to_buf;
-
- req->ch.lmt_data_sz = s_cookie_buf->len;
- req->ch.lmt_req_id = s_cookie_buf->sender_req_id;
-
- REQ_FIELD(req, lmt_pack_buf) = MPIU_Malloc((size_t) req->ch.lmt_data_sz);
- write_to_buf = REQ_FIELD(req, lmt_pack_buf);
-
- /* stash vc for ib_poll */
- req->ch.vc = vc;
-
- REQ_FIELD(req, lmt_tail) = s_cookie_buf->tail;
-
- /* try to issue RDMA-read command */
- int slack = 1; /* slack for control packet bringing sequence number */
- if (MPID_nem_ib_sendq_empty(vc_ib->sendq) &&
- vc_ib->ibcom->ncom < MPID_NEM_IB_COM_MAX_SQ_CAPACITY - slack &&
- MPID_nem_ib_ncqe < MPID_NEM_IB_COM_MAX_CQ_CAPACITY - slack) {
- mpi_errno =
- MPID_nem_ib_lmt_start_recv_core(req, s_cookie_buf->addr, s_cookie_buf->rkey,
- s_cookie_buf->len, write_to_buf,
- s_cookie_buf->max_msg_sz, 1);
- if (mpi_errno) {
- MPIU_ERR_POP(mpi_errno);
- }
- }
- else {
- /* enqueue command into send_queue */
- dprintf("lmt_start_recv, enqueuing,sendq_empty=%d,ncom=%d,ncqe=%d\n",
- MPID_nem_ib_sendq_empty(vc_ib->sendq),
- vc_ib->ibcom->ncom < MPID_NEM_IB_COM_MAX_SQ_CAPACITY,
- MPID_nem_ib_ncqe < MPID_NEM_IB_COM_MAX_CQ_CAPACITY);
-
- /* make raddr, (sz is in rreq->ch.lmt_data_sz), rkey, (user_buf is in req->dev.user_buf) survive enqueue, free cookie, dequeue */
- REQ_FIELD(req, lmt_raddr) = s_cookie_buf->addr;
- REQ_FIELD(req, lmt_rkey) = s_cookie_buf->rkey;
- REQ_FIELD(req, lmt_write_to_buf) = write_to_buf;
- REQ_FIELD(req, lmt_szsend) = s_cookie_buf->len;
- REQ_FIELD(req, max_msg_sz) = s_cookie_buf->max_msg_sz;
- REQ_FIELD(req, last) = 1; /* not support segmentation */
-
- /* set for send_progress */
- MPIDI_Request_set_msg_type(req, MPIDI_REQUEST_RNDV_MSG);
- req->kind = MPID_REQUEST_RECV;
-
- MPID_nem_ib_sendq_enqueue(&vc_ib->sendq, req);
- }
-
- /* prefix + header + data */
- *buflen =
- sizeof(MPIDI_CH3_Pkt_t) + sizeof(MPIDI_CH3_Pkt_t) + sizeof(MPID_nem_ib_rma_lmt_cookie_t);
- *rreqp = NULL;
-
- fn_exit:
- MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_IB_PKTHANDLER_ACCUMULATE);
- return mpi_errno;
- fn_fail:
- goto fn_exit;
-}
-#endif
-
-#if 0
-/* packet handler for wrapper packet of MPIDI_CH3_PKT_GET */
-/* see MPIDI_CH3_PktHandler_Get (in src/mpid/ch3/src/ch3u_rma_sync.c) */
-#undef FUNCNAME
-#define FUNCNAME MPID_nem_ib_PktHandler_Get
-#undef FCNAME
-#define FCNAME MPIDI_QUOTE(FUNCNAME)
-int MPID_nem_ib_PktHandler_Get(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
- MPIDI_msg_sz_t * buflen /* out */ ,
- MPID_Request ** rreqp /* out */)
-{
- MPID_nem_ib_pkt_prefix_t *netmod_pkt = (MPID_nem_ib_pkt_prefix_t *) pkt;
- MPIDI_CH3_Pkt_get_t *ch3_pkt =
- (MPIDI_CH3_Pkt_get_t *) ((uint8_t *) pkt + sizeof(MPID_nem_ib_pkt_prefix_t));
- int mpi_errno = MPI_SUCCESS;
- MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_IB_PKTHANDLER_GET);
- MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_IB_PKTHANDLER_GET);
- /* Update occupation status of local SR (send request) queue */
- MPID_nem_ib_vc_area *vc_ib = VC_IB(vc);
- dprintf
- ("MPID_nem_ib_Pkthandler_Get,lsr_seq_num_tail=%d,get_pkt->seq_num_tail=%d\n",
- vc_ib->ibcom->lsr_seq_num_tail, netmod_pkt->seq_num_tail);
- vc_ib->ibcom->lsr_seq_num_tail = netmod_pkt->seq_num_tail;
- dprintf("MPID_nem_ib_Pkthandler_Get,lsr_seq_num_tail updated to %d\n",
- vc_ib->ibcom->lsr_seq_num_tail);
-#ifndef MPID_NEM_IB_DISABLE_VAR_OCC_NOTIFY_RATE
- /* change remote notification policy of RDMA-write-to buf */
- dprintf("pkthandler,put,old rstate=%d\n", vc_ib->ibcom->rdmabuf_occupancy_notify_rstate);
- MPID_nem_ib_change_rdmabuf_occupancy_notify_policy_lw(vc_ib, &vc_ib->ibcom->lsr_seq_num_tail);
- dprintf("pkthandler,put,new rstate=%d\n", vc_ib->ibcom->rdmabuf_occupancy_notify_rstate);
-#endif
- dprintf("pkthandler,put,sendq_empty=%d,ncom=%d,rdmabuf_occ=%d\n",
- MPID_nem_ib_sendq_empty(vc_ib->sendq), vc_ib->ibcom->ncom,
- MPID_nem_ib_diff16(vc_ib->ibcom->sseq_num, vc_ib->ibcom->lsr_seq_num_tail));
- /* try to send from sendq because at least one RDMA-write-to buffer has been released */
- dprintf("pkthandler,get,send_progress\n");
- fflush(stdout);
- MPID_NEM_IB_SEND_PROGRESS_POLLINGSET
- /* fall back to the original handler */
- /* we don't need to worry about the difference caused by embedding seq_num
- * because size of MPI-header of MPIDI_CH3_PKT_PUT equals to sizeof(MPIDI_CH3_Pkt_t)
- * see MPID_nem_ib_iSendContig
- */
- MPIDI_msg_sz_t ch3_buflen = *buflen - sizeof(MPID_nem_ib_pkt_prefix_t);
- mpi_errno = MPIDI_CH3_PktHandler_Get(vc, (MPIDI_CH3_Pkt_t *) ch3_pkt, &ch3_buflen, rreqp);
- *buflen = ch3_buflen + sizeof(MPID_nem_ib_pkt_prefix_t);
- if (mpi_errno) {
- MPIU_ERR_POP(mpi_errno);
- }
-
- fn_exit:
- MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_IB_PKTHANDLER_GET);
- return mpi_errno;
- fn_fail:
- goto fn_exit;
-}
-
-/* packet handler for wrapper packet of MPIDI_CH3_PKT_GET_RESP */
-/* see MPIDI_CH3_PktHandler_GetResp (in src/mpid/ch3/src/ch3u_rma_sync.c) */
-#undef FUNCNAME
-#define FUNCNAME MPID_nem_ib_PktHandler_GetResp
-#undef FCNAME
-#define FCNAME MPIDI_QUOTE(FUNCNAME)
-int MPID_nem_ib_PktHandler_GetResp(MPIDI_VC_t * vc,
- MPIDI_CH3_Pkt_t * pkt, MPIDI_msg_sz_t * buflen /* out */ ,
- MPID_Request ** rreqp /* out */)
-{
- MPID_nem_ib_vc_area *vc_ib = VC_IB(vc);
- int mpi_errno = MPI_SUCCESS;
- MPID_Request *req = NULL;
- MPIDI_CH3_Pkt_get_resp_t *get_resp_pkt =
- (MPIDI_CH3_Pkt_get_resp_t *) ((uint8_t *) pkt + sizeof(MPIDI_CH3_Pkt_t));
- MPID_nem_ib_rma_lmt_cookie_t *s_cookie_buf =
- (MPID_nem_ib_rma_lmt_cookie_t *) ((uint8_t *) pkt + sizeof(MPIDI_CH3_Pkt_t) +
- sizeof(MPIDI_CH3_Pkt_t));
-
- MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_IB_PKTHANDLER_GETRESP);
- MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_IB_PKTHANDLER_GETRESP);
-
- MPID_Request_get_ptr(get_resp_pkt->request_handle, req);
-
- MPID_Win *win_ptr;
- int target_rank = get_resp_pkt->target_rank;
-
- MPID_Win_get_ptr(get_resp_pkt->source_win_handle, win_ptr);
-
- /* decrement ack_counter on target */
- if (get_resp_pkt->flags & MPIDI_CH3_PKT_FLAG_RMA_LOCK_GRANTED) {
- mpi_errno = handle_lock_ack(win_ptr, target_rank,
- get_resp_pkt->flags);
- if (mpi_errno) MPIU_ERR_POP(mpi_errno);
- }
- if (get_resp_pkt->flags & MPIDI_CH3_PKT_FLAG_RMA_FLUSH_ACK) {
- mpi_errno = MPIDI_CH3I_RMA_Handle_flush_ack(win_ptr, target_rank);
- if (mpi_errno) MPIU_ERR_POP(mpi_errno);
- }
-
- void *write_to_buf;
-
- req->ch.lmt_data_sz = s_cookie_buf->len;
- req->ch.lmt_req_id = s_cookie_buf->sender_req_id;
-
- REQ_FIELD(req, lmt_pack_buf) = MPIU_Malloc((size_t) req->ch.lmt_data_sz);
- write_to_buf = REQ_FIELD(req, lmt_pack_buf);
-
- /* This is magic number to pick up request in drain_scq */
- MPIDI_Request_set_type(req, 13); // currently Request-type is defined from 1 to 12.
-
- /* stash vc for ib_poll */
- req->ch.vc = vc;
-
- REQ_FIELD(req, lmt_tail) = s_cookie_buf->tail;
-
- /* try to issue RDMA-read command */
- int slack = 1; /* slack for control packet bringing sequence number */
- if (MPID_nem_ib_sendq_empty(vc_ib->sendq) &&
- vc_ib->ibcom->ncom < MPID_NEM_IB_COM_MAX_SQ_CAPACITY - slack &&
- MPID_nem_ib_ncqe < MPID_NEM_IB_COM_MAX_CQ_CAPACITY - slack) {
- mpi_errno =
- MPID_nem_ib_lmt_start_recv_core(req, s_cookie_buf->addr, s_cookie_buf->rkey,
- s_cookie_buf->len, write_to_buf,
- s_cookie_buf->max_msg_sz, 1);
- if (mpi_errno) {
- MPIU_ERR_POP(mpi_errno);
- }
- }
- else {
- /* enqueue command into send_queue */
- dprintf("lmt_start_recv, enqueuing,sendq_empty=%d,ncom=%d,ncqe=%d\n",
- MPID_nem_ib_sendq_empty(vc_ib->sendq),
- vc_ib->ibcom->ncom < MPID_NEM_IB_COM_MAX_SQ_CAPACITY,
- MPID_nem_ib_ncqe < MPID_NEM_IB_COM_MAX_CQ_CAPACITY);
-
- /* make raddr, (sz is in rreq->ch.lmt_data_sz), rkey, (user_buf is in req->dev.user_buf) survive enqueue, free cookie, dequeue */
- REQ_FIELD(req, lmt_raddr) = s_cookie_buf->addr;
- REQ_FIELD(req, lmt_rkey) = s_cookie_buf->rkey;
- REQ_FIELD(req, lmt_write_to_buf) = write_to_buf;
- REQ_FIELD(req, lmt_szsend) = s_cookie_buf->len;
- REQ_FIELD(req, max_msg_sz) = s_cookie_buf->max_msg_sz;
- REQ_FIELD(req, last) = 1; /* not support segmentation */
-
- MPID_nem_ib_sendq_enqueue(&vc_ib->sendq, req);
- }
-
- /* prefix + header + data */
- *buflen =
- sizeof(MPIDI_CH3_Pkt_t) + sizeof(MPIDI_CH3_Pkt_t) + sizeof(MPID_nem_ib_rma_lmt_cookie_t);
- *rreqp = NULL;
-
- fn_exit:
- MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_IB_PKTHANDLER_GETRESP);
- return mpi_errno;
- fn_fail:
- goto fn_exit;
-}
-#endif
-
/* MPI_Isend set req-type to MPIDI_REQUEST_TYPE_RECV */
#undef FUNCNAME
#define FUNCNAME MPID_nem_ib_pkt_GET_DONE_handler
@@ -2381,23 +1550,6 @@ int MPID_nem_ib_pkt_GET_DONE_handler(MPIDI_VC_t * vc,
case MPIDI_REQUEST_TYPE_RSEND:
case MPIDI_REQUEST_TYPE_SSEND:
case MPIDI_REQUEST_TYPE_BSEND:
-#if 0 /* obsolete, it's in netmod header now */
- /* extract embeded RDMA-write-to buffer occupancy information */
- dprintf
- ("get_done_handler,old lsr_seq_num_tail=%d,done_pkt->seq_num_tail=%d\n",
- vc_ib->ibcom->lsr_seq_num_tail, done_pkt->seq_num_tail);
- vc_ib->ibcom->lsr_seq_num_tail = done_pkt->seq_num_tail;
- //dprintf("lmt_start_recv,new lsr_seq_num=%d\n", vc_ib->ibcom->lsr_seq_num_tail);
-#ifndef MPID_NEM_IB_DISABLE_VAR_OCC_NOTIFY_RATE
- /* change remote notification policy of RDMA-write-to buf */
- //dprintf("lmt_start_recv,reply_seq_num,old rstate=%d\n", vc_ib->ibcom->rdmabuf_occupancy_notify_rstate);
- MPID_nem_ib_change_rdmabuf_occupancy_notify_policy_lw(vc_ib,
- &vc_ib->ibcom->lsr_seq_num_tail);
- //dprintf("lmt_start_recv,reply_seq_num,new rstate=%d\n", vc_ib->ibcom->rdmabuf_occupancy_notify_rstate);
-#endif
- //dprintf("lmt_start_recv,reply_seq_num,sendq_empty=%d,ncom=%d,ncqe=%d,rdmabuf_occ=%d\n", MPID_nem_ib_sendq_empty(vc_ib->sendq), vc_ib->ibcom->ncom, MPID_nem_ib_ncqe, MPID_nem_ib_diff16(vc_ib->ibcom->sseq_num, vc_ib->ibcom->lsr_seq_num_tail));
-#endif
-
/* decrement reference counter of mr_cache_entry */
MPID_nem_ib_com_reg_mr_release(REQ_FIELD(req, lmt_mr_cache));
@@ -2773,7 +1925,6 @@ int MPID_nem_ib_cm_drain_scq()
dprintf("cm_drain_scq,cm_cas,succeeded\n");
if (is_conn_established(shadow_cm->req->responder_rank)) {
-#if 1
/* Explicitly release CAS word because
* ConnectX-3 doesn't support safe CAS with PCI device and CPU */
MPID_nem_ib_cm_cas_release(MPID_nem_ib_conns
@@ -2789,49 +1940,6 @@ int MPID_nem_ib_cm_drain_scq()
/* free memory : req->ref_count is 3, so call MPIU_Free() directly */
//MPID_nem_ib_cm_request_release(shadow_cm->req);
MPIU_Free(shadow_cm->req);
-#else
- /* Connection is already established.
- * In this case, responder may already have performed vc_terminate.
- * However, since initiator has to release responder's CAS word,
- * initiator sends CM_CAS_RELEASE2. */
- dprintf("cm_drain_scq,cm_cas,established,%d->%d\n",
- MPID_nem_ib_myrank, shadow_cm->req->responder_rank);
- shadow_cm->req->state = MPID_NEM_IB_CM_CAS_RELEASE2;
- if (MPID_nem_ib_ncqe_scratch_pad < MPID_NEM_IB_COM_MAX_CQ_CAPACITY &&
- shadow_cm->req->ibcom->ncom_scratch_pad <
- MPID_NEM_IB_COM_MAX_SQ_CAPACITY) {
-
- MPID_nem_ib_cm_cmd_syn_t *cmd =
- (MPID_nem_ib_cm_cmd_syn_t *) shadow_cm->req->ibcom->
- icom_mem[MPID_NEM_IB_COM_SCRATCH_PAD_FROM];
- MPID_NEM_IB_CM_COMPOSE_CAS_RELEASE2(cmd, shadow_cm->req);
- cmd->initiator_rank = MPID_nem_ib_myrank;
- MPID_nem_ib_cm_cmd_shadow_t *shadow_syn =
- (MPID_nem_ib_cm_cmd_shadow_t *)
- MPIU_Malloc(sizeof(MPID_nem_ib_cm_cmd_shadow_t));
- shadow_syn->type = shadow_cm->req->state;
- shadow_syn->req = shadow_cm->req;
- dprintf("shadow_syn=%p,shadow_syn->req=%p\n", shadow_syn,
- shadow_syn->req);
- dprintf("cm_drain_scq,cm_cas,established,sending cas_release2,%d->%d\n",
- MPID_nem_ib_myrank, shadow_cm->req->responder_rank);
- mpi_errno =
- MPID_nem_ib_cm_cmd_core(shadow_cm->req->responder_rank, shadow_syn,
- (void *) cmd,
- sizeof(MPID_nem_ib_cm_cmd_syn_t),
- 1 /* syn:1 */ , 0);
- MPIU_ERR_CHKANDJUMP(mpi_errno, mpi_errno, MPI_ERR_OTHER,
- "**MPID_nem_ib_cm_send_core");
- }
- else {
- MPID_NEM_IB_CM_COMPOSE_CAS_RELEASE2((MPID_nem_ib_cm_cmd_syn_t *) &
- (shadow_cm->req->cmd),
- shadow_cm->req);
- ((MPID_nem_ib_cm_cmd_syn_t *) & shadow_cm->req->cmd)->initiator_rank =
- MPID_nem_ib_myrank;
- MPID_nem_ib_cm_sendq_enqueue(&MPID_nem_ib_cm_sendq, shadow_cm->req);
- }
-#endif
}
else {
/* Increment receiving transaction counter. Initiator receives SYNACK and ACK2 */
@@ -3879,14 +2987,6 @@ int MPID_nem_ib_ringbuf_alloc(MPIDI_VC_t * vc)
MPIU_ERR_CHKANDJUMP(!MPID_nem_ib_ringbuf, mpi_errno, MPI_ERR_OTHER, "**malloc");
}
-#if 0 /* Degug, "#if 1" to make exclusive ring-buffers not available */
- //if (MPID_nem_ib_myrank == 0) {
- for (i = 0; i < MPID_NEM_IB_NRINGBUF - 1; i++) {
- MPID_nem_ib_ringbuf_acquired[i / 64] |= (1ULL << (i & 63));
- }
- //}
-#endif
-
int found = 0;
/* [MPID_NEM_IB_NRINGBUF-1] holds shared ring buffer */
for (i = 0; i < MPID_NEM_IB_NRINGBUF - 1; i++) {
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_reg_mr.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_reg_mr.c
index 2a2c8b6..bd8b5f5 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_reg_mr.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_reg_mr.c
@@ -34,10 +34,6 @@ static int ref_count;
typedef struct {
char *next;
} free_list_t;
-#if 0
-static char *free_list_front[MPID_NEM_IB_NIALLOCID] = { 0 };
-static char *arena_flist[MPID_NEM_IB_NIALLOCID] = { 0 };
-#endif
#define MPID_NEM_IB_SZARENA 4096
#define MPID_NEM_IB_CLUSTER_SIZE (MPID_NEM_IB_SZARENA/sz)
@@ -155,35 +151,16 @@ static inline void __lru_queue_display()
void *MPID_nem_ib_com_reg_mr_fetch(void *addr, long len,
enum ibv_access_flags additional_flags, int mode)
{
-#if 0 /* debug */
- struct ibv_mr *mr;
- int ibcom_errno = MPID_nem_ib_com_reg_mr(addr, len, &mr);
- printf("mrcache,MPID_nem_ib_com_reg_mr,error,addr=%p,len=%d,lkey=%08x,rkey=%08x\n", addr, len,
- mr->lkey, mr->rkey);
- if (ibcom_errno != 0) {
- goto fn_fail;
- }
- fn_exit:
- return mr;
- fn_fail:
- goto fn_exit;
-#else
int ibcom_errno;
int key;
struct MPID_nem_ib_com_reg_mr_cache_entry_t *e;
static unsigned long long num_global_cache = 0ULL;
-#if 1 /*def HAVE_LIBDCFA */
/* we can't change addr because ibv_post_send assumes mr->host_addr (output of this function)
* must have an exact mirror value of addr (input of this function) */
void *addr_aligned = addr;
long len_aligned = len;
-#else
- void *addr_aligned = (void *) ((unsigned long) addr & ~(MPID_NEM_IB_COM_REG_MR_SZPAGE - 1));
- long len_aligned =
- ((((unsigned long) addr + len) - (unsigned long) addr_aligned +
- MPID_NEM_IB_COM_REG_MR_SZPAGE - 1) & ~(MPID_NEM_IB_COM_REG_MR_SZPAGE - 1));
-#endif
+
key = MPID_nem_ib_com_hash_func(addr);
dprintf("[MrCache] addr=%p, len=%ld\n", addr, len);
@@ -208,24 +185,6 @@ void *MPID_nem_ib_com_reg_mr_fetch(void *addr, long len,
// miss
-#if 0
- // evict an entry and de-register its MR when the cache-set is full
- if (way > MPID_NEM_IB_COM_REG_MR_NWAY) {
- struct MPID_nem_ib_com_reg_mr_cache_entry_t *victim =
- (struct MPID_nem_ib_com_reg_mr_cache_entry_t *) e->lru_prev;
- MPID_nem_ib_com_reg_mr_unlink((struct MPID_nem_ib_com_reg_mr_listnode_t *) victim);
-
- //dprintf("MPID_nem_ib_com_reg_mr,evict,entry addr=%p,len=%d,mr addr=%p,len=%ld\n", e->addr, e->len,
- //e->mr->addr, e->mr->length);
- ibcom_errno = MPID_nem_ib_com_dereg_mr(victim->mr);
- if (ibcom_errno) {
- printf("mrcache,MPID_nem_ib_com_dereg_mr\n");
- goto fn_fail;
- }
- afree(victim, MPID_NEM_IB_COM_AALLOC_ID_MRCACHE);
- }
-#endif
-
e = aalloc(sizeof(struct MPID_nem_ib_com_reg_mr_cache_entry_t),
MPID_NEM_IB_COM_AALLOC_ID_MRCACHE);
/* reference counter is used when evicting entry */
@@ -237,7 +196,6 @@ void *MPID_nem_ib_com_reg_mr_fetch(void *addr, long len,
if (ibcom_errno != 0) {
/* ib_com_reg_mr returns the errno of ibv_reg_mr */
if (ibcom_errno == ENOMEM) {
-#if 1
/* deregister memory region unused and re-register new one */
struct MPID_nem_ib_com_reg_mr_listnode_t *ptr;
struct MPID_nem_ib_com_reg_mr_cache_entry_t *victim;
@@ -287,40 +245,6 @@ void *MPID_nem_ib_com_reg_mr_fetch(void *addr, long len,
afree(e, MPID_NEM_IB_COM_AALLOC_ID_MRCACHE);
goto fn_fail;
}
-#else
- /* deregister memory region. The value of 'num_global_cache' means the number of global-cached.
- * delete 5 percents of global-cached */
- int i;
- int del_num = (num_global_cache + 19) / 20;
- struct MPID_nem_ib_com_reg_mr_cache_entry_t *victim;
-
- dprintf("mrcache,MPID_nem_ib_com_reg_mr,ENOMEM,del_num(%d)\n", del_num);
-
- for (i = 0; i < del_num; i++) {
- /* get LRU data from MPID_nem_ib_com_reg_mr_global_cache */
- victim = list_entry(MPID_nem_ib_com_reg_mr_global_cache.lru_prev, struct MPID_nem_ib_com_reg_mr_cache_entry_t, g_lru);
-
- MPID_nem_ib_com_reg_mr_unlink((struct MPID_nem_ib_com_reg_mr_listnode_t *)victim);
- MPID_nem_ib_com_reg_mr_unlink(&(victim->g_lru));
-
- ibcom_errno = MPID_nem_ib_com_dereg_mr(victim->mr);
- if (ibcom_errno) {
- printf("mrcache,MPID_nem_ib_com_dereg_mr\n");
- afree(e, MPID_NEM_IB_COM_AALLOC_ID_MRCACHE);
- goto fn_fail;
- }
- afree(victim, MPID_NEM_IB_COM_AALLOC_ID_MRCACHE);
- num_global_cache--;
- }
-
- /* re-registraion */
- ibcom_errno = MPID_nem_ib_com_reg_mr(addr_aligned, len_aligned, &e->mr, additional_flags);
- if (ibcom_errno != 0) {
- fprintf(stderr, "mrcache,MPID_nem_ib_com_reg_mr,retry,errno=%d\n", ibcom_errno);
- afree(e, MPID_NEM_IB_COM_AALLOC_ID_MRCACHE);
- goto fn_fail;
- }
-#endif
}
else {
/* errno is not ENOMEM */
@@ -352,7 +276,7 @@ void *MPID_nem_ib_com_reg_mr_fetch(void *addr, long len,
/* reference counter is used when evicting entry */
e->refc++;
-#if 1
+
/* move to head of the list */
if (e !=
(struct MPID_nem_ib_com_reg_mr_cache_entry_t *) MPID_nem_ib_com_reg_mr_cache[key].lru_next)
@@ -361,7 +285,7 @@ void *MPID_nem_ib_com_reg_mr_fetch(void *addr, long len,
MPID_nem_ib_com_reg_mr_insert(&MPID_nem_ib_com_reg_mr_cache[key],
(struct MPID_nem_ib_com_reg_mr_listnode_t *) e);
}
-#endif
+
if (mode != MPID_NEM_IB_COM_REG_MR_STICKY) {
/* move to head of the list in global-cache */
MPID_nem_ib_com_reg_mr_unlink(&(e->g_lru));
@@ -379,23 +303,8 @@ void *MPID_nem_ib_com_reg_mr_fetch(void *addr, long len,
return e;
fn_fail:
goto fn_exit;
-#endif
}
-#if 0
-static void MPID_nem_ib_com_reg_mr_dereg(struct ibv_mr *mr)
-{
-
- struct MPID_nem_ib_com_reg_mr_cache_entry_t *e;
- struct MPID_nem_ib_com_reg_mr_cache_entry_t *zero = 0;
- unsigned long offset = (unsigned long) zero->mr;
- e = (struct MPID_nem_ib_com_reg_mr_cache_entry_t *) ((unsigned long) mr - offset);
- e->refc--;
-
- //dprintf("MPID_nem_ib_com_reg_mr_dereg,entry=%p,mr=%p,addr=%p,refc=%d,offset=%lx\n", e, mr, e->mr->addr,
- //e->refc, offset);
-}
-#endif
void MPID_nem_ib_com_reg_mr_release(struct MPID_nem_ib_com_reg_mr_cache_entry_t *entry)
{
entry->refc--;
diff --git a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
index fe43e85..8981409 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c
@@ -19,128 +19,6 @@
static int entered_send_progress = 0;
-#ifdef MPID_NEM_IB_ONDEMAND
-#if 0
-// tree format is
-// one or more <left_pointer(int), right_pointer(int), value(int), length(int), string(char[])>
-#define MPID_NEM_IB_MAP_LPTR(ptr) *(int*)((ptr) + sizeof(int)*0)
-#define MPID_NEM_IB_MAP_RPTR(ptr) *(int*)((ptr) + sizeof(int)*1)
-#define MPID_NEM_IB_MAP_VAL(ptr) *(int*)((ptr) + sizeof(int)*2)
-#define MPID_NEM_IB_MAP_LEN(ptr) *(int*)((ptr) + sizeof(int)*3)
-#define MPID_NEM_IB_MAP_PBODY(ptr) ((ptr) + sizeof(int)*4)
-
-#define MPID_NEM_IB_MAP_ALLOCATE(map, key, key_length, initial) { \
- if (map->length + key_length + sizeof(int)*4 > map->max_length) { \
- map->max_length = map->max_length ? map->max_length * 2 : 4096; \
- map->data = realloc(map->data, map->max_length); \
- } \
- char* new_str = map->data + map->length; \
- MPID_NEM_IB_MAP_LPTR(new_str) = 0; \
- MPID_NEM_IB_MAP_RPTR(new_str) = 0; \
- MPID_NEM_IB_MAP_VAL(new_str) = initial; \
- MPID_NEM_IB_MAP_LEN(new_str) = key_length; \
- memcpy(MPID_NEM_IB_MAP_PBODY(new_str), key, key_length); \
- map->length += sizeof(int)*4 + key_length; \
-}
-
-void MPID_nem_ib_cm_map_set(MPID_nem_ib_cm_map_t * map, char *key, int key_length, int val)
-{
- char *pTree = map->data;
- dprintf("MPID_nem_ib_cm_map_set,val=%d\n", val);
-
- if (!pTree) {
- MPID_NEM_IB_MAP_ALLOCATE(map, key, key_length, val);
- dprintf("pTree was empty\n");
- return;
- }
- int s1_minus_s2;
- while (1) {
- int lmin =
- key_length < MPID_NEM_IB_MAP_LEN(pTree) ? key_length : MPID_NEM_IB_MAP_LEN(pTree);
- int residual = key_length - MPID_NEM_IB_MAP_LEN(pTree);
- s1_minus_s2 = memcmp(key, MPID_NEM_IB_MAP_PBODY(pTree), lmin);
-
- if (!s1_minus_s2 && !residual) {
- MPID_NEM_IB_MAP_VAL(pTree) = val;
- dprintf("found\n");
- return; // same string, same length
- }
- else if (s1_minus_s2 < 0 || !s1_minus_s2 && residual < 0) {
- // psArg is "smaller" OR same substring, psArg is shorter
- if (MPID_NEM_IB_MAP_LPTR(pTree) == 0) {
- MPID_NEM_IB_MAP_LPTR(pTree) = map->length; // pointer write
- /* left child */
- MPID_NEM_IB_MAP_ALLOCATE(map, key, key_length, val);
- dprintf("stored as left child\n");
- return;
- }
- pTree = map->data + MPID_NEM_IB_MAP_LPTR(pTree); // go to left child
- }
- else {
- // psArg is "larger" OR same substring, psArg is longer
- if (MPID_NEM_IB_MAP_RPTR(pTree) == 0) {
- MPID_NEM_IB_MAP_RPTR(pTree) = map->length; // pointer write
- /* right child */
- MPID_NEM_IB_MAP_ALLOCATE(map, key, key_length, val);
- dprintf("stored as right child\n");
- return;
- }
- pTree = map->data + MPID_NEM_IB_MAP_RPTR(pTree); // go to right child
- }
- }
-}
-
-int MPID_nem_ib_cm_map_get(MPID_nem_ib_cm_map_t * map, char *key, int key_length, int *val)
-{
- int mpi_errno = MPI_SUCCESS;
- char *pTree = map->data;
-
- dprintf("MPID_nem_ib_cm_map_get,key=%s\n", key);
-
- if (!pTree) {
- mpi_errno = -1;
- dprintf("pTree is empty\n");
- goto fn_fail;
- }
- int s1_minus_s2;
- while (1) {
- int lmin =
- key_length < MPID_NEM_IB_MAP_LEN(pTree) ? key_length : MPID_NEM_IB_MAP_LEN(pTree);
- int residual = key_length - MPID_NEM_IB_MAP_LEN(pTree);
- s1_minus_s2 = memcmp(key, MPID_NEM_IB_MAP_PBODY(pTree), lmin);
-
- if (!s1_minus_s2 && !residual) {
- *val = MPID_NEM_IB_MAP_VAL(pTree);
- dprintf("value found=%d\n", *val);
- goto fn_exit; // same string, same length
- }
- else if (s1_minus_s2 < 0 || !s1_minus_s2 && residual < 0) {
- // psArg is "smaller" OR same substring, psArg is shorter
- if (MPID_NEM_IB_MAP_LPTR(pTree) == 0) {
- mpi_errno = -1;
- dprintf("left is null\n");
- goto fn_fail;
- }
- pTree = map->data + MPID_NEM_IB_MAP_LPTR(pTree); // go to left child
- }
- else {
- // psArg is "larger" OR same substring, psArg is longer
- if (MPID_NEM_IB_MAP_RPTR(pTree) == 0) {
- mpi_errno = -1;
- dprintf("right is null\n");
- goto fn_fail;
- }
- pTree = map->data + MPID_NEM_IB_MAP_RPTR(pTree); // go to right child
- }
- }
- fn_exit:
- return mpi_errno;
- fn_fail:
- goto fn_exit;
-}
-#endif
-#endif
-
#undef FUNCNAME
#define FUNCNAME MPID_nem_ib_iSendContig_core
#undef FCNAME
@@ -171,48 +49,10 @@ static int MPID_nem_ib_iSendContig_core(MPIDI_VC_t * vc, MPID_Request * sreq, vo
/* send RDMA-write-to buffer occupancy information */
/* embed SR occupancy information and remember the last one sent */
-#if 0
- MPIDI_CH3_Pkt_t *ch3_hdr = (MPIDI_CH3_Pkt_t *) hdr;
-#endif
if (MPID_nem_ib_diff16(vc_ib->ibcom->rsr_seq_num_tail, vc_ib->ibcom->rsr_seq_num_tail_last_sent)
> notify_rate) {
-#if 0 /* debug, disabling piggy-back */
- switch (ch3_hdr->type) {
- case MPIDI_CH3_PKT_EAGER_SEND:
- pkt_netmod.subtype = MPIDI_NEM_IB_PKT_EAGER_SEND;
- goto common_tail;
-#if 0 /* modification of mpid_nem_lmt.c is required */
- case MPIDI_NEM_PKT_LMT_RTS:
- pkt_netmod.subtype = MPIDI_NEM_IB_PKT_LMT_RTS;
- goto common_tail;
-#endif
- case MPIDI_CH3_PKT_PUT:
- pkt_netmod.subtype = MPIDI_NEM_IB_PKT_PUT;
- goto common_tail;
- case MPIDI_CH3_PKT_ACCUMULATE:
- pkt_netmod.subtype = MPIDI_NEM_IB_PKT_ACCUMULATE;
- goto common_tail;
- case MPIDI_CH3_PKT_GET:
- pkt_netmod.subtype = MPIDI_NEM_IB_PKT_GET;
- goto common_tail;
- case MPIDI_CH3_PKT_GET_RESP:
- pkt_netmod.subtype = MPIDI_NEM_IB_PKT_GET_RESP;
- common_tail:
- pkt_netmod.type = MPIDI_NEM_PKT_NETMOD;
- pkt_netmod.seq_num_tail = vc_ib->ibcom->rsr_seq_num_tail;
- vc_ib->ibcom->rsr_seq_num_tail_last_sent = vc_ib->ibcom->rsr_seq_num_tail;
- prefix = (void *) &pkt_netmod;
- sz_prefix = sizeof(MPID_nem_ib_pkt_prefix_t);
- break;
- default:
- prefix = NULL;
- sz_prefix = 0;
- break;
- }
-#else
prefix = NULL;
sz_prefix = 0;
-#endif
}
else {
prefix = NULL;
@@ -222,28 +62,13 @@ static int MPID_nem_ib_iSendContig_core(MPIDI_VC_t * vc, MPID_Request * sreq, vo
s_data = data;
s_data_sz = data_sz;
-#if 0
- if (hdr &&
- ((((MPIDI_CH3_Pkt_t *) hdr)->type == MPIDI_CH3_PKT_PUT)
- || (((MPIDI_CH3_Pkt_t *) hdr)->type == MPIDI_CH3_PKT_GET_RESP)
- || (((MPIDI_CH3_Pkt_t *) hdr)->type == MPIDI_CH3_PKT_ACCUMULATE))) {
-#endif
/* If request length is too long, create LMT packet */
if (MPID_NEM_IB_NETMOD_HDR_SIZEOF(vc_ib->ibcom->local_ringbuf_type)
+ sizeof(MPIDI_CH3_Pkt_t) + data_sz
> MPID_NEM_IB_COM_RDMABUF_SZSEG - sizeof(MPID_nem_ib_netmod_trailer_t)) {
pkt_netmod.type = MPIDI_NEM_PKT_NETMOD;
-#if 0
- if (((MPIDI_CH3_Pkt_t *) hdr)->type == MPIDI_CH3_PKT_PUT)
- pkt_netmod.subtype = MPIDI_NEM_IB_PKT_PUT;
- else if (((MPIDI_CH3_Pkt_t *) hdr)->type == MPIDI_CH3_PKT_GET_RESP)
- pkt_netmod.subtype = MPIDI_NEM_IB_PKT_GET_RESP;
- else if (((MPIDI_CH3_Pkt_t *) hdr)->type == MPIDI_CH3_PKT_ACCUMULATE)
- pkt_netmod.subtype = MPIDI_NEM_IB_PKT_ACCUMULATE;
-#else
pkt_netmod.subtype = MPIDI_NEM_IB_PKT_RMA_LMT_RTS;
-#endif
void *write_from_buf = data;
@@ -251,11 +76,6 @@ static int MPID_nem_ib_iSendContig_core(MPIDI_VC_t * vc, MPID_Request * sreq, vo
MPID_nem_ib_com_get_info_conn(vc_ib->sc->fd, MPID_NEM_IB_COM_INFOKEY_PATTR_MAX_MSG_SZ,
&max_msg_sz, sizeof(uint32_t));
-#if 0
- /* RMA : Netmod IB supports only smaller size than max_msg_sz. */
- MPIU_Assert(data_sz <= max_msg_sz);
-#endif
-
MPID_nem_ib_rma_lmt_cookie_t *s_cookie_buf = (MPID_nem_ib_rma_lmt_cookie_t *) MPIU_Malloc(sizeof(MPID_nem_ib_rma_lmt_cookie_t));
sreq->ch.s_cookie = s_cookie_buf;
@@ -289,9 +109,6 @@ static int MPID_nem_ib_iSendContig_core(MPIDI_VC_t * vc, MPID_Request * sreq, vo
int incomplete;
MPIDI_CH3U_Request_increment_cc(sreq, &incomplete); // decrement in drain_scq and pkt_rma_lmt_getdone
}
-#if 0
- }
-#endif
/* packet handlers including MPIDI_CH3_PktHandler_EagerSend and MPID_nem_handle_pkt assume this */
hdr_sz = sizeof(MPIDI_CH3_Pkt_t);
@@ -344,14 +161,7 @@ static int MPID_nem_ib_iSendContig_core(MPIDI_VC_t * vc, MPID_Request * sreq, vo
MPID_nem_ib_ncqe += 1;
//dprintf("isendcontig_core,ncqe=%d\n", MPID_nem_ib_ncqe);
dprintf("isendcontig_core,isend,kind=%d,msg_type=%d,copied=%d\n", sreq->kind, msg_type, copied); /*suspicious lines,(if1,on,on,off,if0) works */
-#if 0
-#define MPID_NEM_IB_TLBPREF_SEND 20 //20
- int tlb_pref_ahd = 4096 * MPID_NEM_IB_TLBPREF_SEND;
- __asm__ __volatile__
- ("movq %0, %%rsi;"
- "movq 0(%%rsi), %%rax;"::"r"((uint64_t) data + tlb_pref_ahd):"%rsi", "%rax");
-#endif
-#if 1
+
#ifdef __MIC__
__asm__ __volatile__
("movq %0, %%rsi;"
@@ -367,7 +177,6 @@ static int MPID_nem_ib_iSendContig_core(MPIDI_VC_t * vc, MPID_Request * sreq, vo
"prefetchnta 0x80(%%rsi);"
"prefetchnta 0xc0(%%rsi);"::"r"((uint64_t) data + 4 * data_sz):"%rsi");
#endif
-#endif
MPIU_DBG_MSG_FMT(CH3_CHANNEL, VERBOSE, (MPIU_DBG_FDEST, "ib_send, fd=%d", vc_ib->sc->fd));
vc_ib->pending_sends += 1;
@@ -383,46 +192,8 @@ static int MPID_nem_ib_iSendContig_core(MPIDI_VC_t * vc, MPID_Request * sreq, vo
* so we need to perform
* progress_send for all of VCs using nces in ib_poll
* (if we have drain-sendq in ib_poll, this isn't needed. */
-#if 0 /* debug,disabling fast-dec-cc when copied */
- if (copied && !sreq->dev.OnDataAvail) { /* skip poll scq */
- int (*reqFn) (MPIDI_VC_t *, MPID_Request *, int *);
-
- (VC_FIELD(sreq->ch.vc, pending_sends)) -= 1;
-
- /* as in the template */
- reqFn = sreq->dev.OnDataAvail;
- if (!reqFn) {
- /* MPID_Request_release is called in
- * MPI_Wait (in src/mpi/pt2pt/wait.c)
- * MPIR_Wait_impl (in src/mpi/pt2pt/wait.c)
- * MPIR_Request_complete (in /src/mpi/pt2pt/mpir_request.c) */
- int incomplete;
- MPIDI_CH3U_Request_decrement_cc(sreq, &incomplete);
- if (!incomplete) {
- MPIDI_CH3_Progress_signal_completion();
- }
- //dprintf("isendcontig_core,cc_ptr=%d\n", *(sreq->cc_ptr));
- dprintf("sendcontig_core,copied,complete,req=%p,cc incremented to %d,ref_count=%d\n",
- sreq, MPIDI_CH3I_progress_completion_count.v, sreq->ref_count);
- MPIU_DBG_MSG(CH3_CHANNEL, VERBOSE, ".... complete");
- }
- else {
- MPIDI_VC_t *vc = sreq->ch.vc;
- int complete = 0;
- mpi_errno = reqFn(vc, sreq, &complete);
- if (mpi_errno)
- MPIU_ERR_POP(mpi_errno);
- /* not-completed case is not implemented */
- MPIU_Assert(complete == TRUE);
- MPIU_Assert(0); /* decrement ref_count and free sreq causes problem */
- }
- }
- else {
- MPID_nem_ib_ncqe_nces += 1; /* it has different meaning, counting non-copied eager-send */
- }
-#else
+
MPID_nem_ib_ncqe_nces += 1; /* it has different meaning, counting non-copied eager-send */
-#endif
#ifndef MPID_NEM_IB_DISABLE_VAR_OCC_NOTIFY_RATE
//dprintf("isendcontig,old rstate=%d\n", vc_ib->ibcom->rdmabuf_occupancy_notify_rstate);
@@ -464,9 +235,6 @@ int MPID_nem_ib_iSendContig(MPIDI_VC_t * vc, MPID_Request * sreq, void *hdr,
MPIDI_msg_sz_t hdr_sz, void *data, MPIDI_msg_sz_t data_sz)
{
int mpi_errno = MPI_SUCCESS;
-#if 0
- int ibcom_errno;
-#endif
MPID_nem_ib_vc_area *vc_ib = VC_IB(vc);
MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_IB_ISENDCONTIG);
@@ -509,42 +277,15 @@ int MPID_nem_ib_iSendContig(MPIDI_VC_t * vc, MPID_Request * sreq, void *hdr,
}
}
-#if 0
- /* aggressively perform drain_scq */
- /* try to clear the road blocks, i.e. ncom, ncqe */
- if (vc_ib->ibcom->ncom >=
- /*MPID_NEM_IB_COM_MAX_SQ_CAPACITY */ MPID_NEM_IB_COM_MAX_SQ_HEIGHT_DRAIN ||
- MPID_nem_ib_ncqe >=
- /*MPID_NEM_IB_COM_MAX_CQ_CAPACITY */ MPID_NEM_IB_COM_MAX_CQ_HEIGHT_DRAIN) {
- //printf("isendcontig,kick drain_scq\n");
- ibcom_errno = MPID_nem_ib_drain_scq(1); /* set 1st arg to one which means asking it for not calling send_progress because it recursively call isendcontig_core */
- MPIU_ERR_CHKANDJUMP(ibcom_errno, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_drain_scq");
- }
-#endif
/* set it for drain_scq */
MPIDI_Request_set_msg_type(sreq, MPIDI_REQUEST_EAGER_MSG);
-
-
#ifdef MPID_NEM_IB_ONDEMAND
if (vc_ib->connection_state != MPID_NEM_IB_CM_ESTABLISHED) {
goto enqueue;
}
#endif
-#if 0
- /* anticipating received message releases RDMA-write-to buffer or IB command-queue entry */
- /* Unexpected state MPIDI_VC_STATE_CLOSED in vc 0xf1fed0 (expecting MPIDI_VC_STATE_ACTIVE)
- * Assertion failed in file src/mpid/ch3/src/ch3u_handle_connection.c at line 326: vc->state == MPIDI_VC_STATE_ACTIVE */
- if (vc->state == MPIDI_VC_STATE_ACTIVE &&
- MPID_nem_ib_tsc_poll - MPID_nem_ib_rdtsc() > MPID_NEM_IB_POLL_PERIOD_SEND) {
- mpi_errno = MPID_nem_ib_poll(0);
- if (mpi_errno) {
- MPIU_ERR_POP(mpi_errno);
- }
- }
-#endif
-
dprintf
("isendcontig,%d->%d,req=%p,type=%d,subtype=%d,data_sz=%ld,ldiff=%d(%d-%d),rdiff=%d(%d-%d)\n",
MPID_nem_ib_myrank, vc->pg_rank, sreq, ((MPIDI_CH3_Pkt_t *) hdr)->type,
@@ -638,39 +379,7 @@ int MPID_nem_ib_iSendContig(MPIDI_VC_t * vc, MPID_Request * sreq, void *hdr,
* rank-0 stops draining command queue.
*/
dprintf("isendcontig,enqueuing,type=%d,\n", ((MPIDI_CH3_Pkt_t *) hdr)->type);
-#if 0
- if (((MPIDI_CH3_Pkt_t *) hdr)->type == MPIDI_NEM_PKT_NETMOD) {
- switch (((MPID_nem_pkt_netmod_t *) hdr)->subtype) {
- case MPIDI_NEM_IB_PKT_REPLY_SEQ_NUM:
- dprintf("enqueuing REPLY_SEQ_NUM\ %d->%d,%d\n", MPID_nem_ib_myrank, vc->pg_rank,
- MPID_nem_ib_ncqe);
- break;
- default:
- break;
- }
- }
- else {
- switch (((MPIDI_CH3_Pkt_t *) hdr)->type) {
- case MPIDI_CH3_PKT_ACCUMULATE:
- dprintf("enqueuing ACCUMULATE\n");
- break;
- case MPIDI_CH3_PKT_GET_RESP:
- dprintf("enqueuing GET_RESP\n");
- break;
- case MPIDI_CH3_PKT_GET:
- dprintf("enqueuing GET\n");
- break;
- case MPIDI_CH3_PKT_PUT:
- dprintf("enqueuing PUT\n");
- break;
- case MPIDI_NEM_PKT_LMT_DONE:
- dprintf("isendcontig,enqueue,DONE\n");
- break;
- default:
- break;
- }
- }
-#endif
+
if (((MPIDI_CH3_Pkt_t *) hdr)->type == MPIDI_NEM_PKT_NETMOD &&
((MPID_nem_pkt_netmod_t *) hdr)->subtype == MPIDI_NEM_IB_PKT_REPLY_SEQ_NUM) {
dprintf("isendcontig,REPLY_SEQ_NUM,enqueue_at_head\n");
@@ -700,12 +409,6 @@ int MPID_nem_ib_iStartContigMsg(MPIDI_VC_t * vc, void *hdr, MPIDI_msg_sz_t hdr_s
{
MPID_Request *sreq = NULL;
int mpi_errno = MPI_SUCCESS;
-#if 0
- int ibcom_errno;
- MPID_nem_ib_vc_area *vc_ib = VC_IB(vc);
- int sseq_num;
-#endif
- //uint64_t tscs, tsce;
MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_IB_ISTARTCONTIGMSG);
MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_IB_ISTARTCONTIGMSG);
@@ -730,20 +433,6 @@ int MPID_nem_ib_iStartContigMsg(MPIDI_VC_t * vc, void *hdr, MPIDI_msg_sz_t hdr_s
sreq->dev.OnDataAvail = 0;
//tsce = MPID_nem_ib_rdtsc(); printf("rc,%ld\n", tsce - tscs); // 124.15 cycles
-#if 0
- if (hdr) {
-
- MPIDI_CH3_Pkt_t *pkt = (MPIDI_CH3_Pkt_t *) hdr;
- MPIDI_CH3_Pkt_close_t *close_pkt = &pkt->close;
- dprintf("isend(istartcontig),%d->%d,seq_num=%d,type=%d,ack=%d\n", MPID_nem_ib_myrank,
- vc->pg_rank, vc_ib->ibcom->sseq_num, close_pkt->type, close_pkt->ack);
- }
- else {
- dprintf("isend(istartcontig),%d->%d,seq_num=%d\n", MPID_nem_ib_myrank, vc->pg_rank,
- vc_ib->ibcom->sseq_num);
- }
-#endif
-
mpi_errno = MPID_nem_ib_iSendContig(vc, sreq, hdr, hdr_sz, data, data_sz);
if (mpi_errno) {
MPIU_ERR_POP(mpi_errno);
@@ -795,28 +484,13 @@ static int MPID_nem_ib_SendNoncontig_core(MPIDI_VC_t * vc, MPID_Request * sreq,
data = (void *)REQ_FIELD(sreq, lmt_pack_buf);
data_sz = last;
-#if 0
- if (hdr &&
- ((((MPIDI_CH3_Pkt_t *) hdr)->type == MPIDI_CH3_PKT_PUT)
- || (((MPIDI_CH3_Pkt_t *) hdr)->type == MPIDI_CH3_PKT_GET_RESP)
- || (((MPIDI_CH3_Pkt_t *) hdr)->type == MPIDI_CH3_PKT_ACCUMULATE))) {
-#endif
/* If request length is too long, create LMT packet */
if ( MPID_NEM_IB_NETMOD_HDR_SIZEOF(vc_ib->ibcom->local_ringbuf_type)
+ sizeof(MPIDI_CH3_Pkt_t) + sreq->dev.segment_size - sreq->dev.segment_first
> MPID_NEM_IB_COM_RDMABUF_SZSEG - sizeof(MPID_nem_ib_netmod_trailer_t)) {
pkt_netmod.type = MPIDI_NEM_PKT_NETMOD;
-#if 0
- if (((MPIDI_CH3_Pkt_t *) hdr)->type == MPIDI_CH3_PKT_PUT)
- pkt_netmod.subtype = MPIDI_NEM_IB_PKT_PUT;
- else if (((MPIDI_CH3_Pkt_t *) hdr)->type == MPIDI_CH3_PKT_GET_RESP)
- pkt_netmod.subtype = MPIDI_NEM_IB_PKT_GET_RESP;
- else if (((MPIDI_CH3_Pkt_t *) hdr)->type == MPIDI_CH3_PKT_ACCUMULATE)
- pkt_netmod.subtype = MPIDI_NEM_IB_PKT_ACCUMULATE;
-#else
pkt_netmod.subtype = MPIDI_NEM_IB_PKT_RMA_LMT_RTS;
-#endif
void *write_from_buf = REQ_FIELD(sreq, lmt_pack_buf);
@@ -824,11 +498,6 @@ static int MPID_nem_ib_SendNoncontig_core(MPIDI_VC_t * vc, MPID_Request * sreq,
MPID_nem_ib_com_get_info_conn(vc_ib->sc->fd, MPID_NEM_IB_COM_INFOKEY_PATTR_MAX_MSG_SZ,
&max_msg_sz, sizeof(uint32_t));
-#if 0
- /* RMA : Netmod IB supports only smaller size than max_msg_sz. */
- MPIU_Assert(data_sz <= max_msg_sz);
-#endif
-
MPID_nem_ib_rma_lmt_cookie_t *s_cookie_buf = (MPID_nem_ib_rma_lmt_cookie_t *) MPIU_Malloc(sizeof(MPID_nem_ib_rma_lmt_cookie_t));
sreq->ch.s_cookie = s_cookie_buf;
@@ -862,9 +531,6 @@ static int MPID_nem_ib_SendNoncontig_core(MPIDI_VC_t * vc, MPID_Request * sreq,
int incomplete;
MPIDI_CH3U_Request_increment_cc(sreq, &incomplete); // decrement in drain_scq and pkt_rma_lmt_getdone
}
-#if 0
- }
-#endif
/* packet handlers assume this */
hdr_sz = sizeof(MPIDI_CH3_Pkt_t);
@@ -900,49 +566,9 @@ static int MPID_nem_ib_SendNoncontig_core(MPIDI_VC_t * vc, MPID_Request * sreq,
vc_ib->pending_sends += 1;
sreq->ch.vc = vc; /* used in poll */
-#if 0 /* see contig */
- if (copied) { /* skip poll scq */
- int (*reqFn) (MPIDI_VC_t *, MPID_Request *, int *);
-
- (VC_FIELD(sreq->ch.vc, pending_sends)) -= 1;
-
- /* as in the template */
- reqFn = sreq->dev.OnDataAvail;
- if (!reqFn) {
- /* MPID_Request_release is called in
- * MPI_Wait (in src/mpi/pt2pt/wait.c)
- * MPIR_Wait_impl (in src/mpi/pt2pt/wait.c)
- * MPIR_Request_complete (in /src/mpi/pt2pt/mpir_request.c) */
- int incomplete;
- MPIDI_CH3U_Request_decrement_cc(sreq, &incomplete);
- if (!incomplete) {
- MPIDI_CH3_Progress_signal_completion();
- }
- //dprintf("isendcontig_core,cc_ptr=%d\n", *(sreq->cc_ptr));
- dprintf("sendcontig_core,complete,req=%p,cc incremented to %d\n", sreq,
- MPIDI_CH3I_progress_completion_count.v);
- MPIU_DBG_MSG(CH3_CHANNEL, VERBOSE, ".... complete");
- }
- else {
- MPIDI_VC_t *vc = sreq->ch.vc;
- int complete = 0;
- mpi_errno = reqFn(vc, sreq, &complete);
- if (mpi_errno)
- MPIU_ERR_POP(mpi_errno);
- /* not-completed case is not implemented */
- MPIU_Assert(complete == TRUE);
- MPIU_Assert(0); /* decrement ref_count and free sreq causes problem */
- }
- }
- else {
- MPID_nem_ib_ncqe_nces += 1; /* it has different meaning, counting non-copied eager-short */
- }
-#else
MPID_nem_ib_ncqe_nces += 1; /* it has different meaning, counting non-copied eager-short */
-#endif
#ifndef MPID_NEM_IB_DISABLE_VAR_OCC_NOTIFY_RATE
-#if 1
//dprintf("isendcontig,old rstate=%d\n", vc_ib->ibcom->rdmabuf_occupancy_notify_rstate);
int *notify_rstate;
ibcom_errno =
@@ -966,7 +592,6 @@ static int MPID_nem_ib_SendNoncontig_core(MPIDI_VC_t * vc, MPID_Request * sreq,
}
//dprintf("isendcontig_core,new rstate=%d\n", vc_ib->ibcom->rdmabuf_occupancy_notify_rstate);
#endif
-#endif
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_IB_SENDNONCONTIG_CORE);
return mpi_errno;
@@ -983,10 +608,6 @@ int MPID_nem_ib_SendNoncontig(MPIDI_VC_t * vc, MPID_Request * sreq, void *hdr,
MPIDI_msg_sz_t hdr_sz)
{
int mpi_errno = MPI_SUCCESS;
-#if 0
- int ibcom_errno;
- MPIDI_msg_sz_t last;
-#endif
MPID_nem_ib_vc_area *vc_ib = VC_IB(vc);
MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_IB_SENDNONCONTIG);
@@ -1029,18 +650,6 @@ int MPID_nem_ib_SendNoncontig(MPIDI_VC_t * vc, MPID_Request * sreq, void *hdr,
dprintf("sendnoncontig,%d->%d,sendq_empty=%d,ncom=%d,rdmabuf_occ=%d\n", MPID_nem_ib_myrank,
vc->pg_rank, MPID_nem_ib_sendq_empty(vc_ib->sendq), vc_ib->ibcom->ncom,
MPID_nem_ib_diff16(vc_ib->ibcom->sseq_num, vc_ib->ibcom->lsr_seq_num_tail));
-#if 0
- /* aggressively perform drain_scq */
- /* try to clear the road blocks, i.e. ncom, ncqe */
- if (vc_ib->ibcom->ncom >=
- /*MPID_NEM_IB_COM_MAX_SQ_CAPACITY */ MPID_NEM_IB_COM_MAX_SQ_HEIGHT_DRAIN ||
- MPID_nem_ib_ncqe >=
- /*MPID_NEM_IB_COM_MAX_CQ_CAPACITY */ MPID_NEM_IB_COM_MAX_CQ_HEIGHT_DRAIN) {
- //printf("isendcontig,kick drain_scq\n");
- ibcom_errno = MPID_nem_ib_drain_scq(1); /* set 1st arg to one which means asking it for not calling send_progress because it recursively call isendcontig_core */
- MPIU_ERR_CHKANDJUMP(ibcom_errno, mpi_errno, MPI_ERR_OTHER, "**MPID_nem_ib_drain_scq");
- }
-#endif
/* set it for drain_scq */
MPIDI_Request_set_msg_type(sreq, MPIDI_REQUEST_EAGER_MSG);
@@ -1097,9 +706,6 @@ int MPID_nem_ib_SendNoncontig(MPIDI_VC_t * vc, MPID_Request * sreq, void *hdr,
int MPID_nem_ib_send_progress(MPIDI_VC_t * vc)
{
int mpi_errno = MPI_SUCCESS;
-#if 0
- int ibcom_errno;
-#endif
MPID_nem_ib_vc_area *vc_ib = VC_IB(vc);
MPID_Request *sreq, *prev_sreq;
int req_type, msg_type;
@@ -1126,19 +732,6 @@ int MPID_nem_ib_send_progress(MPIDI_VC_t * vc)
if (sreq) {
prev_sreq = NULL;
do {
-#if 0
- /* aggressively perform drain_scq */
- /* try to clear the road blocks, i.e. ncom, ncqe */
- if (vc_ib->ibcom->ncom >=
- /*MPID_NEM_IB_COM_MAX_SQ_CAPACITY */ MPID_NEM_IB_COM_MAX_SQ_HEIGHT_DRAIN ||
- MPID_nem_ib_ncqe >=
- /*MPID_NEM_IB_COM_MAX_CQ_CAPACITY */ MPID_NEM_IB_COM_MAX_CQ_HEIGHT_DRAIN) {
- dprintf("send_progress,kick drain_scq\n");
- ibcom_errno = MPID_nem_ib_drain_scq(1); /* set 1st arg to one which means asking it for not calling send_progress because it recursively call isendcontig_core */
- MPIU_ERR_CHKANDJUMP(ibcom_errno, mpi_errno, MPI_ERR_OTHER,
- "**MPID_nem_ib_drain_scq");
- }
-#endif
req_type = MPIDI_Request_get_type(sreq);
msg_type = MPIDI_Request_get_msg_type(sreq);
@@ -1257,36 +850,14 @@ int MPID_nem_ib_send_progress(MPIDI_VC_t * vc)
/* send current rsr_seq_num_tail because message from target to initiator
* might have happened while being queued */
case MPIDI_NEM_PKT_LMT_RTS:{
-#if 0
- MPID_nem_ib_lmt_cookie_t *s_cookie_buf =
- (MPID_nem_ib_lmt_cookie_t *) sreq->dev.iov[1].MPID_IOV_BUF;
-#endif
dprintf("send_progress,MPIDI_NEM_PKT_LMT_RTS,rsr_seq_num_tail=%d\n",
vc_ib->ibcom->rsr_seq_num_tail);
-#if 0 /* moving to packet header */
- /* embed RDMA-write-to buffer occupancy information */
- s_cookie_buf->seq_num_tail = vc_ib->ibcom->rsr_seq_num_tail;
- /* remember the last one sent */
- vc_ib->ibcom->rsr_seq_num_tail_last_sent =
- vc_ib->ibcom->rsr_seq_num_tail;
-#endif
break;
}
case MPIDI_NEM_PKT_LMT_CTS:{
-#if 0
- MPID_nem_ib_lmt_cookie_t *s_cookie_buf =
- (MPID_nem_ib_lmt_cookie_t *) sreq->dev.iov[1].MPID_IOV_BUF;
-#endif
dprintf("send_progress,MPIDI_NEM_PKT_LMT_CTS,rsr_seq_num_tail=%d\n",
vc_ib->ibcom->rsr_seq_num_tail);
-#if 0 /* moving to packet header */
- /* embed RDMA-write-to buffer occupancy information */
- s_cookie_buf->seq_num_tail = vc_ib->ibcom->rsr_seq_num_tail;
- /* remember the last one sent */
- vc_ib->ibcom->rsr_seq_num_tail_last_sent =
- vc_ib->ibcom->rsr_seq_num_tail;
-#endif
break;
}
@@ -1298,19 +869,6 @@ int MPID_nem_ib_send_progress(MPIDI_VC_t * vc)
/* send current rsr_seq_num_tail because message from target to initiator
* might have happened while being queued */
case MPIDI_NEM_IB_PKT_LMT_GET_DONE:{
-#if 0
- MPID_nem_ib_pkt_lmt_get_done_t *_done_pkt =
- (MPID_nem_ib_pkt_lmt_get_done_t *) sreq->dev.iov[0].
- MPID_IOV_BUF;
- dprintf
- ("send_progress,MPIDI_NEM_IB_PKT_LMT_GET_DONE,rsr_seq_num_tail=%d\n",
- vc_ib->ibcom->rsr_seq_num_tail);
- /* embed SR occupancy information */
- _done_pkt->seq_num_tail = vc_ib->ibcom->rsr_seq_num_tail;
- /* remember the last one sent */
- vc_ib->ibcom->rsr_seq_num_tail_last_sent =
- vc_ib->ibcom->rsr_seq_num_tail;
-#endif
break;
}
case MPIDI_NEM_IB_PKT_REPLY_SEQ_NUM:{
@@ -1452,12 +1010,6 @@ int MPID_nem_ib_cm_progress()
/* This comparison is OK if the diff is within 63-bit range */
if (MPID_nem_ib_diff63(MPID_nem_ib_progress_engine_vt, sreq->retry_decided) <
sreq->retry_backoff) {
-#if 0
- dprintf("cm_progress,vt=%ld,retry_decided=%ld,diff=%ld,backoff=%ld\n",
- MPID_nem_ib_progress_engine_vt, sreq->retry_decided,
- MPID_nem_ib_diff63(MPID_nem_ib_progress_engine_vt, sreq->retry_decided),
- sreq->retry_backoff);
-#endif
goto next;
}
dprintf
@@ -1488,7 +1040,6 @@ int MPID_nem_ib_cm_progress()
break;
case MPID_NEM_IB_CM_SYN:
if (is_conn_established(sreq->responder_rank)) {
-#if 1
/* Explicitly release CAS word because
* ConnectX-3 doesn't support safe CAS with PCI device and CPU */
MPID_nem_ib_cm_cas_release(MPID_nem_ib_conns[sreq->responder_rank].vc);
@@ -1497,36 +1048,6 @@ int MPID_nem_ib_cm_progress()
sreq->ibcom->outstanding_connection_tx);
is_established = 1;
break;
-#else
- dprintf("cm_progress,syn,switching to cas_release,%d->%d\n",
- MPID_nem_ib_myrank, sreq->responder_rank);
- /* Connection was established while SYN command was enqueued.
- * So we replace SYN with CAS_RELEASE, and send. */
-
- /* override req->type */
- ((MPID_nem_ib_cm_cmd_syn_t *) & sreq->cmd)->type = MPID_NEM_IB_CM_CAS_RELEASE2;
- ((MPID_nem_ib_cm_cmd_syn_t *) & sreq->cmd)->initiator_rank = MPID_nem_ib_myrank;
-
- /* Initiator does not receive SYNACK and ACK2, so we decrement incoming counter here. */
- sreq->ibcom->incoming_connection_tx -= 2;
-
- shadow =
- (MPID_nem_ib_cm_cmd_shadow_t *)
- MPIU_Malloc(sizeof(MPID_nem_ib_cm_cmd_shadow_t));
-
- /* override req->state */
- shadow->type = sreq->state = MPID_NEM_IB_CM_CAS_RELEASE2;
- shadow->req = sreq;
- dprintf("shadow=%p,shadow->req=%p\n", shadow, shadow->req);
- mpi_errno =
- MPID_nem_ib_cm_cmd_core(sreq->responder_rank, shadow,
- (void *) (&sreq->cmd),
- sizeof(MPID_nem_ib_cm_cmd_synack_t), 1 /* syn:1 */ ,
- 0);
- MPIU_ERR_CHKANDJUMP(mpi_errno, mpi_errno, MPI_ERR_OTHER,
- "**MPID_nem_ib_cm_send_core");
-#endif
- break;
}
/* The initiator acqurire slot for the responder when sending syn */
@@ -2225,9 +1746,7 @@ int MPID_nem_ib_ringbuf_ask_cas(MPIDI_VC_t * vc, MPID_nem_ib_ringbuf_req_t * req
/* Ring-buffer is full */
/* Let the guard down so that this ask-fetch can be issued in ringbuf_progress */
-#if 0 /*debug */
- VC_FIELD(vc, ibcom->ask_guard) = 0;
-#endif
+
/* Retry from fetch */
/* Schedule retry */
-----------------------------------------------------------------------
Summary of changes:
.../ch3/channels/nemesis/netmod/ib/ib_finalize.c | 15 +-
src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.c | 401 +-------
src/mpid/ch3/channels/nemesis/netmod/ib/ib_ibcom.h | 8 +-
src/mpid/ch3/channels/nemesis/netmod/ib/ib_impl.h | 81 +-
src/mpid/ch3/channels/nemesis/netmod/ib/ib_init.c | 141 +---
src/mpid/ch3/channels/nemesis/netmod/ib/ib_lmt.c | 127 +--
.../ch3/channels/nemesis/netmod/ib/ib_malloc.c | 12 +-
src/mpid/ch3/channels/nemesis/netmod/ib/ib_poll.c | 1100 +++-----------------
.../ch3/channels/nemesis/netmod/ib/ib_reg_mr.c | 112 +--
src/mpid/ch3/channels/nemesis/netmod/ib/ib_send.c | 773 +++-----------
10 files changed, 438 insertions(+), 2332 deletions(-)
hooks/post-receive
--
MPICH primary repository
More information about the commits
mailing list