[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2b3-108-gef34d2c

Service Account noreply at mpich.org
Thu Jun 18 10:24:43 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  ef34d2c9e6e7e1b89e27b1fe9b9e2200105acfa0 (commit)
       via  5df087024c2a39c9e24f88f343c23bb785afbf8b (commit)
       via  3752b556c7110b167d46661821ef0840c779f221 (commit)
       via  306cbd9706d74de513e6aa5cb681db01c786362c (commit)
       via  974942e82b6d428b19235cf36bd327bb5cc54964 (commit)
      from  83253a41423d0f30317f6de93560a6cec8e5a069 (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/ef34d2c9e6e7e1b89e27b1fe9b9e2200105acfa0

commit ef34d2c9e6e7e1b89e27b1fe9b9e2200105acfa0
Author: Ken Raffenetti <raffenet at mcs.anl.gov>
Date:   Wed Jun 17 16:40:57 2015 -0500

    netmod/portals4: build on persistent GET ME design
    
    Encode request handles in unused tag bits, eliminating the need
    for hash table.
    
    Signed-off-by: Antonio Pena Monferrer <apenya at mcs.anl.gov>

diff --git a/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_nm.c b/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_nm.c
index 88e210a..2fd80c4 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_nm.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_nm.c
@@ -23,28 +23,6 @@ static ptl_me_t get_me;
 static ptl_handle_me_t me_handles[NUM_RECV_BUFS];
 static ptl_handle_me_t get_me_handle;
 
-struct pending_gets_st {
-    void *ptr;
-    MPID_Request *req;
-    UT_hash_handle hh;
-};
-static struct pending_gets_st *pending_gets = NULL;
-
-
-#undef FUNCNAME
-#define FUNCNAME find_req
-#undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
-static inline MPID_Request * find_req(void *ptr)
-{
-    struct pending_gets_st *pending_get;
-    MPID_Request *req;
-    HASH_FIND_PTR(pending_gets, &ptr, pending_get);
-    req = pending_get->req;
-    HASH_DEL(pending_gets, pending_get);
-    MPIU_Free(pending_get);
-    return req;
-}
 
 #undef FUNCNAME
 #define FUNCNAME MPID_nem_ptl_nm_init
@@ -64,11 +42,11 @@ int MPID_nem_ptl_nm_init(void)
     overflow_me.ct_handle = PTL_CT_NONE;
     overflow_me.uid = PTL_UID_ANY;
     overflow_me.options = ( PTL_ME_OP_PUT | PTL_ME_MANAGE_LOCAL | PTL_ME_NO_TRUNCATE | PTL_ME_MAY_ALIGN |
-                   PTL_ME_IS_ACCESSIBLE | PTL_ME_EVENT_LINK_DISABLE );
+                            PTL_ME_IS_ACCESSIBLE | PTL_ME_EVENT_LINK_DISABLE );
     overflow_me.match_id.phys.pid = PTL_PID_ANY;
     overflow_me.match_id.phys.nid = PTL_NID_ANY;
-    overflow_me.match_bits = NPTL_MATCH(CTL_TAG, 0, MPI_ANY_SOURCE);
-    overflow_me.ignore_bits = NPTL_MATCH_IGNORE;
+    overflow_me.match_bits = NPTL_MATCH(MPI_ANY_TAG, CTL_TAG, MPI_ANY_SOURCE);
+    overflow_me.ignore_bits = NPTL_MATCH_IGNORE_ANY_TAG;
     overflow_me.min_free = PTL_MAX_EAGER;
 
     /* allocate all overflow space at once */
@@ -91,8 +69,8 @@ int MPID_nem_ptl_nm_init(void)
                        PTL_ME_EVENT_LINK_DISABLE | PTL_ME_EVENT_UNLINK_DISABLE );
     get_me.match_id.phys.pid = PTL_PID_ANY;
     get_me.match_id.phys.nid = PTL_NID_ANY;
-    get_me.match_bits = NPTL_MATCH(GET_TAG, 0, MPI_ANY_SOURCE);
-    get_me.ignore_bits = NPTL_MATCH_IGNORE;
+    get_me.match_bits = NPTL_MATCH(MPI_ANY_TAG, GET_TAG, MPI_ANY_SOURCE);
+    get_me.ignore_bits = NPTL_MATCH_IGNORE_ANY_TAG;
     get_me.min_free = 0;
     ret = PtlMEAppend(MPIDI_nem_ptl_ni, MPIDI_nem_ptl_control_pt, &get_me, PTL_PRIORITY_LIST, NULL,
                       &get_me_handle);
@@ -151,7 +129,7 @@ static inline int send_pkt(MPIDI_VC_t *vc, void *hdr_p, void *data_p, MPIDI_msg_
     const size_t sent_sz = data_sz < (PAYLOAD_SIZE-sreq->dev.ext_hdr_sz) ? data_sz : (PAYLOAD_SIZE-sreq->dev.ext_hdr_sz-sizeof(ptl_size_t));
     const size_t remaining = data_sz - sent_sz;
     const size_t sendbuf_sz = SENDBUF_SIZE(sent_sz+sreq->dev.ext_hdr_sz+(remaining?sizeof(ptl_size_t):0));
-    ptl_match_bits_t match_bits = NPTL_MATCH(CTL_TAG, 0, MPIDI_Process.my_pg_rank);
+    ptl_match_bits_t match_bits = NPTL_MATCH(sreq->handle, CTL_TAG, MPIDI_Process.my_pg_rank);
     MPIDI_STATE_DECL(MPID_STATE_SEND_PKT);
 
     MPIDI_FUNC_ENTER(MPID_STATE_SEND_PKT);
@@ -175,19 +153,11 @@ static inline int send_pkt(MPIDI_VC_t *vc, void *hdr_p, void *data_p, MPIDI_msg_
         MPIU_Memcpy(sendbuf_ptr, data_p, sent_sz);
         sendbuf_ptr += sent_sz;
         if (remaining) {
-            char *tmp_ptr = (char *)data_p + sent_sz;
-            const char *endbuf = tmp_ptr + remaining;
             /* The address/offset for the remote side to do the get is last in the buffer */
             ptl_size_t *offset = (ptl_size_t *)sendbuf_ptr;
-            *offset = (ptl_size_t)tmp_ptr;
-            do {
-                struct pending_gets_st *pending_get = MPIU_Malloc(sizeof(struct pending_gets_st));
-                ++REQ_PTL(sreq)->num_gets;
-                pending_get->ptr = tmp_ptr;
-                pending_get->req = sreq;
-                HASH_ADD_PTR(pending_gets, ptr, pending_get);
-                tmp_ptr += MPIDI_nem_ptl_ni_limits.max_msg_size;
-            } while (tmp_ptr < endbuf);
+            *offset = (ptl_size_t)data_p + sent_sz;
+            REQ_PTL(sreq)->num_gets = remaining / MPIDI_nem_ptl_ni_limits.max_msg_size;
+            if (remaining % MPIDI_nem_ptl_ni_limits.max_msg_size) REQ_PTL(sreq)->num_gets++;
         }
     }
 
@@ -226,7 +196,7 @@ static int send_noncontig_pkt(MPIDI_VC_t *vc, MPID_Request *sreq, void *hdr_p)
     const size_t sent_sz = data_sz < (PAYLOAD_SIZE-sreq->dev.ext_hdr_sz) ? data_sz : (PAYLOAD_SIZE-sreq->dev.ext_hdr_sz-sizeof(ptl_size_t));
     const size_t remaining = data_sz - sent_sz;
     const size_t sendbuf_sz = SENDBUF_SIZE(sent_sz+sreq->dev.ext_hdr_sz+(remaining?sizeof(ptl_size_t):0));
-    ptl_match_bits_t match_bits = NPTL_MATCH(CTL_TAG, 0, MPIDI_Process.my_pg_rank);
+    ptl_match_bits_t match_bits = NPTL_MATCH(sreq->handle, CTL_TAG, MPIDI_Process.my_pg_rank);
     MPIDI_STATE_DECL(MPID_STATE_SEND_NONCONTIG_PKT);
     MPIDI_FUNC_ENTER(MPID_STATE_SEND_NONCONTIG_PKT);
 
@@ -252,25 +222,16 @@ static int send_noncontig_pkt(MPIDI_VC_t *vc, MPID_Request *sreq, void *hdr_p)
         sendbuf_ptr += sent_sz;
 
         if (remaining) {  /* Post MEs for the remote gets */
-            char *tmp_ptr, *endbuf;
             ptl_size_t *offset = (ptl_size_t *)sendbuf_ptr;
             TMPBUF(sreq) = MPIU_Malloc(remaining);
-            tmp_ptr = TMPBUF(sreq);
-            endbuf = (char *)TMPBUF(sreq) + remaining;
             *offset = (ptl_size_t)TMPBUF(sreq);
             first = last;
             last = sreq->dev.segment_size;
             MPID_Segment_pack(sreq->dev.segment_ptr, first, &last, TMPBUF(sreq));
             MPIU_Assert(last == sreq->dev.segment_size);
 
-            do {
-                struct pending_gets_st *pending_get = MPIU_Malloc(sizeof(struct pending_gets_st));
-                ++REQ_PTL(sreq)->num_gets;
-                pending_get->ptr = tmp_ptr;
-                pending_get->req = sreq;
-                HASH_ADD_PTR(pending_gets, ptr, pending_get);
-                tmp_ptr += MPIDI_nem_ptl_ni_limits.max_msg_size;
-            } while (tmp_ptr < endbuf);
+            REQ_PTL(sreq)->num_gets = remaining / MPIDI_nem_ptl_ni_limits.max_msg_size;
+            if (remaining % MPIDI_nem_ptl_ni_limits.max_msg_size) REQ_PTL(sreq)->num_gets++;
         }
     }
 
@@ -426,6 +387,7 @@ int MPID_nem_ptl_nm_ctl_event_handler(const ptl_event_t *e)
             MPID_nem_ptl_vc_area * vc_ptl;
             ptl_size_t remaining = NPTL_HEADER_GET_LENGTH(e->hdr_data);
             ptl_me_t search_me;
+            MPI_Request sender_req_id = NPTL_MATCH_GET_TAG(e->match_bits);
 
             MPIDI_PG_Get_vc(MPIDI_Process.my_pg, NPTL_MATCH_GET_RANK(e->match_bits), &vc);
             vc_ptl = VC_PTL(vc);
@@ -458,13 +420,13 @@ int MPID_nem_ptl_nm_ctl_event_handler(const ptl_event_t *e)
                 do {
                     MPIDI_CH3U_Request_increment_cc(req, &incomplete);  /* Will be decremented - and eventually freed in REPLY */
                     ret = MPID_nem_ptl_rptl_get(MPIDI_nem_ptl_global_md, (ptl_size_t)buf_ptr,
-                                                size, vc_ptl->id, vc_ptl->ptc, NPTL_MATCH(GET_TAG, 0, MPIDI_Process.my_pg_rank), target_offset, req);
+                                                size, vc_ptl->id, vc_ptl->ptc, NPTL_MATCH(sender_req_id, GET_TAG, MPIDI_Process.my_pg_rank), target_offset, req);
                     MPIU_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlget", "**ptlget %s",
                                          MPID_nem_ptl_strerror(ret));
                     MPIU_DBG_MSG_FMT(CH3_CHANNEL, VERBOSE, (MPIU_DBG_FDEST,
                                                             "PtlGet(size=%lu id=(%#x,%#x) pt=%#x tag=%d)", size,
                                                             vc_ptl->id.phys.nid,
-                                                            vc_ptl->id.phys.pid, vc_ptl->ptc, GET_TAG));
+                                                            vc_ptl->id.phys.pid, vc_ptl->ptc, sender_req_id));
                     buf_ptr += size;
                     remaining -= size;
                     target_offset += size;
@@ -485,8 +447,10 @@ int MPID_nem_ptl_nm_ctl_event_handler(const ptl_event_t *e)
 
     case PTL_EVENT_GET:
         {
-            MPID_Request *const req = find_req(e->start);
+            MPI_Request handle = NPTL_MATCH_GET_TAG(e->match_bits);
+            MPID_Request *req = NULL;
 
+            MPID_Request_get_ptr(handle, req);
             if (--REQ_PTL(req)->num_gets == 0) {
                 MPIU_Free(TMPBUF(req));
                 if (REQ_PTL(req)->put_done)

http://git.mpich.org/mpich.git/commitdiff/5df087024c2a39c9e24f88f343c23bb785afbf8b

commit 5df087024c2a39c9e24f88f343c23bb785afbf8b
Author: Antonio Pena Monferrer <apenya at mcs.anl.gov>
Date:   Tue Jun 16 23:45:18 2015 -0500

    netmod/portals4: Use persistent ME in RMA
    
    rma/manyget was failing because we reached the maximum number of MEs
    allowed: we were posting an ME for every remote get. This patch
    implements a single persistent ME instead for the remote gets.
    
    Fixes #2264
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_nm.c b/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_nm.c
index 0f106c4..88e210a 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_nm.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_nm.c
@@ -19,7 +19,32 @@
 
 static char *recvbufs;
 static ptl_me_t overflow_me;
+static ptl_me_t get_me;
 static ptl_handle_me_t me_handles[NUM_RECV_BUFS];
+static ptl_handle_me_t get_me_handle;
+
+struct pending_gets_st {
+    void *ptr;
+    MPID_Request *req;
+    UT_hash_handle hh;
+};
+static struct pending_gets_st *pending_gets = NULL;
+
+
+#undef FUNCNAME
+#define FUNCNAME find_req
+#undef FCNAME
+#define FCNAME MPIU_QUOTE(FUNCNAME)
+static inline MPID_Request * find_req(void *ptr)
+{
+    struct pending_gets_st *pending_get;
+    MPID_Request *req;
+    HASH_FIND_PTR(pending_gets, &ptr, pending_get);
+    req = pending_get->req;
+    HASH_DEL(pending_gets, pending_get);
+    MPIU_Free(pending_get);
+    return req;
+}
 
 #undef FUNCNAME
 #define FUNCNAME MPID_nem_ptl_nm_init
@@ -57,6 +82,22 @@ int MPID_nem_ptl_nm_init(void)
                              MPID_nem_ptl_strerror(ret));
     }
 
+    /* register persistent ME for GET operations */
+    get_me.start = NULL;
+    get_me.length = PTL_SIZE_MAX;
+    get_me.ct_handle = PTL_CT_NONE;
+    get_me.uid = PTL_UID_ANY;
+    get_me.options = ( PTL_ME_OP_GET | PTL_ME_IS_ACCESSIBLE | PTL_ME_NO_TRUNCATE |
+                       PTL_ME_EVENT_LINK_DISABLE | PTL_ME_EVENT_UNLINK_DISABLE );
+    get_me.match_id.phys.pid = PTL_PID_ANY;
+    get_me.match_id.phys.nid = PTL_NID_ANY;
+    get_me.match_bits = NPTL_MATCH(GET_TAG, 0, MPI_ANY_SOURCE);
+    get_me.ignore_bits = NPTL_MATCH_IGNORE;
+    get_me.min_free = 0;
+    ret = PtlMEAppend(MPIDI_nem_ptl_ni, MPIDI_nem_ptl_control_pt, &get_me, PTL_PRIORITY_LIST, NULL,
+                      &get_me_handle);
+    MPIU_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlmeappend", "**ptlmeappend %s", MPID_nem_ptl_strerror(ret));
+
  fn_exit:
     MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_PTL_NM_INIT);
     return mpi_errno;
@@ -83,6 +124,10 @@ int MPID_nem_ptl_nm_finalize(void)
                              MPID_nem_ptl_strerror(ret));
     }
 
+    ret = PtlMEUnlink(get_me_handle);
+    MPIU_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlmeunlink", "**ptlmeunlink %s",
+                         MPID_nem_ptl_strerror(ret));
+
     MPIU_Free(recvbufs);
 
  fn_exit:
@@ -93,55 +138,6 @@ int MPID_nem_ptl_nm_finalize(void)
 }
 
 #undef FUNCNAME
-#define FUNCNAME meappend_large
-#undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
-static inline int meappend_large(ptl_process_t id, MPID_Request *req, ptl_match_bits_t match_bits, void *buf, size_t remaining)
-{
-    int mpi_errno = MPI_SUCCESS;
-    int ret;
-    ptl_me_t me;
-    MPIDI_STATE_DECL(MPID_STATE_MEAPPEND_LARGE);
-
-    MPIDI_FUNC_ENTER(MPID_STATE_MEAPPEND_LARGE);
-
-    me.start = buf;
-    me.length = remaining < MPIDI_nem_ptl_ni_limits.max_msg_size ?
-                    remaining : MPIDI_nem_ptl_ni_limits.max_msg_size;
-    me.ct_handle = PTL_CT_NONE;
-    me.uid = PTL_UID_ANY;
-    me.options = ( PTL_ME_OP_GET | PTL_ME_USE_ONCE | PTL_ME_IS_ACCESSIBLE |
-                   PTL_ME_EVENT_LINK_DISABLE | PTL_ME_EVENT_UNLINK_DISABLE );
-    me.match_id = id;
-    me.match_bits = match_bits;
-    me.ignore_bits = NPTL_MATCH_IGNORE;
-    me.min_free = 0;
-
-    while (remaining) {
-        ptl_handle_me_t foo_me_handle;
-
-        ++REQ_PTL(req)->num_gets;
-
-        ret = PtlMEAppend(MPIDI_nem_ptl_ni, MPIDI_nem_ptl_control_pt, &me, PTL_PRIORITY_LIST, req,
-                          &foo_me_handle);
-        MPIU_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlmeappend", "**ptlmeappend %s",
-                             MPID_nem_ptl_strerror(ret));
-        MPIU_DBG_MSG_FMT(CH3_CHANNEL, VERBOSE, (MPIU_DBG_FDEST, "PtlMEAppend(req=%p tag=%#lx)", req, NPTL_MATCH_GET_TAG(match_bits)));
-
-        me.start = (char *)me.start + me.length;
-        remaining -= me.length;
-        if (remaining < MPIDI_nem_ptl_ni_limits.max_msg_size)
-            me.length = remaining;
-    }
-
- fn_exit:
-    MPIDI_FUNC_EXIT(MPID_STATE_MEAPPEND_LARGE);
-    return mpi_errno;
- fn_fail:
-    goto fn_exit;
-}
-
-#undef FUNCNAME
 #define FUNCNAME send_pkt
 #undef FCNAME
 #define FCNAME MPIU_QUOTE(FUNCNAME)
@@ -151,10 +147,10 @@ static inline int send_pkt(MPIDI_VC_t *vc, void *hdr_p, void *data_p, MPIDI_msg_
     int mpi_errno = MPI_SUCCESS;
     MPID_nem_ptl_vc_area *const vc_ptl = VC_PTL(vc);
     int ret;
-    char *sendbuf;
-    const size_t sent_sz = data_sz < (PAYLOAD_SIZE-sreq->dev.ext_hdr_sz) ? data_sz : (PAYLOAD_SIZE-sreq->dev.ext_hdr_sz);
-    const size_t sendbuf_sz = SENDBUF_SIZE(sent_sz+sreq->dev.ext_hdr_sz);
+    char *sendbuf, *sendbuf_ptr;
+    const size_t sent_sz = data_sz < (PAYLOAD_SIZE-sreq->dev.ext_hdr_sz) ? data_sz : (PAYLOAD_SIZE-sreq->dev.ext_hdr_sz-sizeof(ptl_size_t));
     const size_t remaining = data_sz - sent_sz;
+    const size_t sendbuf_sz = SENDBUF_SIZE(sent_sz+sreq->dev.ext_hdr_sz+(remaining?sizeof(ptl_size_t):0));
     ptl_match_bits_t match_bits = NPTL_MATCH(CTL_TAG, 0, MPIDI_Process.my_pg_rank);
     MPIDI_STATE_DECL(MPID_STATE_SEND_PKT);
 
@@ -163,11 +159,12 @@ static inline int send_pkt(MPIDI_VC_t *vc, void *hdr_p, void *data_p, MPIDI_msg_
     sendbuf = MPIU_Malloc(sendbuf_sz);
     MPIU_Assert(sendbuf != NULL);
     MPIU_Memcpy(sendbuf, hdr_p, sizeof(MPIDI_CH3_Pkt_t));
+    sendbuf_ptr = sendbuf + sizeof(MPIDI_CH3_Pkt_t);
 
     if (sreq->dev.ext_hdr_sz > 0) {
         /* copy extended packet header to send buf */
-        MPIU_Memcpy(sendbuf + sizeof(MPIDI_CH3_Pkt_t),
-                    sreq->dev.ext_hdr_ptr, sreq->dev.ext_hdr_sz);
+        MPIU_Memcpy(sendbuf_ptr, sreq->dev.ext_hdr_ptr, sreq->dev.ext_hdr_sz);
+        sendbuf_ptr += sreq->dev.ext_hdr_sz;
     }
 
     TMPBUF(sreq) = NULL;
@@ -175,12 +172,23 @@ static inline int send_pkt(MPIDI_VC_t *vc, void *hdr_p, void *data_p, MPIDI_msg_
     REQ_PTL(sreq)->put_done = 0;
 
     if (data_sz) {
-        MPIU_Memcpy(sendbuf + sizeof(MPIDI_CH3_Pkt_t) + sreq->dev.ext_hdr_sz, data_p, sent_sz);
-        if (remaining)  /* Post MEs for the remote gets */
-            mpi_errno = meappend_large(vc_ptl->id, sreq, NPTL_MATCH(GET_TAG, 0, MPIDI_Process.my_pg_rank),
-                                       (char *)data_p + sent_sz, remaining);
-            if (mpi_errno)
-                goto fn_fail;
+        MPIU_Memcpy(sendbuf_ptr, data_p, sent_sz);
+        sendbuf_ptr += sent_sz;
+        if (remaining) {
+            char *tmp_ptr = (char *)data_p + sent_sz;
+            const char *endbuf = tmp_ptr + remaining;
+            /* The address/offset for the remote side to do the get is last in the buffer */
+            ptl_size_t *offset = (ptl_size_t *)sendbuf_ptr;
+            *offset = (ptl_size_t)tmp_ptr;
+            do {
+                struct pending_gets_st *pending_get = MPIU_Malloc(sizeof(struct pending_gets_st));
+                ++REQ_PTL(sreq)->num_gets;
+                pending_get->ptr = tmp_ptr;
+                pending_get->req = sreq;
+                HASH_ADD_PTR(pending_gets, ptr, pending_get);
+                tmp_ptr += MPIDI_nem_ptl_ni_limits.max_msg_size;
+            } while (tmp_ptr < endbuf);
+        }
     }
 
     SENDBUF(sreq) = sendbuf;
@@ -213,11 +221,11 @@ static int send_noncontig_pkt(MPIDI_VC_t *vc, MPID_Request *sreq, void *hdr_p)
     int mpi_errno = MPI_SUCCESS;
     MPID_nem_ptl_vc_area *const vc_ptl = VC_PTL(vc);
     int ret;
-    char *sendbuf;
+    char *sendbuf, *sendbuf_ptr;
     const size_t data_sz = sreq->dev.segment_size - sreq->dev.segment_first;
-    const size_t sent_sz = data_sz < (PAYLOAD_SIZE-sreq->dev.ext_hdr_sz) ? data_sz : (PAYLOAD_SIZE-sreq->dev.ext_hdr_sz);
-    const size_t sendbuf_sz = SENDBUF_SIZE(sent_sz+sreq->dev.ext_hdr_sz);
+    const size_t sent_sz = data_sz < (PAYLOAD_SIZE-sreq->dev.ext_hdr_sz) ? data_sz : (PAYLOAD_SIZE-sreq->dev.ext_hdr_sz-sizeof(ptl_size_t));
     const size_t remaining = data_sz - sent_sz;
+    const size_t sendbuf_sz = SENDBUF_SIZE(sent_sz+sreq->dev.ext_hdr_sz+(remaining?sizeof(ptl_size_t):0));
     ptl_match_bits_t match_bits = NPTL_MATCH(CTL_TAG, 0, MPIDI_Process.my_pg_rank);
     MPIDI_STATE_DECL(MPID_STATE_SEND_NONCONTIG_PKT);
     MPIDI_FUNC_ENTER(MPID_STATE_SEND_NONCONTIG_PKT);
@@ -225,11 +233,12 @@ static int send_noncontig_pkt(MPIDI_VC_t *vc, MPID_Request *sreq, void *hdr_p)
     sendbuf = MPIU_Malloc(sendbuf_sz);
     MPIU_Assert(sendbuf != NULL);
     MPIU_Memcpy(sendbuf, hdr_p, sizeof(MPIDI_CH3_Pkt_t));
+    sendbuf_ptr = sendbuf + sizeof(MPIDI_CH3_Pkt_t);
 
     if (sreq->dev.ext_hdr_sz > 0) {
         /* copy extended packet header to send buf */
-        MPIU_Memcpy(sendbuf + sizeof(MPIDI_CH3_Pkt_t),
-                    sreq->dev.ext_hdr_ptr, sreq->dev.ext_hdr_sz);
+        MPIU_Memcpy(sendbuf_ptr, sreq->dev.ext_hdr_ptr, sreq->dev.ext_hdr_sz);
+        sendbuf_ptr += sreq->dev.ext_hdr_sz;
     }
 
     TMPBUF(sreq) = NULL;
@@ -239,18 +248,29 @@ static int send_noncontig_pkt(MPIDI_VC_t *vc, MPID_Request *sreq, void *hdr_p)
     if (data_sz) {
         MPIDI_msg_sz_t first = sreq->dev.segment_first;
         MPIDI_msg_sz_t last = sreq->dev.segment_first + sent_sz;
-        MPID_Segment_pack(sreq->dev.segment_ptr, first, &last, sendbuf + sizeof(MPIDI_CH3_Pkt_t) + sreq->dev.ext_hdr_sz);
+        MPID_Segment_pack(sreq->dev.segment_ptr, first, &last, sendbuf_ptr);
+        sendbuf_ptr += sent_sz;
 
         if (remaining) {  /* Post MEs for the remote gets */
+            char *tmp_ptr, *endbuf;
+            ptl_size_t *offset = (ptl_size_t *)sendbuf_ptr;
             TMPBUF(sreq) = MPIU_Malloc(remaining);
+            tmp_ptr = TMPBUF(sreq);
+            endbuf = (char *)TMPBUF(sreq) + remaining;
+            *offset = (ptl_size_t)TMPBUF(sreq);
             first = last;
             last = sreq->dev.segment_size;
             MPID_Segment_pack(sreq->dev.segment_ptr, first, &last, TMPBUF(sreq));
             MPIU_Assert(last == sreq->dev.segment_size);
 
-            mpi_errno = meappend_large(vc_ptl->id, sreq, NPTL_MATCH(GET_TAG, 0, MPIDI_Process.my_pg_rank), TMPBUF(sreq), remaining);
-            if (mpi_errno)
-                goto fn_fail;
+            do {
+                struct pending_gets_st *pending_get = MPIU_Malloc(sizeof(struct pending_gets_st));
+                ++REQ_PTL(sreq)->num_gets;
+                pending_get->ptr = tmp_ptr;
+                pending_get->req = sreq;
+                HASH_ADD_PTR(pending_gets, ptr, pending_get);
+                tmp_ptr += MPIDI_nem_ptl_ni_limits.max_msg_size;
+            } while (tmp_ptr < endbuf);
         }
     }
 
@@ -419,12 +439,13 @@ int MPID_nem_ptl_nm_ctl_event_handler(const ptl_event_t *e)
                 int incomplete;
                 size_t size;
                 char *buf_ptr;
+                ptl_size_t target_offset;
 
                 MPID_Request *req = MPID_Request_create();
                 MPIU_Assert(req != NULL);
                 MPIDI_CH3U_Request_decrement_cc(req, &incomplete);  /* We'll increment it below */
                 REQ_PTL(req)->event_handler = MPID_nem_ptl_nm_ctl_event_handler;
-                REQ_PTL(req)->bytes_put = packet_sz + remaining;
+                REQ_PTL(req)->bytes_put = packet_sz + remaining - sizeof(ptl_size_t);
                 TMPBUF(req) = MPIU_Malloc(REQ_PTL(req)->bytes_put);
                 MPIU_Assert(TMPBUF(req) != NULL);
                 MPIU_Memcpy(TMPBUF(req), e->start, packet_sz);
@@ -432,11 +453,12 @@ int MPID_nem_ptl_nm_ctl_event_handler(const ptl_event_t *e)
                 req->ch.vc = vc;
 
                 size = remaining < MPIDI_nem_ptl_ni_limits.max_msg_size ? remaining : MPIDI_nem_ptl_ni_limits.max_msg_size;
-                buf_ptr = (char *)TMPBUF(req) + packet_sz;
-                while (remaining) {
+                buf_ptr = (char *)TMPBUF(req) + packet_sz - sizeof(ptl_size_t);
+                target_offset = *((ptl_size_t *)buf_ptr);
+                do {
                     MPIDI_CH3U_Request_increment_cc(req, &incomplete);  /* Will be decremented - and eventually freed in REPLY */
                     ret = MPID_nem_ptl_rptl_get(MPIDI_nem_ptl_global_md, (ptl_size_t)buf_ptr,
-                                                size, vc_ptl->id, vc_ptl->ptc, NPTL_MATCH(GET_TAG, 0, MPIDI_Process.my_pg_rank), 0, req);
+                                                size, vc_ptl->id, vc_ptl->ptc, NPTL_MATCH(GET_TAG, 0, MPIDI_Process.my_pg_rank), target_offset, req);
                     MPIU_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlget", "**ptlget %s",
                                          MPID_nem_ptl_strerror(ret));
                     MPIU_DBG_MSG_FMT(CH3_CHANNEL, VERBOSE, (MPIU_DBG_FDEST,
@@ -445,9 +467,10 @@ int MPID_nem_ptl_nm_ctl_event_handler(const ptl_event_t *e)
                                                             vc_ptl->id.phys.pid, vc_ptl->ptc, GET_TAG));
                     buf_ptr += size;
                     remaining -= size;
+                    target_offset += size;
                     if (remaining < MPIDI_nem_ptl_ni_limits.max_msg_size)
                         size = remaining;
-                }
+                } while (remaining);
             }
 
             /* FIXME: this search/delete not be necessary if we set PTL_ME_UNEXPECTED_HDR_DISABLE
@@ -462,7 +485,7 @@ int MPID_nem_ptl_nm_ctl_event_handler(const ptl_event_t *e)
 
     case PTL_EVENT_GET:
         {
-            MPID_Request *const req = e->user_ptr;
+            MPID_Request *const req = find_req(e->start);
 
             if (--REQ_PTL(req)->num_gets == 0) {
                 MPIU_Free(TMPBUF(req));

http://git.mpich.org/mpich.git/commitdiff/3752b556c7110b167d46661821ef0840c779f221

commit 3752b556c7110b167d46661821ef0840c779f221
Author: Ken Raffenetti <raffenet at mcs.anl.gov>
Date:   Mon Jun 15 16:41:49 2015 -0500

    netmod/portals4: cleanup usage of unused variable
    
    Signed-off-by: Antonio J. Pena <apenya at mcs.anl.gov>

diff --git a/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_send.c b/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_send.c
index 5d71929..5c3d03f 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_send.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_send.c
@@ -48,7 +48,6 @@ static void big_meappend(void *buf, ptl_size_t left_to_send, MPIDI_VC_t *vc, ptl
         /* increment the cc for each get operation */
         MPIDI_CH3U_Request_increment_cc(sreq, &was_incomplete);
         MPIU_Assert(was_incomplete);
-        REQ_PTL(sreq)->num_gets++;
 
         /* account for what has been sent */
         me.start = (char *)me.start + me.length;
@@ -275,7 +274,6 @@ static int send_msg(ptl_hdr_data_t ssend_flag, struct MPIDI_VC *vc, const void *
                 /* increment the cc for the get operation */
                 MPIDI_CH3U_Request_increment_cc(sreq, &was_incomplete);
                 MPIU_Assert(was_incomplete);
-                REQ_PTL(sreq)->num_gets = 1;
 
                 /* Create MD for first chunk */
                 md.start = sreq->dev.iov;

http://git.mpich.org/mpich.git/commitdiff/306cbd9706d74de513e6aa5cb681db01c786362c

commit 306cbd9706d74de513e6aa5cb681db01c786362c
Author: Ken Raffenetti <raffenet at mcs.anl.gov>
Date:   Tue Jun 16 16:29:13 2015 -0500

    netmod/portals4: remove packing utility functions
    
    MPID_Segment_pack/unpack should be all we need to manipulate noncontig
    messages. Not sure why these were originally included.
    
    Signed-off-by: Antonio J. Pena <apenya at mcs.anl.gov>

diff --git a/src/mpid/ch3/channels/nemesis/netmod/portals4/Makefile.mk b/src/mpid/ch3/channels/nemesis/netmod/portals4/Makefile.mk
index 764e821..8237dc2 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/portals4/Makefile.mk
+++ b/src/mpid/ch3/channels/nemesis/netmod/portals4/Makefile.mk
@@ -9,7 +9,6 @@ if BUILD_NEMESIS_NETMOD_PORTALS4
 
 mpi_core_sources +=					\
     src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_init.c		\
-    src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_pack_byte.c	\
     src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_poll.c		\
     src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_probe.c		\
     src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_recv.c		\
diff --git a/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_impl.h b/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_impl.h
index 0e136c7..92b840e 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_impl.h
+++ b/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_impl.h
@@ -64,7 +64,6 @@ static inline MPID_nem_ptl_req_area * REQ_PTL(MPID_Request *req) {
 #define MPID_nem_ptl_init_req(req_) do {                        \
         int i;                                                  \
         for (i = 0; i < MPID_NEM_PTL_NUM_CHUNK_BUFFERS; ++i) {  \
-            REQ_PTL(req_)->overflow[i].len  = 0;                \
             REQ_PTL(req_)->chunk_buffer[i] = NULL;              \
         }                                                       \
         REQ_PTL(req_)->large         = FALSE;                   \
diff --git a/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_pack_byte.c b/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_pack_byte.c
deleted file mode 100644
index ccb93bd..0000000
--- a/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_pack_byte.c
+++ /dev/null
@@ -1,141 +0,0 @@
-
-
-
-/* -*- Mode: C; c-basic-offset:4 ; -*- */
-/*
- *  (C) 2012 by Argonne National Laboratory.
- *      See COPYRIGHT in top-level directory.
- */
-
-#include "ptl_impl.h"
-
-
-#undef FUNCNAME
-#define FUNCNAME MPI_nem_ptl_pack_byte
-#undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
-void MPI_nem_ptl_pack_byte(MPID_Segment *segment, MPI_Aint first, MPI_Aint last, void *buf,
-                           MPID_nem_ptl_pack_overflow_t *overflow)
-{
-    MPI_Aint my_last;
-    MPI_Aint bytes;
-    char *end;
-    MPIDI_STATE_DECL(MPID_STATE_MPI_NEM_PTL_PACK_BYTE);
-
-    MPIDI_FUNC_ENTER(MPID_STATE_MPI_NEM_PTL_PACK_BYTE);
-
-    /* first copy out of overflow buffer */
-    if (overflow->len) {
-        if (overflow->len <= last-first) {
-            MPIU_Memcpy(buf, &overflow->buf[overflow->offset], overflow->len);
-            first += overflow->len;
-            buf = (char *)buf + overflow->len;
-            overflow->len = 0;
-            if (last == first)
-                goto fn_exit;
-        } else {
-            MPIU_Memcpy(buf, &overflow->buf[overflow->offset], last-first);
-            overflow->offset += overflow->len - (last-first);
-            overflow->len -= last-first;
-            goto fn_exit;
-        }
-    }
-
-    /* unpack as much as we can into buf */
-    my_last = last;
-    MPID_Segment_pack(segment, first, &my_last, buf);
-    
-    if (my_last == last)
-        /* buf is completely filled */
-        goto fn_exit;
-
-    /* remember where the unfilled section starts and how large it is */
-    end = &((char *)buf)[my_last-first];
-    bytes = last - my_last;
-
-    /* unpack some into the overflow */
-    first = my_last;
-    my_last += sizeof(overflow->buf);
-    MPID_Segment_pack(segment, first, &my_last, overflow->buf);
-    MPIU_Assert(my_last - first);
-    
-    /* fill in the rest of buf */
-    MPIU_Memcpy(end, overflow->buf, bytes);
-
-    /* save the beginning of the offset buffer and its length */
-    overflow->offset = bytes;
-    overflow->len = my_last-first - bytes;
-
- fn_exit:
-    MPIDI_FUNC_EXIT(MPID_STATE_MPI_NEM_PTL_PACK_BYTE);
-    return;
-}
-
-/* MPID_nem_ptl_unpack_byte -- this function unpacks a contig buffer handling
-   the case where there are bytes left in the buffer that are less than a basic
-   datatype.  Those bytes are copied into an overflow buffer so that the next
-   time unpack_byte is called they can be "prepended" to that buffer before
-   doing a segment_unpack.  Note, that means that after calling unpack_byte,
-   the last few bytes may not have been copied into the target buffer. */
-#undef FUNCNAME
-#define FUNCNAME MPID_nem_ptl_unpack_byte
-#undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
-int MPID_nem_ptl_unpack_byte(MPID_Segment *segment, MPI_Aint first, MPI_Aint last, void *buf,
-                             MPID_nem_ptl_pack_overflow_t *overflow)
-{
-    int mpi_errno = MPI_SUCCESS;
-    MPI_Aint my_last;
-    MPI_Aint bytes;
-    MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_PTL_UNPACK_BYTE);
-
-    MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_PTL_UNPACK_BYTE);
-
-    if (overflow->len) {
-        /* if there is data in the overflow buffer, then we already know that
-           it's too small to unpack with this datatype, so we return an error */
-        MPIU_ERR_CHKANDJUMP(overflow->len >= last-first, mpi_errno, MPI_ERR_OTHER, "**dtypemismatch");
-
-        /* bytes is the number of additional bytes to copy into the overflow buffer */
-        bytes = sizeof(overflow->buf) - overflow->len;
-        if (bytes > last-first)
-            bytes = last-first;
-
-        MPIU_Memcpy(overflow->buf + overflow->len, buf, bytes);
-
-        /* Now there are (overflow->len + bytes) bytes in the overflow buffer.
-           We try to unpack as many as we can */
-        my_last = first + overflow->len + bytes;
-        MPID_Segment_unpack(segment, first, &my_last, buf);
-
-        /* we update the buf pointer to the  */
-        buf = ((char *)buf) + my_last-first - overflow->len;
-        first = my_last;
-
-        overflow->len = 0;
-    }
-
-    if (first == last)
-        goto fn_exit;
-
-    my_last = last;
-    MPID_Segment_unpack(segment, first, &my_last, buf);
-
-    if (my_last == last)
-        /* buf has been completely unpacked */
-        goto fn_exit;
-
-    bytes = last - my_last;
-    
-    /* copy remaining bytes int overflow buffer */
-    MPIU_Memcpy(overflow->buf, &((char *)buf)[my_last-first], bytes);
-
-    overflow->offset = 0;
-    overflow->len = bytes;
-
- fn_exit:
-    MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_PTL_UNPACK_BYTE);
-    return mpi_errno;
- fn_fail:
-    goto fn_exit;
-}
diff --git a/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_recv.c b/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_recv.c
index fcc6184..357630c 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_recv.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_recv.c
@@ -210,6 +210,8 @@ static int handler_recv_unpack_complete(const ptl_event_t *e)
     int mpi_errno = MPI_SUCCESS;
     MPID_Request *const rreq = e->user_ptr;
     void *buf;
+    MPI_Aint last;
+
     MPIDI_STATE_DECL(MPID_STATE_HANDLER_RECV_UNPACK_COMPLETE);
 
     MPIDI_FUNC_ENTER(MPID_STATE_HANDLER_RECV_UNPACK_COMPLETE);
@@ -221,10 +223,9 @@ static int handler_recv_unpack_complete(const ptl_event_t *e)
     else
         buf = REQ_PTL(rreq)->chunk_buffer[0];
 
-    mpi_errno = MPID_nem_ptl_unpack_byte(rreq->dev.segment_ptr, rreq->dev.segment_first,
-                                         rreq->dev.segment_first + e->mlength, buf,
-                                         &REQ_PTL(rreq)->overflow[0]);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    last = rreq->dev.segment_first + e->mlength;
+    MPID_Segment_unpack(rreq->dev.segment_ptr, rreq->dev.segment_first, &last, buf);
+    MPIU_Assert(last == rreq->dev.segment_first + e->mlength);
     
     mpi_errno = handler_recv_complete(e);
     if (mpi_errno) MPIU_ERR_POP(mpi_errno);

http://git.mpich.org/mpich.git/commitdiff/974942e82b6d428b19235cf36bd327bb5cc54964

commit 974942e82b6d428b19235cf36bd327bb5cc54964
Author: Ken Raffenetti <raffenet at mcs.anl.gov>
Date:   Mon Jun 15 15:06:45 2015 -0500

    netmod/portals4: use separate EQ for flow control handling
    
    Because we don't drain the EQs in the event of flow control, we need
    to use a dedicated EQ for messages related to pausing and unpausing
    communication. These messages are all consumed by the Rportals layer,
    the user will never see anything.
    
    Signed-off-by: Antonio J. Pena <apenya at mcs.anl.gov>

diff --git a/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_init.c b/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_init.c
index b29475c..1d308df 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_init.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_init.c
@@ -37,6 +37,7 @@ ptl_handle_eq_t MPIDI_nem_ptl_eq;
 ptl_handle_eq_t MPIDI_nem_ptl_get_eq;
 ptl_handle_eq_t MPIDI_nem_ptl_control_eq;
 ptl_handle_eq_t MPIDI_nem_ptl_origin_eq;
+ptl_handle_eq_t MPIDI_nem_ptl_rpt_eq;
 ptl_pt_index_t  MPIDI_nem_ptl_control_rpt_pt; /* portal for rportals control messages */
 ptl_pt_index_t  MPIDI_nem_ptl_get_rpt_pt; /* portal for rportals control messages */
 ptl_handle_md_t MPIDI_nem_ptl_global_md;
@@ -204,6 +205,9 @@ static int ptl_init(MPIDI_PG_t *pg_p, int pg_rank, char **bc_val_p, int *val_max
     ret = PtlEQAlloc(MPIDI_nem_ptl_ni, EVENT_COUNT, &MPIDI_nem_ptl_control_eq);
     MPIU_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptleqalloc", "**ptleqalloc %s", MPID_nem_ptl_strerror(ret));
 
+    ret = PtlEQAlloc(MPIDI_nem_ptl_ni, EVENT_COUNT, &MPIDI_nem_ptl_rpt_eq);
+    MPIU_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptleqalloc", "**ptleqalloc %s", MPID_nem_ptl_strerror(ret));
+
     /* allocate a separate EQ for origin events. with this, we can implement rate-limit operations
        to prevent a locally triggered flow control even */
     ret = PtlEQAlloc(MPIDI_nem_ptl_ni, EVENT_COUNT, &MPIDI_nem_ptl_origin_eq);
@@ -225,17 +229,17 @@ static int ptl_init(MPIDI_PG_t *pg_p, int pg_rank, char **bc_val_p, int *val_max
     MPIU_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlptalloc", "**ptlptalloc %s", MPID_nem_ptl_strerror(ret));
 
     /* allocate portal for MPICH control messages */
-    ret = PtlPTAlloc(MPIDI_nem_ptl_ni, PTL_PT_ONLY_USE_ONCE | PTL_PT_ONLY_TRUNCATE | PTL_PT_FLOWCTRL, MPIDI_nem_ptl_eq,
+    ret = PtlPTAlloc(MPIDI_nem_ptl_ni, PTL_PT_ONLY_USE_ONCE | PTL_PT_ONLY_TRUNCATE | PTL_PT_FLOWCTRL, MPIDI_nem_ptl_rpt_eq,
                      PTL_PT_ANY, &MPIDI_nem_ptl_rpt_pt);
     MPIU_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlptalloc", "**ptlptalloc %s", MPID_nem_ptl_strerror(ret));
 
     /* allocate portal for MPICH control messages */
-    ret = PtlPTAlloc(MPIDI_nem_ptl_ni, PTL_PT_ONLY_USE_ONCE | PTL_PT_ONLY_TRUNCATE | PTL_PT_FLOWCTRL, MPIDI_nem_ptl_get_eq,
+    ret = PtlPTAlloc(MPIDI_nem_ptl_ni, PTL_PT_ONLY_USE_ONCE | PTL_PT_ONLY_TRUNCATE | PTL_PT_FLOWCTRL, MPIDI_nem_ptl_rpt_eq,
                      PTL_PT_ANY, &MPIDI_nem_ptl_get_rpt_pt);
     MPIU_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlptalloc", "**ptlptalloc %s", MPID_nem_ptl_strerror(ret));
 
     /* allocate portal for MPICH control messages */
-    ret = PtlPTAlloc(MPIDI_nem_ptl_ni, PTL_PT_ONLY_USE_ONCE | PTL_PT_ONLY_TRUNCATE | PTL_PT_FLOWCTRL, MPIDI_nem_ptl_control_eq,
+    ret = PtlPTAlloc(MPIDI_nem_ptl_ni, PTL_PT_ONLY_USE_ONCE | PTL_PT_ONLY_TRUNCATE | PTL_PT_FLOWCTRL, MPIDI_nem_ptl_rpt_eq,
                      PTL_PT_ANY, &MPIDI_nem_ptl_control_rpt_pt);
     MPIU_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlptalloc", "**ptlptalloc %s", MPID_nem_ptl_strerror(ret));
 
@@ -293,7 +297,7 @@ static int ptl_finalize(void)
 {
     int mpi_errno = MPI_SUCCESS;
     int ret;
-    ptl_handle_eq_t eqs[4];
+    ptl_handle_eq_t eqs[5];
     MPIDI_STATE_DECL(MPID_STATE_PTL_FINALIZE);
     MPIDI_FUNC_ENTER(MPID_STATE_PTL_FINALIZE);
 
@@ -309,7 +313,8 @@ static int ptl_finalize(void)
     eqs[1] = MPIDI_nem_ptl_get_eq;
     eqs[2] = MPIDI_nem_ptl_control_eq;
     eqs[3] = MPIDI_nem_ptl_origin_eq;
-    ret = MPID_nem_ptl_rptl_drain_eq(4, eqs);
+    eqs[4] = MPIDI_nem_ptl_rpt_eq;
+    ret = MPID_nem_ptl_rptl_drain_eq(5, eqs);
     MPIU_ERR_CHKANDJUMP1(ret, mpi_errno, MPI_ERR_OTHER, "**ptlptfree", "**ptlptfree %s", MPID_nem_ptl_strerror(ret));
 
     ret = MPID_nem_ptl_rptl_ptfini(MPIDI_nem_ptl_pt);
diff --git a/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_poll.c b/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_poll.c
index a94eb8a..1ba997e 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_poll.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_poll.c
@@ -134,6 +134,10 @@ int MPID_nem_ptl_poll(int is_blocking_poll)
     while (1) {
         int ctl_event = FALSE;
 
+        /* Check the rptls EQ first. It should never return an event. */
+        ret = MPID_nem_ptl_rptl_eqget(MPIDI_nem_ptl_rpt_eq, &event);
+        MPIU_Assert(ret == PTL_EQ_EMPTY);
+
         /* check EQs for events */
         ret = MPID_nem_ptl_rptl_eqget(MPIDI_nem_ptl_eq, &event);
         MPIU_ERR_CHKANDJUMP(ret == PTL_EQ_DROPPED, mpi_errno, MPI_ERR_OTHER, "**eqdropped");

-----------------------------------------------------------------------

Summary of changes:
 .../channels/nemesis/netmod/portals4/Makefile.mk   |    1 -
 .../channels/nemesis/netmod/portals4/ptl_impl.h    |    1 -
 .../channels/nemesis/netmod/portals4/ptl_init.c    |   15 ++-
 .../ch3/channels/nemesis/netmod/portals4/ptl_nm.c  |  149 +++++++++-----------
 .../nemesis/netmod/portals4/ptl_pack_byte.c        |  141 ------------------
 .../channels/nemesis/netmod/portals4/ptl_poll.c    |    4 +
 .../channels/nemesis/netmod/portals4/ptl_recv.c    |    9 +-
 .../channels/nemesis/netmod/portals4/ptl_send.c    |    2 -
 8 files changed, 87 insertions(+), 235 deletions(-)
 delete mode 100644 src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_pack_byte.c


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list