[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1-195-g2487b73

Service Account noreply at mpich.org
Wed Apr 30 11:42:03 CDT 2014


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  2487b73e5e9b5160d75035d57e745827aaf3564b (commit)
       via  d2fadf793bf3cef2710ab681efeac91f29e4021d (commit)
       via  6bef671154acff90af4d40c8095ba333aa12eb30 (commit)
      from  a00839739260055c6d2373f41e2a0c53abf679d1 (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/2487b73e5e9b5160d75035d57e745827aaf3564b

commit 2487b73e5e9b5160d75035d57e745827aaf3564b
Author: Su Huang <suhuang at us.ibm.com>
Date:   Wed Apr 23 23:19:22 2014 -0400

    pamid: mapped datatypes needed to be unmapped
    
    for one-sided communication, the completion of a local operation is when
    the completion handler of the operation is activated. The datatype
    associated with the operation can not be freed until the completion
    handler is activated which is MPIDI_Win_DoneCB. In the current code, the
    mapped datatype is unmapped immediately freed after the routine gets the
    control from PAMI calls. The calls could be PAMI_Send, PAMI_Get, PAMI_Rget,
    PAMI_Put and PAMI_Rget. Please note that the datatype is needed for PAMI
    to process the data.
    
    The fix is to unmap the datatype in MPIDI_Win_DoneCB() and remove all
    "unmap" datatype operations from put and get operations.
    
    Signed-off-by: Michael Blocksome <blocksom at us.ibm.com>

diff --git a/src/mpid/pamid/src/onesided/mpid_1s.c b/src/mpid/pamid/src/onesided/mpid_1s.c
index 0f504ff..447530b 100644
--- a/src/mpid/pamid/src/onesided/mpid_1s.c
+++ b/src/mpid/pamid/src/onesided/mpid_1s.c
@@ -43,9 +43,6 @@ MPIDI_Win_DoneCB(pami_context_t  context,
                                      req->origin.count,
                                      req->origin.datatype);
           MPID_assert(mpi_errno == MPI_SUCCESS);
-#ifndef USE_PAMI_RDMA
-          MPIDI_Win_datatype_unmap(&req->target.dt);
-#endif
           MPID_Datatype_release(req->origin.dt.pointer);
           MPIU_Free(req->buffer);
           MPIU_Free(req->user_buffer);
@@ -66,6 +63,7 @@ MPIDI_Win_DoneCB(pami_context_t  context,
           MPIU_Free(req->user_buffer);
           req->buffer_free = 0;
       }
+      MPIDI_Win_datatype_unmap(&req->target.dt);
       if (req->accum_headers)
           MPIU_Free(req->accum_headers);
       if (!((req->type > MPIDI_WIN_REQUEST_GET_ACCUMULATE) && (req->type <=MPIDI_WIN_REQUEST_RGET_ACCUMULATE)))
diff --git a/src/mpid/pamid/src/onesided/mpid_win_accumulate.c b/src/mpid/pamid/src/onesided/mpid_win_accumulate.c
index 714852f..2ab1f14 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_accumulate.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_accumulate.c
@@ -108,14 +108,8 @@ MPIDI_Accumulate(pami_context_t   context,
 	will not change till that RMA has completed. In the meanwhile
 	the rest of the RMAs will have memory leaks */
       if (req->target.dt.num_contig - req->state.index == 1) {
-          map=NULL;
-          if (req->target.dt.map != &req->target.dt.__map) {
-              map=(void *) req->target.dt.map;
-          }
           rc = PAMI_Send(context, &params);
           MPID_assert(rc == PAMI_SUCCESS);
-          if (map)
-              MPIU_Free(map);
           return PAMI_SUCCESS;
       } else {
           rc = PAMI_Send(context, &params);
@@ -125,7 +119,6 @@ MPIDI_Accumulate(pami_context_t   context,
       }
   }
 
-  MPIDI_Win_datatype_unmap(&req->target.dt);
 
   return PAMI_SUCCESS;
 }
diff --git a/src/mpid/pamid/src/onesided/mpid_win_get.c b/src/mpid/pamid/src/onesided/mpid_win_get.c
index f731e48..e3d9885 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_get.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_get.c
@@ -24,11 +24,11 @@
 
 
 static inline int
-MPIDI_Get_use_pami_rget(pami_context_t context, MPIDI_Win_request * req, int *freed)
+MPIDI_Get_use_pami_rget(pami_context_t context, MPIDI_Win_request * req)
 __attribute__((__always_inline__));
 #ifdef RDMA_FAILOVER
 static inline int
-MPIDI_Get_use_pami_get(pami_context_t context, MPIDI_Win_request * req, int *freed)
+MPIDI_Get_use_pami_get(pami_context_t context, MPIDI_Win_request * req)
 __attribute__((__always_inline__));
 #endif
 
@@ -38,17 +38,16 @@ MPIDI_Get(pami_context_t   context,
 {
   MPIDI_Win_request *req = (MPIDI_Win_request*)_req;
   pami_result_t rc;
-  int  freed=0;
 
 #ifdef USE_PAMI_RDMA
-  rc = MPIDI_Get_use_pami_rget(context,req,&freed);
+  rc = MPIDI_Get_use_pami_rget(context,req);
 #else
   if( (req->origin.memregion_used) &&
       (req->win->mpid.info[req->target.rank].memregion_used) )
     {
-      rc = MPIDI_Get_use_pami_rget(context,req,&freed);
+      rc = MPIDI_Get_use_pami_rget(context,req);
     } else {
-      rc = MPIDI_Get_use_pami_get(context,req,&freed);
+      rc = MPIDI_Get_use_pami_get(context,req);
     }
 #endif
   if(rc == PAMI_EAGAIN)
@@ -59,10 +58,9 @@ MPIDI_Get(pami_context_t   context,
 
 
 static inline int
-MPIDI_Get_use_pami_rget(pami_context_t context, MPIDI_Win_request * req, int *freed)
+MPIDI_Get_use_pami_rget(pami_context_t context, MPIDI_Win_request * req)
 {
   pami_result_t rc;
-  void  *map=NULL;
   pami_rget_simple_t  params;
 
   params=zero_rget_parms;
@@ -102,15 +100,8 @@ MPIDI_Get_use_pami_rget(pami_context_t context, MPIDI_Win_request * req, int *fr
 	will not change till that RMA has completed. In the meanwhile
 	the rest of the RMAs will have memory leaks */
     if (req->target.dt.num_contig - req->state.index == 1) {
-          map=NULL;
-          if (req->target.dt.map != &req->target.dt.__map) {
-              map=(void *) req->target.dt.map;
-          }
           rc = PAMI_Rget(context, &params);
           MPID_assert(rc == PAMI_SUCCESS);
-          if (map)
-              MPIU_Free(map);
-          *freed=1;
           return PAMI_SUCCESS;
       } else {
           rc = PAMI_Rget(context, &params);
@@ -125,10 +116,9 @@ MPIDI_Get_use_pami_rget(pami_context_t context, MPIDI_Win_request * req, int *fr
 
 #ifdef RDMA_FAILOVER
 static inline int
-MPIDI_Get_use_pami_get(pami_context_t context, MPIDI_Win_request * req, int *freed)
+MPIDI_Get_use_pami_get(pami_context_t context, MPIDI_Win_request * req)
 {
   pami_result_t rc;
-  void  *map=NULL;
   pami_get_simple_t params;
 
   params=zero_get_parms;
diff --git a/src/mpid/pamid/src/onesided/mpid_win_put.c b/src/mpid/pamid/src/onesided/mpid_win_put.c
index 5c4a1ff..a552fa0 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_put.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_put.c
@@ -24,11 +24,11 @@
 
 
 static inline int
-MPIDI_Put_use_pami_rput(pami_context_t context, MPIDI_Win_request * req,int *freed)
+MPIDI_Put_use_pami_rput(pami_context_t context, MPIDI_Win_request * req)
 __attribute__((__always_inline__));
 #ifdef RDMA_FAILOVER
 static inline int
-MPIDI_Put_use_pami_put(pami_context_t   context, MPIDI_Win_request * req,int *freed)
+MPIDI_Put_use_pami_put(pami_context_t   context, MPIDI_Win_request * req)
 __attribute__((__always_inline__));
 #endif
 
@@ -39,33 +39,29 @@ MPIDI_Put(pami_context_t   context,
 {
   MPIDI_Win_request *req = (MPIDI_Win_request*)_req;
   pami_result_t rc;
-  int   freed=0;
 
 #ifdef USE_PAMI_RDMA
-  rc = MPIDI_Put_use_pami_rput(context, req, &freed);
+  rc = MPIDI_Put_use_pami_rput(context, req);
 #else
   if( (req->origin.memregion_used) && (req->win->mpid.info[req->target.rank].memregion_used) )
     {
-      rc = MPIDI_Put_use_pami_rput(context, req, &freed);
+      rc = MPIDI_Put_use_pami_rput(context, req);
     } else {
-      rc = MPIDI_Put_use_pami_put(context, req, &freed);
+      rc = MPIDI_Put_use_pami_put(context, req);
     }
 #endif
   if( rc == PAMI_EAGAIN)
     return rc;
 
-  if (!freed)
-      MPIDI_Win_datatype_unmap(&req->target.dt);
 
   return PAMI_SUCCESS;
 }
 
 
 static inline int
-MPIDI_Put_use_pami_rput(pami_context_t context, MPIDI_Win_request * req,int *freed)
+MPIDI_Put_use_pami_rput(pami_context_t context, MPIDI_Win_request * req)
 {
   pami_result_t rc;
-  void  *map;
   pami_rput_simple_t params;
   /* params need to zero out to avoid passing garbage to PAMI */
   params=zero_rput_parms;
@@ -107,16 +103,8 @@ MPIDI_Put_use_pami_rput(pami_context_t context, MPIDI_Win_request * req,int *fre
 	will not change till that RMA has completed. In the meanwhile
 	the rest of the RMAs will have memory leaks */
     if (req->target.dt.num_contig - req->state.index == 1) {
-         map=NULL;
-         if (req->target.dt.map != &req->target.dt.__map) {
-             map=(void *) req->target.dt.map;
-         }
          rc = PAMI_Rput(context, &params);
          MPID_assert(rc == PAMI_SUCCESS);
-         if (map) {
-             MPIU_Free(map);
-         }
-         *freed=1;
          return PAMI_SUCCESS;
     } else {
           rc = PAMI_Rput(context, &params);
@@ -130,10 +118,9 @@ MPIDI_Put_use_pami_rput(pami_context_t context, MPIDI_Win_request * req,int *fre
 
 #ifdef RDMA_FAILOVER
 static inline int
-MPIDI_Put_use_pami_put(pami_context_t   context, MPIDI_Win_request * req,int *freed)
+MPIDI_Put_use_pami_put(pami_context_t   context, MPIDI_Win_request * req)
 {
   pami_result_t rc;
-  void  *map;
   pami_put_simple_t params;
 
   params = zero_put_parms;
@@ -176,16 +163,8 @@ MPIDI_Put_use_pami_put(pami_context_t   context, MPIDI_Win_request * req,int *fr
 	will not change till that RMA has completed. In the meanwhile
 	the rest of the RMAs will have memory leaks */
     if (req->target.dt.num_contig - req->state.index == 1) {
-        map=NULL;
-        if (req->target.dt.map != &req->target.dt.__map) {
-            map=(void *) req->target.dt.map;
-        }
         rc = PAMI_Put(context, &params);
         MPID_assert(rc == PAMI_SUCCESS);
-        if (map) {
-            MPIU_Free(map);
-        }
-        *freed=1;
         return PAMI_SUCCESS;
     } else {
         rc = PAMI_Put(context, &params);

http://git.mpich.org/mpich.git/commitdiff/d2fadf793bf3cef2710ab681efeac91f29e4021d

commit d2fadf793bf3cef2710ab681efeac91f29e4021d
Author: Su Huang <suhuang at us.ibm.com>
Date:   Thu Apr 24 04:33:53 2014 -0400

    pamid: fix a bug in MPID_Win_free
    
    MPID_Win_allocated_shared(), the routine could obtain memory space via either
    shmget() or MPIU_Malloc() if one task on a node. In MPID_Win_free(), the
    routine only frees shared memory space.
    
    The fix is to free none-shared space if there is one.
    
    Signed-off-by: Michael Blocksome <blocksom at us.ibm.com>

diff --git a/src/mpid/pamid/src/onesided/mpid_win_free.c b/src/mpid/pamid/src/onesided/mpid_win_free.c
index 1c5a7ec..b09fe6c 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_free.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_free.c
@@ -53,6 +53,8 @@ int MPIDI_SHM_Win_free(MPID_Win **win_ptr)
 	rc=shmctl((*win_ptr)->mpid.shm->shm_id,IPC_RMID,NULL);
 	MPIU_ERR_CHKANDJUMP((rc == -1), errno,MPI_ERR_RMA_SHARED, "**shmctl");
     }
+  } else {/* one task on a node */
+    MPIU_Free((*win_ptr)->base);
   }
   MPIU_Free((*win_ptr)->mpid.shm);
   (*win_ptr)->mpid.shm = NULL;

http://git.mpich.org/mpich.git/commitdiff/6bef671154acff90af4d40c8095ba333aa12eb30

commit 6bef671154acff90af4d40c8095ba333aa12eb30
Author: Su Huang <suhuang at us.ibm.com>
Date:   Thu Apr 24 03:50:06 2014 -0400

    pamid: memory leak on handles for request based RMA operations
    
    Request based RMA communication operations require that each operation
    allocates a communication request object and associates it with the request
    handle (the argument request) that can be used to wait or test for
    completion. Both the structures for the request handle and the window
    structure are not being freed. The problem is when the request handle
    is created, the ref_count of the object is set to 2. When
    MPID_Request_releas_inline() is called by a request based RMA operation,
    the ref_count of the handle is decremented to 1. The allocated memory spaces
    are freed only if ref_count is equal to 0.
    
    To fix the problem, set the ref_count to 1 when the request handle is
    created. In MPID_Request_release_inline, the routine decrements the
    ref_count to 0 which leads the memory space be freed.
    
    Signed-off-by: Michael Blocksome <blocksom at us.ibm.com>

diff --git a/src/mpid/pamid/src/mpid_request.h b/src/mpid/pamid/src/mpid_request.h
index 389a8b5..a9fb6de 100644
--- a/src/mpid/pamid/src/mpid_request.h
+++ b/src/mpid/pamid/src/mpid_request.h
@@ -244,6 +244,15 @@ MPIDI_Request_create2()
   return req;
 }
 
+static inline MPID_Request *
+MPIDI_Request_create1()
+{
+  MPID_Request * req;
+  req = MPID_Request_create();
+  MPIU_Object_set_ref(req, 1);
+
+  return req;
+}
 
 /**
  * \brief Mark a request as cancel-pending
diff --git a/src/mpid/pamid/src/onesided/mpid_win_reqops.c b/src/mpid/pamid/src/onesided/mpid_win_reqops.c
index 15ac4e4..6e597c5 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_reqops.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_reqops.c
@@ -58,7 +58,7 @@ MPID_Rput(const void  *origin_addr,
                           return mpi_errno, "**rmasync");
     }
   
-    MPID_Request *rreq = MPIDI_Request_create2();
+    MPID_Request *rreq = MPIDI_Request_create1();
     *request = rreq;
     rreq->kind = MPID_WIN_REQUEST;
     win->mpid.rreq = rreq;
@@ -110,7 +110,7 @@ MPID_Rget(void         *origin_addr,
                           return mpi_errno, "**rmasync");
     }
 
-    MPID_Request *rreq = MPIDI_Request_create2();
+    MPID_Request *rreq = MPIDI_Request_create1();
     rreq->kind = MPID_WIN_REQUEST;
     *request = rreq;
     win->mpid.rreq = rreq;
@@ -169,7 +169,7 @@ MPID_Raccumulate(const void  *origin_addr,
                           return mpi_errno, "**rmasync");
     }
 
-    MPID_Request *rreq = MPIDI_Request_create2();
+    MPID_Request *rreq = MPIDI_Request_create1();
     rreq->kind = MPID_WIN_REQUEST;
     *request = rreq;
     win->mpid.rreq = rreq;
@@ -234,7 +234,7 @@ MPID_Rget_accumulate(const void         *origin_addr,
                           return mpi_errno, "**rmasync");
     }
 
-    MPID_Request *rreq = MPIDI_Request_create2();
+    MPID_Request *rreq = MPIDI_Request_create1();
     rreq->kind = MPID_WIN_REQUEST;
     *request = rreq;
     win->mpid.rreq = rreq;

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

Summary of changes:
 src/mpid/pamid/src/mpid_request.h                 |    9 +++++
 src/mpid/pamid/src/onesided/mpid_1s.c             |    4 +--
 src/mpid/pamid/src/onesided/mpid_win_accumulate.c |    7 ----
 src/mpid/pamid/src/onesided/mpid_win_free.c       |    2 +
 src/mpid/pamid/src/onesided/mpid_win_get.c        |   24 ++++----------
 src/mpid/pamid/src/onesided/mpid_win_put.c        |   35 ++++----------------
 src/mpid/pamid/src/onesided/mpid_win_reqops.c     |    8 ++--
 7 files changed, 30 insertions(+), 59 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list