[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1rc2-148-g28c7217

mysql vizuser noreply at mpich.org
Thu Jan 9 12:53:18 CST 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  28c721724cacd8c07f27a5aee536829c987eba09 (commit)
      from  4b07ac8ab4ba5203f228348b05a9a2da71f13396 (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/28c721724cacd8c07f27a5aee536829c987eba09

commit 28c721724cacd8c07f27a5aee536829c987eba09
Author: Su Huang <suhuang at us.ibm.com>
Date:   Thu Jan 9 11:59:11 2014 -0500

    PAMID:fix memory leak and BGQ problems
    
    Signed-off-by: Michael Blocksome <blocksom at us.ibm.com>

diff --git a/src/mpid/pamid/src/onesided/mpid_win_accumulate.c b/src/mpid/pamid/src/onesided/mpid_win_accumulate.c
index 7792d8f..2d04091 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_accumulate.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_accumulate.c
@@ -193,6 +193,13 @@ MPID_Accumulate(void         *origin_addr,
   }
 
   req->offset = target_disp * win->mpid.info[target_rank].disp_unit;
+#ifdef __BGQ__
+  /* PAMI limitation as it doesnt permit VA of 0 to be passed into
+   * memregion create, so we must pass base_va of heap computed from
+   * an SPI call instead. So the target offset must be adjusted */
+  if (req->win->create_flavor == MPI_WIN_FLAVOR_DYNAMIC)
+    req->offset -= (size_t)req->win->mpid.info[target_rank].base_addr;
+#endif
 
   if (origin_datatype == MPI_DOUBLE_INT)
     {
diff --git a/src/mpid/pamid/src/onesided/mpid_win_compare_and_swap.c b/src/mpid/pamid/src/onesided/mpid_win_compare_and_swap.c
index 3f7d925..4c52993 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_compare_and_swap.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_compare_and_swap.c
@@ -95,6 +95,13 @@ int MPID_Compare_and_swap(const void *origin_addr, const void *compare_addr,
   req->type         = MPIDI_WIN_REQUEST_COMPARE_AND_SWAP;
 
   req->offset = target_disp * win->mpid.info[target_rank].disp_unit;
+#ifdef __BGQ__
+  /* PAMI limitation as it doesnt permit VA of 0 to be passed into
+   * memregion create, so we must pass base_va of heap computed from
+   * an SPI call instead. So the target offset must be adjusted */
+  if (req->win->create_flavor == MPI_WIN_FLAVOR_DYNAMIC)
+    req->offset -= (size_t)req->win->mpid.info[target_rank].base_addr;
+#endif
 
   MPIDI_Win_datatype_basic(1, datatype, &req->origin.dt);
 
@@ -119,6 +126,10 @@ int MPID_Compare_and_swap(const void *origin_addr, const void *compare_addr,
             base = win->mpid.info[target_rank].base_addr;
             disp_unit = win->disp_unit;
         }
+	else if (win->create_flavor == MPI_WIN_FLAVOR_DYNAMIC) {
+	    base = NULL;
+	    disp_unit = win->disp_unit;
+	}
         else {
             base = win->base;
             disp_unit = win->disp_unit;
@@ -178,10 +189,13 @@ int MPID_Compare_and_swap(const void *origin_addr, const void *compare_addr,
     
   MPI_Op null_op=0;
   pami_data_function  pami_op;
+#ifndef __BGQ__
   if(MPIDI_Datatype_is_pami_rmw_supported(basic_type, &pami_type, null_op, &pami_op)  ) {
       req->pami_datatype = pami_type;
       PAMI_Context_post(MPIDI_Context[0], &req->post_request, MPIDI_Compare_and_swap_using_pami_rmw, req);
-    } else {
+    } else 
+#endif
+      {
       PAMI_Context_post(MPIDI_Context[0], &req->post_request, MPIDI_Atomic, req);
     }
    }
diff --git a/src/mpid/pamid/src/onesided/mpid_win_create_dynamic.c b/src/mpid/pamid/src/onesided/mpid_win_create_dynamic.c
index 74e10ca..4b37f26 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_create_dynamic.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_create_dynamic.c
@@ -52,11 +52,34 @@ MPID_Win_create_dynamic( MPID_Info  * info,
   rc=MPIDI_Win_init(0,1,win_ptr, info, comm_ptr, MPI_WIN_FLAVOR_DYNAMIC, MPI_WIN_UNIFIED);
   win = *win_ptr;
 
-  win->base = MPI_BOTTOM;
   rank = comm_ptr->rank;
+  win->base = MPI_BOTTOM;
   winfo = &win->mpid.info[rank];
   winfo->win = win;
 
+#ifdef __BGQ__
+  void *base = NULL;
+  size_t length = 0;
+  Kernel_MemoryRegion_t memregion;
+  void *tmpbuf = malloc(sizeof(int));
+  Kernel_CreateMemoryRegion(&memregion, tmpbuf, sizeof(int));
+  //Reset base to base VA of local heap
+  base = memregion.BaseVa;
+  length = memregion.Bytes;
+  free(tmpbuf);
+  
+  if (length != 0)
+    {
+      size_t length_out = 0;
+      pami_result_t rc;
+      rc = PAMI_Memregion_create(MPIDI_Context[0], base, length, &length_out, &winfo->memregion);
+      MPID_assert(rc == PAMI_SUCCESS);
+      MPID_assert(length == length_out);
+    }
+  win->base = base;
+  winfo->base_addr = base;  
+#endif
+
   rc= MPIDI_Win_allgather(0,win_ptr);
   if (rc != MPI_SUCCESS)
       return rc;
diff --git a/src/mpid/pamid/src/onesided/mpid_win_fetch_and_op.c b/src/mpid/pamid/src/onesided/mpid_win_fetch_and_op.c
index 9f47b9b..a99a19e 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_fetch_and_op.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_fetch_and_op.c
@@ -229,7 +229,9 @@ int MPID_Fetch_and_op(const void *origin_addr, void *result_addr,
     MPID_assert(basic_type != MPI_DATATYPE_NULL);
 
   if(MPIDI_Datatype_is_pami_rmw_supported(basic_type, &pami_type, op, &pami_op)  ) {
+#ifndef __BGQ__
     good_for_rmw = 1; 
+#endif
   } else {
      if((op == MPI_NO_OP) && (origin_addr == NULL) && (win->create_flavor != MPI_WIN_FLAVOR_SHARED) ) {
         /* essentially a MPI_Get to result buffer */
@@ -244,6 +246,13 @@ int MPID_Fetch_and_op(const void *origin_addr, void *result_addr,
   req->type         = MPIDI_WIN_REQUEST_FETCH_AND_OP;
 
   req->offset = target_disp * win->mpid.info[target_rank].disp_unit;
+#ifdef __BGQ__
+  /* PAMI limitation as it doesnt permit VA of 0 to be passed into
+   * memregion create, so we must pass base_va of heap computed from
+   * an SPI call instead. So the target offset must be adjusted */
+  if (req->win->create_flavor == MPI_WIN_FLAVOR_DYNAMIC)
+    req->offset -= (size_t)req->win->mpid.info[target_rank].base_addr;
+#endif
 
   if (datatype == MPI_DOUBLE_INT)
     {
@@ -300,6 +309,10 @@ int MPID_Fetch_and_op(const void *origin_addr, void *result_addr,
             disp_unit = win->disp_unit;
 
         }
+	else if (win->create_flavor == MPI_WIN_FLAVOR_DYNAMIC) {
+	    base = NULL;
+	    disp_unit = win->disp_unit;
+	}
         else {
             base = win->base;
             disp_unit = win->disp_unit;
diff --git a/src/mpid/pamid/src/onesided/mpid_win_get.c b/src/mpid/pamid/src/onesided/mpid_win_get.c
index b56e2b2..ab341f7 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_get.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_get.c
@@ -236,6 +236,13 @@ MPID_Get(void         *origin_addr,
   }
 
   req->offset = target_disp * win->mpid.info[target_rank].disp_unit;
+#ifdef __BGQ__
+  /* PAMI limitation as it doesnt permit VA of 0 to be passed into
+   * memregion create, so we must pass base_va of heap computed from
+   * an SPI call instead. So the target offset must be adjusted */
+  if (req->win->create_flavor == MPI_WIN_FLAVOR_DYNAMIC)
+    req->offset -= (size_t)req->win->mpid.info[target_rank].base_addr;
+#endif
 
   MPIDI_Win_datatype_basic(origin_count,
                            origin_datatype,
diff --git a/src/mpid/pamid/src/onesided/mpid_win_get_accumulate.c b/src/mpid/pamid/src/onesided/mpid_win_get_accumulate.c
index 8f8d07c..ca93a13 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_get_accumulate.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_get_accumulate.c
@@ -23,10 +23,12 @@
 
 static void 
 MPIDI_Win_GetAccSendAckDoneCB(pami_context_t   context,
-			     void           * _buf,
+			     void           * _info,
 			     pami_result_t    result)
 {
-  MPIU_Free (_buf);
+  MPIDI_Win_GetAccMsgInfo *msginfo = (MPIDI_Win_GetAccMsgInfo *) _info;
+  MPIU_Free(msginfo->tptr);
+  MPIU_Free(msginfo);
 }
 
 static void 
@@ -69,19 +71,18 @@ MPIDI_Win_GetAccumSendAck(pami_context_t   context,
       .dest     = msginfo->src_endpoint,
     },
     .events = {
-       .cookie   = buffer,
+       .cookie   = msginfo,
        .local_fn = MPIDI_Win_GetAccSendAckDoneCB, //cleanup buffer
      },
   };
 
+  msginfo->tptr = buffer;
+
   params.send.data.iov_len    = msginfo->size;
   params.send.data.iov_base   = buffer;
   
   rc = PAMI_Send(context, &params);
   MPID_assert(rc == PAMI_SUCCESS);
-  
-  //free msginfo
-  //MPIU_Free(msginfo);  
 }
 
 void
@@ -148,6 +149,9 @@ MPIDI_Win_GetAccDoneCB(pami_context_t  context,
       if (req->accum_headers)
         MPIU_Free(req->accum_headers);
 
+      MPIDI_Win_datatype_unmap(&req->target.dt);
+      MPIDI_Win_datatype_unmap(&req->result.dt);      
+
       if( req->type != MPIDI_WIN_REQUEST_RGET_ACCUMULATE )
         MPIU_Free(req);
     }
@@ -166,10 +170,10 @@ MPIDI_Win_GetAccAckDoneCB(pami_context_t   context,
     MPIR_Localcopy(req->result.addr,
 		   req->result.count,
 		   req->result.datatype,
-		   msginfo->result_addr,
+		   msginfo->tptr,
 		   msginfo->size,
 		   MPI_CHAR);
-    MPIU_Free(msginfo->result_addr);
+    MPIU_Free(msginfo->tptr);
   }
   MPIU_Free(msginfo);
   
@@ -194,10 +198,10 @@ MPIDI_WinGetAccumAckCB(pami_context_t    context,
   *msginfo = *(const MPIDI_Win_GetAccMsgInfo *)_msginfo;
   MPIDI_Win_request *req = (MPIDI_Win_request *) msginfo->request;
   
-  msginfo->result_addr = NULL;
+  msginfo->tptr = NULL;
   recv->addr = req->result.addr;
   if (req->result_num_contig > 1)
-    recv->addr = msginfo->result_addr = MPIU_Malloc(msginfo->size); 
+    recv->addr = msginfo->tptr = MPIU_Malloc(msginfo->size); 
   
   recv->type        = PAMI_TYPE_BYTE;
   recv->offset      = 0;
@@ -213,7 +217,6 @@ MPIDI_Get_accumulate(pami_context_t   context,
 {
   MPIDI_Win_request *req = (MPIDI_Win_request*)_req;
   pami_result_t rc;
-  void *map;
 
   pami_send_t params = {
     .send = {
@@ -248,15 +251,8 @@ MPIDI_Get_accumulate(pami_context_t   context,
     params.send.data.iov_base   = req->buffer + req->state.local_offset;
 
     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);
@@ -265,9 +261,6 @@ MPIDI_Get_accumulate(pami_context_t   context,
       ++req->state.index;
     }
   }
-
-  MPIDI_Win_datatype_unmap(&req->target.dt);
-
   return PAMI_SUCCESS;
 }
 
diff --git a/src/mpid/pamid/src/onesided/mpid_win_put.c b/src/mpid/pamid/src/onesided/mpid_win_put.c
index 67f9d84..110f294 100644
--- a/src/mpid/pamid/src/onesided/mpid_win_put.c
+++ b/src/mpid/pamid/src/onesided/mpid_win_put.c
@@ -249,6 +249,13 @@ MPID_Put(void         *origin_addr,
   }
 
   req->offset = target_disp * win->mpid.info[target_rank].disp_unit;
+#ifdef __BGQ__
+  /* PAMI limitation as it doesnt permit VA of 0 to be passed into
+   * memregion create, so we must pass base_va of heap computed from
+   * an SPI call instead. So the target offset must be adjusted */
+  if (req->win->create_flavor == MPI_WIN_FLAVOR_DYNAMIC)
+    req->offset -= (size_t)req->win->mpid.info[target_rank].base_addr;
+#endif
 
   MPIDI_Win_datatype_basic(origin_count,
                            origin_datatype,
diff --git a/src/mpid/pamid/src/onesided/mpidi_onesided.h b/src/mpid/pamid/src/onesided/mpidi_onesided.h
index 180aaad..8604bb5 100644
--- a/src/mpid/pamid/src/onesided/mpidi_onesided.h
+++ b/src/mpid/pamid/src/onesided/mpidi_onesided.h
@@ -201,7 +201,7 @@ typedef struct
   int            num_contig;
   int            size;
   void         * request;
-  void         * result_addr;
+  void         * tptr;
   pami_endpoint_t src_endpoint;    
 } MPIDI_Win_GetAccMsgInfo;
 

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

Summary of changes:
 src/mpid/pamid/src/onesided/mpid_win_accumulate.c  |    7 ++++
 .../pamid/src/onesided/mpid_win_compare_and_swap.c |   16 ++++++++-
 .../pamid/src/onesided/mpid_win_create_dynamic.c   |   25 +++++++++++++-
 .../pamid/src/onesided/mpid_win_fetch_and_op.c     |   13 +++++++
 src/mpid/pamid/src/onesided/mpid_win_get.c         |    7 ++++
 .../pamid/src/onesided/mpid_win_get_accumulate.c   |   35 ++++++++------------
 src/mpid/pamid/src/onesided/mpid_win_put.c         |    7 ++++
 src/mpid/pamid/src/onesided/mpidi_onesided.h       |    2 +-
 8 files changed, 88 insertions(+), 24 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list