[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2a1-19-g04a01da

Service Account noreply at mpich.org
Tue Sep 23 10:10:05 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  04a01da2240f956fcd43b42bef9c46ae89010f97 (commit)
       via  7418944673507d4fd3d3025e9e5ecfde809e9210 (commit)
      from  c2c30a614da6bb4a9c2a39e9cf9bc3246e6ac3e8 (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/04a01da2240f956fcd43b42bef9c46ae89010f97

commit 04a01da2240f956fcd43b42bef9c46ae89010f97
Author: Xin Zhao <xinzhao3 at illinois.edu>
Date:   Mon Sep 22 12:42:01 2014 -0500

    Pass tail pointer to MPL single direction linked-list API.
    
    Pass tail pointer to single direction linked-list API so that
    we optimize CONCAT and APPEND operations from O(N) to O(1).
    
    Note that we do not need MPL_LL_APPEND_VS2008 anymore because
    we no longer need to work around temporary variable. Similiarly,
    we can support MPL_LL_CONCAT for VS2008 now.
    
    Signed-off-by: Pavan Balaji <balaji at 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 bd3ee25..1934ce6 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_nm.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/portals4/ptl_nm.c
@@ -24,6 +24,7 @@ typedef struct MPID_nem_ptl_sendbuf {
 
 static MPID_nem_ptl_sendbuf_t sendbuf[NUM_SEND_BUFS];
 static MPID_nem_ptl_sendbuf_t *free_head = NULL;
+static MPID_nem_ptl_sendbuf_t *free_tail = NULL;
 
 static char recvbuf[BUFLEN][NUM_RECV_BUFS];
 static ptl_me_t recvbuf_me[NUM_RECV_BUFS];
@@ -31,8 +32,8 @@ static ptl_handle_me_t recvbuf_me_handle[NUM_RECV_BUFS];
 
 #define FREE_EMPTY() (free_head == NULL)
 #define FREE_HEAD() free_head
-#define FREE_PUSH(buf_p) MPL_LL_PREPEND(free_head, buf_p)
-#define FREE_POP(buf_pp) do { *(buf_pp) = free_head; MPL_LL_DELETE(free_head, free_head); } while (0)
+#define FREE_PUSH(buf_p) MPL_LL_PREPEND(free_head, free_tail, buf_p)
+#define FREE_POP(buf_pp) do { *(buf_pp) = free_head; MPL_LL_DELETE(free_head, free_tail, free_head); } while (0)
 
 static struct {MPID_Request *head, *tail;} send_queue;
 
diff --git a/src/mpid/ch3/src/ch3u_comm.c b/src/mpid/ch3/src/ch3u_comm.c
index fc3278a..b0e10c3 100644
--- a/src/mpid/ch3/src/ch3u_comm.c
+++ b/src/mpid/ch3/src/ch3u_comm.c
@@ -45,8 +45,10 @@ typedef struct hook_elt
     struct hook_elt *next;
 } hook_elt;
 
-static hook_elt *create_hooks = NULL;
-static hook_elt *destroy_hooks = NULL;
+static hook_elt *create_hooks_head = NULL;
+static hook_elt *destroy_hooks_head = NULL;
+static hook_elt *create_hooks_tail = NULL;
+static hook_elt *destroy_hooks_tail = NULL;
 
 #undef FUNCNAME
 #define FUNCNAME MPIDI_CH3U_Comm_init
@@ -98,7 +100,7 @@ int MPIDI_CH3I_Comm_create_hook(MPID_Comm *comm)
 
     MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3U_COMM_CREATE_HOOK);
 
-    MPL_LL_FOREACH(create_hooks, elt) {
+    MPL_LL_FOREACH(create_hooks_head, elt) {
         mpi_errno = elt->hook_fn(comm, elt->param);
         if (mpi_errno) MPIU_ERR_POP(mpi_errno);;
     }
@@ -122,7 +124,7 @@ int MPIDI_CH3I_Comm_destroy_hook(MPID_Comm *comm)
 
     MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3U_COMM_DESTROY_HOOK);
 
-    MPL_LL_FOREACH(destroy_hooks, elt) {
+    MPL_LL_FOREACH(destroy_hooks_head, elt) {
         mpi_errno = elt->hook_fn(comm, elt->param);
         if (mpi_errno) MPIU_ERR_POP(mpi_errno);
     }
@@ -153,7 +155,7 @@ int MPIDI_CH3U_Comm_register_create_hook(int (*hook_fn)(struct MPID_Comm *, void
     elt->hook_fn = hook_fn;
     elt->param = param;
     
-    MPL_LL_PREPEND(create_hooks, elt);
+    MPL_LL_PREPEND(create_hooks_head, create_hooks_tail, elt);
 
  fn_exit:
     MPIU_CHKPMEM_COMMIT();
@@ -182,7 +184,7 @@ int MPIDI_CH3U_Comm_register_destroy_hook(int (*hook_fn)(struct MPID_Comm *, voi
     elt->hook_fn = hook_fn;
     elt->param = param;
     
-    MPL_LL_PREPEND(destroy_hooks, elt);
+    MPL_LL_PREPEND(destroy_hooks_head, destroy_hooks_tail, elt);
 
  fn_exit:
     MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3U_COMM_REGISTER_DESTROY_HOOK);
@@ -204,13 +206,13 @@ static int register_hook_finalize(void *param)
 
     MPIDI_FUNC_ENTER(MPID_STATE_REGISTER_HOOK_FINALIZE);
 
-    MPL_LL_FOREACH_SAFE(create_hooks, elt, tmp) {
-        MPL_LL_DELETE(create_hooks, elt);
+    MPL_LL_FOREACH_SAFE(create_hooks_head, elt, tmp) {
+        MPL_LL_DELETE(create_hooks_head, create_hooks_tail, elt);
         MPIU_Free(elt);
     }
     
-    MPL_LL_FOREACH_SAFE(destroy_hooks, elt, tmp) {
-        MPL_LL_DELETE(destroy_hooks, elt);
+    MPL_LL_FOREACH_SAFE(destroy_hooks_head, elt, tmp) {
+        MPL_LL_DELETE(destroy_hooks_head, destroy_hooks_tail, elt);
         MPIU_Free(elt);
     }
 
diff --git a/src/mpl/include/mpl_utlist.h b/src/mpl/include/mpl_utlist.h
index 1f4e8a9..cadc0b0 100644
--- a/src/mpl/include/mpl_utlist.h
+++ b/src/mpl/include/mpl_utlist.h
@@ -326,46 +326,48 @@ do {
 /******************************************************************************
  * singly linked list macros (non-circular)                                   *
  *****************************************************************************/
-#define MPL_LL_PREPEND(head,add) MPL_LL_PREPEND_N(head,add,next)
-#define MPL_LL_PREPEND_N(head,add,_next)                                                       \
+#define MPL_LL_PREPEND(head,tail,add) MPL_LL_PREPEND_N(head,tail,add,next)
+#define MPL_LL_PREPEND_N(head,tail,add,_next)                                                  \
 do {                                                                                           \
   (add)->_next = head;                                                                         \
   head = add;                                                                                  \
+  if ((add)->_next == NULL)                                                                    \
+    (tail) = (add);                                                                            \
 } while (0)
 
-#define MPL_LL_CONCAT(head1,head2) MPL_LL_CONCAT_N(head1,head2,next)
-#define MPL_LL_CONCAT_N(head1,head2,_next)                                                     \
+#define MPL_LL_CONCAT(head1,head2,tail1,tail2) MPL_LL_CONCAT_N(head1,head2,tail1,tail2,next)
+#define MPL_LL_CONCAT_N(head1,head2,tail1,tail2,_next)                                         \
 do {                                                                                           \
-  MPL_LDECLTYPE(head1) _tmp;                                                                   \
-  if (head1) {                                                                                 \
-    _tmp = head1;                                                                              \
-    while (_tmp->_next) { _tmp = _tmp->_next; }                                                \
-    _tmp->_next=(head2);                                                                       \
+  if (tail1) {                                                                                 \
+    (tail1)->_next=(head2);                                                                    \
   } else {                                                                                     \
     (head1)=(head2);                                                                           \
   }                                                                                            \
+  if (tail2) {                                                                                 \
+    (tail1)=(tail2);                                                                           \
+  }                                                                                            \
 } while (0)
 
-#define MPL_LL_APPEND(head,add) MPL_LL_APPEND_N(head,add,next)
-#define MPL_LL_APPEND_N(head,add,_next)                                                        \
+#define MPL_LL_APPEND(head,tail,add) MPL_LL_APPEND_N(head,tail,add,next)
+#define MPL_LL_APPEND_N(head,tail,add,_next)                                                   \
 do {                                                                                           \
-  MPL_LDECLTYPE(head) _tmp;                                                                    \
   (add)->_next=NULL;                                                                           \
-  if (head) {                                                                                  \
-    _tmp = head;                                                                               \
-    while (_tmp->_next) { _tmp = _tmp->_next; }                                                \
-    _tmp->_next=(add);                                                                         \
+  if (tail) {                                                                                  \
+    (tail)->_next=(add);                                                                       \
   } else {                                                                                     \
     (head)=(add);                                                                              \
   }                                                                                            \
+  (tail)=(add);                                                                                \
 } while (0)
 
-#define MPL_LL_DELETE(head,del) MPL_LL_DELETE_N(head,del,next)
-#define MPL_LL_DELETE_N(head,del,_next)                                                        \
+#define MPL_LL_DELETE(head,tail,del) MPL_LL_DELETE_N(head,tail,del,next)
+#define MPL_LL_DELETE_N(head,tail,del,_next)                                                   \
 do {                                                                                           \
   MPL_LDECLTYPE(head) _tmp;                                                                    \
   if ((head) == (del)) {                                                                       \
     (head)=(head)->_next;                                                                      \
+    if ((tail) == (del))                                                                       \
+      (tail)=(head);                                                                           \
   } else {                                                                                     \
     _tmp = head;                                                                               \
     while (_tmp->_next && (_tmp->_next != (del))) {                                            \
@@ -373,29 +375,20 @@ do {
     }                                                                                          \
     if (_tmp->_next) {                                                                         \
       _tmp->_next = ((del)->_next);                                                            \
+      if ((tail) == (del))                                                                     \
+        (tail)=_tmp;                                                                           \
     }                                                                                          \
   }                                                                                            \
 } while (0)
 
-/* Here are VS2008 replacements for MPL_LL_APPEND and MPL_LL_DELETE */
-#define MPL_LL_APPEND_VS2008(head,add) MPL_LL_APPEND_N_VS2008(head,add,next)
-#define MPL_LL_APPEND_N_VS2008(head,add,_next)                                                 \
-do {                                                                                           \
-  if (head) {                                                                                  \
-    (add)->_next = head;     /* use add->_next as a temp variable */                           \
-    while ((add)->_next->_next) { (add)->_next = (add)->_next->_next; }                        \
-    (add)->_next->_next=(add);                                                                 \
-  } else {                                                                                     \
-    (head)=(add);                                                                              \
-  }                                                                                            \
-  (add)->_next=NULL;                                                                           \
-} while (0)
-
-#define MPL_LL_DELETE_VS2008(head,del) MPL_LL_DELETE_N_VS2008(head,del,next)
-#define MPL_LL_DELETE_N_VS2008(head,del,_next)                                                 \
+/* Here are VS2008 replacements for MPL_LL_DELETE */
+#define MPL_LL_DELETE_VS2008(head,tail,del) MPL_LL_DELETE_N_VS2008(head,tail,del,next)
+#define MPL_LL_DELETE_N_VS2008(head,tail,del,_next)                                            \
 do {                                                                                           \
   if ((head) == (del)) {                                                                       \
     (head)=(head)->_next;                                                                      \
+    if ((tail) == (del))                                                                       \
+      (tail)=(head);                                                                           \
   } else {                                                                                     \
     char *_tmp = (char*)(head);                                                                \
     while (head->_next && (head->_next != (del))) {                                            \
@@ -403,6 +396,8 @@ do {
     }                                                                                          \
     if (head->_next) {                                                                         \
       head->_next = ((del)->_next);                                                            \
+      if ((tail) == (del))                                                                     \
+        (tail)=(head);                                                                         \
     }                                                                                          \
     {                                                                                          \
       char **_head_alias = (char**)&(head);                                                    \
@@ -411,11 +406,8 @@ do {
   }                                                                                            \
 } while (0)
 #ifdef MPL_NO_DECLTYPE
-#undef MPL_LL_APPEND
-#define MPL_LL_APPEND MPL_LL_APPEND_VS2008
 #undef MPL_LL_DELETE
 #define MPL_LL_DELETE MPL_LL_DELETE_VS2008
-#undef MPL_LL_CONCAT /* no MPL_LL_CONCAT_VS2008 */
 #undef MPL_DL_CONCAT /* no MPL_DL_CONCAT_VS2008 */
 #endif
 /* end VS2008 replacements */

http://git.mpich.org/mpich.git/commitdiff/7418944673507d4fd3d3025e9e5ecfde809e9210

commit 7418944673507d4fd3d3025e9e5ecfde809e9210
Author: Xin Zhao <xinzhao3 at illinois.edu>
Date:   Sun Sep 21 11:38:28 2014 -0500

    Bug-fix: waiting for ACKs for Active Target Synchronization.
    
    The original implementation of FENCE and PSCW does not
    guarantee the remote completion of issued-out RMA operations
    when MPI_Win_complete and MPI_Win_fence returns. They only
    guarantee the local completion of issued-out operations and
    the completion of coming-in operations. This is not correct
    if we try to get updated values on target side using synchronizations
    with MPI_MODE_NOCHECK.
    
    Here we modify it by making runtime wait for ACKs from all
    targets before returning from MPI_Win_fence and MPI_Win_complete.
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/src/mpid/ch3/include/mpidpre.h b/src/mpid/ch3/include/mpidpre.h
index 76ef00f..ffb6802 100644
--- a/src/mpid/ch3/include/mpidpre.h
+++ b/src/mpid/ch3/include/mpidpre.h
@@ -302,6 +302,7 @@ struct MPIDI_Win_target_state {
     int start_assert;   /* assert passed to MPI_Win_start */             \
     int shm_allocated; /* flag: TRUE iff this window has a shared memory \
                           region associated with it */                   \
+    int ack_counter; /* counter for acknowledgement message at origin */ \
 
 #ifdef MPIDI_CH3_WIN_DECL
 #define MPID_DEV_WIN_DECL \
diff --git a/src/mpid/ch3/src/ch3u_rma_sync.c b/src/mpid/ch3/src/ch3u_rma_sync.c
index 6b48ac3..3e2daf0 100644
--- a/src/mpid/ch3/src/ch3u_rma_sync.c
+++ b/src/mpid/ch3/src/ch3u_rma_sync.c
@@ -1308,6 +1308,11 @@ int MPIDI_Win_fence(int assert, MPID_Win *win_ptr)
 	    if (curr_ops_cnt[curr_ptr->target_rank] ==
                 nops_to_proc[curr_ptr->target_rank] - 1) {
                 flags = MPIDI_CH3_PKT_FLAG_RMA_AT_COMPLETE;
+                if (curr_ptr->type == MPIDI_RMA_PUT ||
+                    curr_ptr->type == MPIDI_RMA_ACCUMULATE) {
+                    flags |= MPIDI_CH3_PKT_FLAG_RMA_REQ_ACK;
+                    win_ptr->ack_counter++;
+                }
             }
 
             source_win_handle = win_ptr->handle;
@@ -1380,11 +1385,12 @@ int MPIDI_Win_fence(int assert, MPID_Win *win_ptr)
 	
  finish_up:
 	/* wait for all operations from other processes to finish */
-	if (win_ptr->my_counter)
+        /* waiting for acknowledgement packets from targets to arrive */
+	if (win_ptr->my_counter || win_ptr->ack_counter)
 	{
 	    MPIR_T_PVAR_TIMER_START(RMA, rma_winfence_wait);
 	    MPID_Progress_start(&progress_state);
-	    while (win_ptr->my_counter)
+	    while (win_ptr->my_counter || win_ptr->ack_counter)
 	    {
 		mpi_errno = MPID_Progress_wait(&progress_state);
 		/* --BEGIN ERROR HANDLING-- */
@@ -2603,6 +2609,7 @@ int MPIDI_Win_complete(MPID_Win *win_ptr)
     MPID_Comm *comm_ptr;
     MPI_Win source_win_handle, target_win_handle;
     int start_grp_size, *ranks_in_win_grp, rank;
+    MPID_Progress_state progress_state;
     int nRequest = 0;
     int nRequestNew = 0;
     MPIU_CHKLMEM_DECL(6);
@@ -2614,12 +2621,6 @@ int MPIDI_Win_complete(MPID_Win *win_ptr)
                         win_ptr->epoch_state != MPIDI_EPOCH_START,
                         mpi_errno, MPI_ERR_RMA_SYNC, "**rmasync");
 
-    /* Track access epoch state */
-    if (win_ptr->epoch_state == MPIDI_EPOCH_PSCW)
-        win_ptr->epoch_state = MPIDI_EPOCH_POST;
-    else
-        win_ptr->epoch_state = MPIDI_EPOCH_NONE;
-
     comm_ptr = win_ptr->comm_ptr;
     comm_size = comm_ptr->local_size;
         
@@ -2700,6 +2701,11 @@ int MPIDI_Win_complete(MPID_Win *win_ptr)
 	if (curr_ops_cnt[curr_ptr->target_rank] ==
 	    nops_to_proc[curr_ptr->target_rank] - 1) {
             flags = MPIDI_CH3_PKT_FLAG_RMA_AT_COMPLETE;
+            if (curr_ptr->type == MPIDI_RMA_PUT ||
+                curr_ptr->type == MPIDI_RMA_ACCUMULATE) {
+                win_ptr->ack_counter++;
+                flags |= MPIDI_CH3_PKT_FLAG_RMA_REQ_ACK;
+            }
         }
 
         source_win_handle = win_ptr->handle;
@@ -2802,10 +2808,33 @@ int MPIDI_Win_complete(MPID_Win *win_ptr)
     }
 
     MPIU_Assert(MPIDI_CH3I_RMA_Ops_isempty(ops_list));
+
+    /* waiting for acknowledgement packets from targets to arrive */
+    if (win_ptr->ack_counter)
+    {
+        MPID_Progress_start(&progress_state);
+        while (win_ptr->ack_counter)
+        {
+            mpi_errno = MPID_Progress_wait(&progress_state);
+            /* --BEGIN ERROR HANDLING-- */
+            if (mpi_errno != MPI_SUCCESS) {
+                MPID_Progress_end(&progress_state);
+                MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winnoprogress");
+            }
+            /* --END ERROR HANDLING-- */
+        }
+        MPID_Progress_end(&progress_state);
+    }
     
     /* free the group stored in window */
     MPIR_Group_release(win_ptr->start_group_ptr);
     win_ptr->start_group_ptr = NULL; 
+
+    /* Track access epoch state */
+    if (win_ptr->epoch_state == MPIDI_EPOCH_PSCW)
+        win_ptr->epoch_state = MPIDI_EPOCH_POST;
+    else
+        win_ptr->epoch_state = MPIDI_EPOCH_NONE;
     
  fn_exit:
     MPIU_CHKLMEM_FREEALL();
@@ -5807,12 +5836,21 @@ int MPIDI_CH3_PktHandler_PtRMADone( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
     *buflen = sizeof(MPIDI_CH3_Pkt_t);
 
     MPID_Win_get_ptr(pt_rma_done_pkt->source_win_handle, win_ptr);
+
+    if (win_ptr->epoch_state == MPIDI_EPOCH_FENCE ||
+        win_ptr->epoch_state == MPIDI_EPOCH_PSCW ||
+        win_ptr->epoch_state == MPIDI_EPOCH_START) {
+        win_ptr->ack_counter--;
+        MPIU_Assert(win_ptr->ack_counter >= 0);
+    }
+    else {
     MPIU_Assert(win_ptr->targets[pt_rma_done_pkt->target_rank].remote_lock_state != MPIDI_CH3_WIN_LOCK_NONE);
 
     if (win_ptr->targets[pt_rma_done_pkt->target_rank].remote_lock_state == MPIDI_CH3_WIN_LOCK_FLUSH)
         win_ptr->targets[pt_rma_done_pkt->target_rank].remote_lock_state = MPIDI_CH3_WIN_LOCK_GRANTED;
     else
         win_ptr->targets[pt_rma_done_pkt->target_rank].remote_lock_state = MPIDI_CH3_WIN_LOCK_NONE;
+    }
 
     *rreqp = NULL;
     MPIDI_CH3_Progress_signal_completion();	
@@ -6137,6 +6175,11 @@ int MPIDI_CH3_Finish_rma_op_target(MPIDI_VC_t *vc, MPID_Win *win_ptr, int is_rma
         win_ptr->my_counter -= 1;
         MPIU_Assert(win_ptr->my_counter >= 0);
 
+        if (flags & MPIDI_CH3_PKT_FLAG_RMA_REQ_ACK) {
+            mpi_errno = MPIDI_CH3I_Send_pt_rma_done_pkt(vc, win_ptr, source_win_handle);
+            if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
+        }
+
         /* Signal the local process when the op counter reaches 0. */
         if (win_ptr->my_counter == 0)
             MPIDI_CH3_Progress_signal_completion();
diff --git a/src/mpid/ch3/src/mpid_rma.c b/src/mpid/ch3/src/mpid_rma.c
index c112db0..8bfe842 100644
--- a/src/mpid/ch3/src/mpid_rma.c
+++ b/src/mpid/ch3/src/mpid_rma.c
@@ -299,6 +299,7 @@ static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
     (*win_ptr)->epoch_count         = 0;
     (*win_ptr)->at_rma_ops_list     = NULL;
     (*win_ptr)->shm_allocated       = FALSE;
+    (*win_ptr)->ack_counter         = 0;
 
     /* Initialize the passive target lock state */
     MPIU_CHKPMEM_MALLOC((*win_ptr)->targets, struct MPIDI_Win_target_state *,

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

Summary of changes:
 .../ch3/channels/nemesis/netmod/portals4/ptl_nm.c  |    5 +-
 src/mpid/ch3/include/mpidpre.h                     |    1 +
 src/mpid/ch3/src/ch3u_comm.c                       |   22 ++++---
 src/mpid/ch3/src/ch3u_rma_sync.c                   |   59 +++++++++++++++---
 src/mpid/ch3/src/mpid_rma.c                        |    1 +
 src/mpl/include/mpl_utlist.h                       |   66 +++++++++-----------
 6 files changed, 97 insertions(+), 57 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list