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

Service Account noreply at mpich.org
Sat Jun 20 09:34: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  23b08871308fa33af2706707a114efe0f3fd7516 (commit)
       via  bb923ddf5ab15e25367738a7759653e2fbb973c6 (commit)
       via  7189bcde4875091fc35bfbec7faf2bb3cc78ee42 (commit)
      from  7cda493bf0e9d1cea9991da7ba8df613a5de4261 (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/23b08871308fa33af2706707a114efe0f3fd7516

commit 23b08871308fa33af2706707a114efe0f3fd7516
Author: Junchao Zhang <jczhang at mcs.anl.gov>
Date:   Fri Jun 19 10:33:37 2015 -0500

    Add a progress hook mechanism to pamid
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/src/mpid/pamid/include/mpidimpl.h b/src/mpid/pamid/include/mpidimpl.h
index 5135c49..fabc9d4 100644
--- a/src/mpid/pamid/include/mpidimpl.h
+++ b/src/mpid/pamid/include/mpidimpl.h
@@ -184,4 +184,10 @@ MPIDI_Win_set_info(MPID_Win *win,
 
 MPI_Aint MPID_Aint_add(MPI_Aint base, MPI_Aint disp);
 MPI_Aint MPID_Aint_diff(MPI_Aint addr1, MPI_Aint addr2);
+
+int MPIDI_Progress_register_hook(int (*progress_fn)(int*));
+int MPIDI_Progress_deregister_hook(int (*progress_fn)(int*));
+
+#define MPID_Progress_register_hook(fn_) MPIDI_Progress_register_hook(fn_)
+#define MPID_Progress_deregister_hook(fn_) MPIDI_Progress_deregister_hook(fn_)
 #endif
diff --git a/src/mpid/pamid/src/mpid_progress.c b/src/mpid/pamid/src/mpid_progress.c
index 53b930f..17191ff 100644
--- a/src/mpid/pamid/src/mpid_progress.c
+++ b/src/mpid/pamid/src/mpid_progress.c
@@ -21,6 +21,73 @@
  */
 #include <mpidimpl.h>
 
+#define MAX_PROGRESS_HOOKS 16
+typedef int (*progress_func_ptr_t) (int* made_progress);
+static progress_func_ptr_t  progress_hooks[MAX_PROGRESS_HOOKS] = { NULL };
+
+#undef FUNCNAME
+#define FUNCNAME MPIDI_CH3I_Progress_register_hook
+#undef FCNAME
+#define FCNAME MPIDI_QUOTE(FUNCNAME)
+int MPIDI_Progress_register_hook(int (*progress_fn)(int*))
+{
+    int mpi_errno = MPI_SUCCESS;
+    int i;
+    MPIDI_STATE_DECL(MPID_STATE_MPIDI_PROGRESS_REGISTER_HOOK);
+
+    MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_PROGRESS_REGISTER_HOOK);
+    MPIU_THREAD_CS_ENTER(ASYNC,);
+
+    for (i = 0; i < MAX_PROGRESS_HOOKS; i++) {
+        if (progress_hooks[i] == NULL) {
+            progress_hooks[i] = progress_fn;
+            break;
+        }
+    }
+
+    if (i >= MAX_PROGRESS_HOOKS) {
+        return MPIR_Err_create_code( MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
+            "MPIDI_Progress_register_hook", __LINE__,
+            MPI_ERR_INTERN, "**progresshookstoomany", 0 );
+    }
+
+  fn_exit:
+    MPIU_THREAD_CS_EXIT(ASYNC,);
+    MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_PROGRESS_REGISTER_HOOK);
+    return mpi_errno;
+
+  fn_fail:
+    goto fn_exit;
+}
+
+#undef FUNCNAME
+#define FUNCNAME MPIDI_CH3I_Progress_deregister_hook
+#undef FCNAME
+#define FCNAME MPIDI_QUOTE(FUNCNAME)
+int MPIDI_CH3I_Progress_deregister_hook(int (*progress_fn)(int*))
+{
+    int mpi_errno = MPI_SUCCESS;
+    int i;
+    MPIDI_STATE_DECL(MPID_STATE_MPIDI_PROGRESS_DEREGISTER_HOOK);
+
+    MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_PROGRESS_DEREGISTER_HOOK);
+    MPIU_THREAD_CS_ENTER(ASYNC,);
+
+    for (i = 0; i < MAX_PROGRESS_HOOKS; i++) {
+        if (progress_hooks[i] == progress_fn) {
+            progress_hooks[i] = NULL;
+            break;
+        }
+    }
+
+  fn_exit:
+    MPIU_THREAD_CS_EXIT(ASYNC,);
+    MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_PROGRESS_DEREGISTER_HOOK);
+    return mpi_errno;
+
+  fn_fail:
+    goto fn_exit;
+}
 
 void
 MPIDI_Progress_init()
@@ -155,6 +222,7 @@ MPIDI_Progress_async_poll (pami_context_t context, void *cookie)
 {
   pami_result_t rc;
   int loop_count=100;
+  int i, made_progress;
 
   /* In the "global" mpich lock mode all application threads must acquire the
    * ALLFUNC global lock upon entry to the API. The async progress thread
@@ -164,6 +232,12 @@ MPIDI_Progress_async_poll (pami_context_t context, void *cookie)
    */
   if (MPIU_THREAD_CS_TRY(ALLFUNC,))           /* (0==try_acquire(0)) */
     {
+      for (i = 0; i < MAX_PROGRESS_HOOKS; i++) {
+        if (progress_hooks[i] != NULL) {
+          progress_hooks[i](&made_progress);
+        }
+      }
+
       /* There is a simplifying assertion when in the 'global' mpich lock mode
        * that only a single context is supported. See the discussion in
        * mpich/src/mpid/pamid/src/mpid_init.c for more information.
@@ -187,6 +261,13 @@ MPIDI_Progress_async_poll_perobj (pami_context_t context, void *cookie)
 {
   pami_result_t rc;
   int loop_count=100;
+  int i, made_progress;
+
+  for (i = 0; i < MAX_PROGRESS_HOOKS; i++) {
+    if (progress_hooks[i] != NULL) {
+      progress_hooks[i](&made_progress);
+    }
+  }
 
   /* In the "per object" mpich lock mode multiple application threads could be
    * active within the API interacting with contexts and multiple async progress

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

commit bb923ddf5ab15e25367738a7759653e2fbb973c6
Author: Junchao Zhang <jczhang at mcs.anl.gov>
Date:   Wed Jun 17 09:51:20 2015 -0500

    Add a progress hook mechanism to sock
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/src/mpid/ch3/channels/sock/include/mpidi_ch3_impl.h b/src/mpid/ch3/channels/sock/include/mpidi_ch3_impl.h
index 71475dc..f1bc05d 100644
--- a/src/mpid/ch3/channels/sock/include/mpidi_ch3_impl.h
+++ b/src/mpid/ch3/channels/sock/include/mpidi_ch3_impl.h
@@ -72,6 +72,8 @@
    channel interface */
 int MPIDI_CH3I_Progress_init(void);
 int MPIDI_CH3I_Progress_finalize(void);
+int MPIDI_CH3I_Progress_register_hook(int (*progress_fn)(int*));
+int MPIDI_CH3I_Progress_deregister_hook(int (*progress_fn)(int*));
 int MPIDI_CH3I_VC_post_connect(MPIDI_VC_t *);
 
 /* Shared memory window atomic/accumulate mutex implementation */
diff --git a/src/mpid/ch3/channels/sock/src/ch3_progress.c b/src/mpid/ch3/channels/sock/src/ch3_progress.c
index 0fcc20d..f6adc49 100644
--- a/src/mpid/ch3/channels/sock/src/ch3_progress.c
+++ b/src/mpid/ch3/channels/sock/src/ch3_progress.c
@@ -7,6 +7,7 @@
 #include "mpidi_ch3_impl.h"
 #include "pmi.h"
 #include "mpidu_sock.h"
+#include "mpl_utlist.h"
 
 #ifdef HAVE_STRING_H
 #include <string.h>
@@ -45,6 +46,9 @@ static inline int connection_post_recv_pkt(MPIDI_CH3I_Connection_t * conn);
 
 static int adjust_iov(MPID_IOV ** iovp, int * countp, MPIU_Size_t nb);
 
+#define MAX_PROGRESS_HOOKS 16
+typedef int (*progress_func_ptr_t) (int* made_progress);
+static progress_func_ptr_t progress_hooks[MAX_PROGRESS_HOOKS] = { NULL };
 
 #undef FUNCNAME
 #define FUNCNAME MPIDI_CH3i_Progress_test
@@ -55,6 +59,7 @@ static int MPIDI_CH3i_Progress_test(void)
     MPIDU_Sock_event_t event;
     int mpi_errno = MPI_SUCCESS;
     int made_progress;
+    int i;
     MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_PROGRESS_TEST);
 
     MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_PROGRESS_TEST);
@@ -86,22 +91,11 @@ static int MPIDI_CH3i_Progress_test(void)
     }
 #   endif
     
-    /* make progress on NBC schedules */
-    mpi_errno = MPIDU_Sched_progress(&made_progress);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-
-#if defined HAVE_LIBHCOLL
-    if (MPIR_CVAR_CH3_ENABLE_HCOLL) {
-        mpi_errno = hcoll_do_progress();
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-    }
-#endif /* HAVE_LIBHCOLL */
-
-    /* make progress on RMA */
-    if (MPIDI_CH3I_num_active_issued_win > 0 || MPIDI_CH3I_num_passive_win > 0) {
-    mpi_errno = MPIDI_CH3I_RMA_Make_progress_global(&made_progress);
-    if (mpi_errno)
-        MPIU_ERR_POP(mpi_errno);
+    for (i = 0; i < MAX_PROGRESS_HOOKS; i++) {
+        if (progress_hooks[i] != NULL) {
+            mpi_errno = progress_hooks[i](&made_progress);
+            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        }
     }
 
     mpi_errno = MPIDU_Sock_wait(MPIDI_CH3I_sock_set, 0, &event);
@@ -191,37 +185,19 @@ static int MPIDI_CH3i_Progress_wait(MPID_Progress_state * progress_state)
     do
     {
         int made_progress = FALSE;
-
-        /* make progress on NBC schedules, must come before we block on sock_wait */
-        mpi_errno = MPIDU_Sched_progress(&made_progress);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-        if (made_progress) {
-            MPIDI_CH3_Progress_signal_completion();
-            break;
-        }
-
-#if defined HAVE_LIBHCOLL
-        if (MPIR_CVAR_CH3_ENABLE_HCOLL) {
-            mpi_errno = hcoll_do_progress();
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-
-            /* if hcoll completed any pending requests, break.  Else,
-             * we are expecting at least one more socket event */
-            if (progress_state->ch.completion_count != MPIDI_CH3I_progress_completion_count)
-                break;
-        }
-#endif /* HAVE_LIBHCOLL */
-
-        /* make progress on RMA */
-        if (MPIDI_CH3I_num_active_issued_win > 0 || MPIDI_CH3I_num_passive_win > 0) {
-        mpi_errno = MPIDI_CH3I_RMA_Make_progress_global(&made_progress);
-        if (mpi_errno)
-            MPIU_ERR_POP(mpi_errno);
-        if (made_progress) {
-            MPIDI_CH3_Progress_signal_completion();
-            break;
-        }
+        int i;
+
+        for (i = 0; i < MAX_PROGRESS_HOOKS; i++) {
+            if (progress_hooks[i] != NULL) {
+                mpi_errno = progress_hooks[i](&made_progress);
+                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (made_progress) {
+                    MPIDI_CH3_Progress_signal_completion();
+                    break; /* break the for loop */
+                }
+            }
         }
+        if (made_progress) break; /* break the do loop */
 
 #       ifdef MPICH_IS_THREADED
 
@@ -962,6 +938,70 @@ int MPIDI_CH3I_Progress( int blocking, MPID_Progress_state *state )
     return mpi_errno;
 }
 
+#undef FUNCNAME
+#define FUNCNAME MPIDI_CH3I_Progress_register_hook
+#undef FCNAME
+#define FCNAME MPIDI_QUOTE(FUNCNAME)
+int MPIDI_CH3I_Progress_register_hook(int (*progress_fn)(int*))
+{
+    int mpi_errno = MPI_SUCCESS;
+    int i;
+    MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_PROGRESS_REGISTER_HOOK);
+
+    MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_PROGRESS_REGISTER_HOOK);
+    MPIU_THREAD_CS_ENTER(MPIDCOMM,);
+
+    for (i = 0; i < MAX_PROGRESS_HOOKS; i++) {
+        if (progress_hooks[i] == NULL) {
+            progress_hooks[i] = progress_fn;
+            break;
+        }
+    }
+
+    if (i >= MAX_PROGRESS_HOOKS) {
+        return MPIR_Err_create_code( MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
+				     "MPIDI_CH3I_Progress_register_hook", __LINE__,
+				     MPI_ERR_INTERN, "**progresshookstoomany", 0 );
+    }
+
+  fn_exit:
+    MPIU_THREAD_CS_EXIT(MPIDCOMM,);
+    MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3I_PROGRESS_REGISTER_HOOK);
+    return mpi_errno;
+
+  fn_fail:
+    goto fn_exit;
+}
+
+#undef FUNCNAME
+#define FUNCNAME MPIDI_CH3I_Progress_deregister_hook
+#undef FCNAME
+#define FCNAME MPIDI_QUOTE(FUNCNAME)
+int MPIDI_CH3I_Progress_deregister_hook(int (*progress_fn)(int*))
+{
+    int mpi_errno = MPI_SUCCESS;
+    int i;
+    MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_PROGRESS_DEREGISTER_HOOK);
+
+    MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_PROGRESS_DEREGISTER_HOOK);
+    MPIU_THREAD_CS_ENTER(MPIDCOMM,);
+
+    for (i = 0; i < MAX_PROGRESS_HOOKS; i++) {
+        if (progress_hooks[i] == progress_fn) {
+            progress_hooks[i] = NULL;
+            break;
+        }
+    }
+
+  fn_exit:
+    MPIU_THREAD_CS_EXIT(MPIDCOMM,);
+    MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3I_PROGRESS_DEREGISTER_HOOK);
+    return mpi_errno;
+
+  fn_fail:
+    goto fn_exit;
+}
+
 /* A convenience dummy symbol so that the PETSc folks can configure test to
  * ensure that they have a working version of MPICH ch3:sock.  Please don't
  * delete it without consulting them. */

http://git.mpich.org/mpich.git/commitdiff/7189bcde4875091fc35bfbec7faf2bb3cc78ee42

commit 7189bcde4875091fc35bfbec7faf2bb3cc78ee42
Author: Junchao Zhang <jczhang at mcs.anl.gov>
Date:   Tue Jun 16 16:18:08 2015 -0500

    Add a progress hook mechanism to ch3 and nemesis
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/src/mpi/errhan/errnames.txt b/src/mpi/errhan/errnames.txt
index 694cc87..111f13d 100644
--- a/src/mpi/errhan/errnames.txt
+++ b/src/mpi/errhan/errnames.txt
@@ -460,6 +460,7 @@ unexpected messages queued.
 **opnotpredefined:only predefined ops are valid
 
 **init:Initialization failed
+**progresshookstoomany: too many progress hooks are registered
 
 #
 # To be removed
diff --git a/src/mpid/ch3/channels/nemesis/include/mpidi_ch3_impl.h b/src/mpid/ch3/channels/nemesis/include/mpidi_ch3_impl.h
index 33a28d0..ae4132a 100644
--- a/src/mpid/ch3/channels/nemesis/include/mpidi_ch3_impl.h
+++ b/src/mpid/ch3/channels/nemesis/include/mpidi_ch3_impl.h
@@ -50,6 +50,8 @@ extern struct MPID_Request *MPIDI_CH3I_shm_active_send;
 int MPIDI_CH3I_Shm_supported(void);
 int MPIDI_CH3I_Progress_init(void);
 int MPIDI_CH3I_Progress_finalize(void);
+int MPIDI_CH3I_Progress_register_hook(int (*progress_fn)(int*));
+int MPIDI_CH3I_Progress_deregister_hook(int (*progress_fn)(int*));
 int MPIDI_CH3I_Shm_send_progress(void);
 int MPIDI_CH3I_Complete_sendq_with_error(MPIDI_VC_t * vc);
 
diff --git a/src/mpid/ch3/channels/nemesis/src/ch3_progress.c b/src/mpid/ch3/channels/nemesis/src/ch3_progress.c
index e05fe3b..2e855f1 100644
--- a/src/mpid/ch3/channels/nemesis/src/ch3_progress.c
+++ b/src/mpid/ch3/channels/nemesis/src/ch3_progress.c
@@ -85,6 +85,10 @@ typedef struct qn_ent
 
 static qn_ent_t *qn_head = NULL;
 
+#define MAX_PROGRESS_HOOKS 16
+typedef int (*progress_func_ptr_t) (int* made_progress);
+static progress_func_ptr_t  progress_hooks[MAX_PROGRESS_HOOKS] = { NULL };
+
 #ifdef HAVE_SIGNAL
 static void sigusr1_handler(int sig)
 {
@@ -280,6 +284,69 @@ int MPIDI_CH3I_Shm_send_progress(void)
     goto fn_exit;
 }
 
+#undef FUNCNAME
+#define FUNCNAME MPIDI_CH3I_Progress_register_hook
+#undef FCNAME
+#define FCNAME MPIDI_QUOTE(FUNCNAME)
+int MPIDI_CH3I_Progress_register_hook(int (*progress_fn)(int*))
+{
+    int mpi_errno = MPI_SUCCESS;
+    int i;
+    MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_PROGRESS_REGISTER_HOOK);
+
+    MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_PROGRESS_REGISTER_HOOK);
+    MPIU_THREAD_CS_ENTER(MPIDCOMM,);
+
+    for (i = 0; i < MAX_PROGRESS_HOOKS; i++) {
+        if (progress_hooks[i] == NULL) {
+            progress_hooks[i] = progress_fn;
+            break;
+        }
+    }
+
+    if (i >= MAX_PROGRESS_HOOKS) {
+        return MPIR_Err_create_code( MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
+				     "MPIDI_CH3I_Progress_register_hook", __LINE__,
+				     MPI_ERR_INTERN, "**progresshookstoomany", 0 );
+    }
+
+  fn_exit:
+    MPIU_THREAD_CS_EXIT(MPIDCOMM,);
+    MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3I_PROGRESS_REGISTER_HOOK);
+    return mpi_errno;
+
+  fn_fail:
+    goto fn_exit;
+}
+
+#undef FUNCNAME
+#define FUNCNAME MPIDI_CH3I_Progress_deregister_hook
+#undef FCNAME
+#define FCNAME MPIDI_QUOTE(FUNCNAME)
+int MPIDI_CH3I_Progress_deregister_hook(int (*progress_fn)(int*))
+{
+    int mpi_errno = MPI_SUCCESS;
+    int i;
+    MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_PROGRESS_DEREGISTER_HOOK);
+
+    MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_PROGRESS_DEREGISTER_HOOK);
+    MPIU_THREAD_CS_ENTER(MPIDCOMM,);
+
+    for (i = 0; i < MAX_PROGRESS_HOOKS; i++) {
+        if (progress_hooks[i] == progress_fn) {
+            progress_hooks[i] = NULL;
+            break;
+        }
+    }
+
+  fn_exit:
+    MPIU_THREAD_CS_EXIT(MPIDCOMM,);
+    MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3I_PROGRESS_DEREGISTER_HOOK);
+    return mpi_errno;
+
+  fn_fail:
+    goto fn_exit;
+}
 
 /* NOTE: it appears that this function is sometimes (inadvertently?) recursive.
  * Some packet handlers, such as MPIDI_CH3_PktHandler_Close, call iStartMsg,
@@ -364,6 +431,7 @@ int MPIDI_CH3I_Progress (MPID_Progress_state *progress_state, int is_blocking)
 	MPID_nem_cell_ptr_t  cell;
 	int                  in_fbox = 0;
 	MPIDI_VC_t          *vc;
+	int i;
 
         do /* receive progress */
         {
@@ -463,27 +531,13 @@ int MPIDI_CH3I_Progress (MPID_Progress_state *progress_state, int is_blocking)
             if (mpi_errno) MPIU_ERR_POP(mpi_errno);
         }
 
-        /* make progress on NBC schedules */
-        mpi_errno = MPIDU_Sched_progress(&made_progress);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-        if (made_progress) {
-            MPIDI_CH3_Progress_signal_completion();
-        }
-
-#if defined HAVE_LIBHCOLL
-        if (MPIR_CVAR_CH3_ENABLE_HCOLL) {
-            mpi_errno = hcoll_do_progress();
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-        }
-#endif /* HAVE_LIBHCOLL */
-
-        /* make progress on RMA */
-        if (MPIDI_CH3I_num_active_issued_win > 0 || MPIDI_CH3I_num_passive_win > 0) {
-        mpi_errno = MPIDI_CH3I_RMA_Make_progress_global(&made_progress);
-        if (mpi_errno)
-            MPIU_ERR_POP(mpi_errno);
-        if (made_progress)
-            MPIDI_CH3_Progress_signal_completion();
+        for (i = 0; i < MAX_PROGRESS_HOOKS; i++) {
+            if (progress_hooks[i] != NULL) {
+                mpi_errno = progress_hooks[i](&made_progress);
+                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (made_progress)
+                    MPIDI_CH3_Progress_signal_completion();
+            }
         }
 
         /* in the case of progress_wait, bail out if anything completed (CC-1) */
diff --git a/src/mpid/ch3/include/mpidimpl.h b/src/mpid/ch3/include/mpidimpl.h
index 5b0c536..760827a 100644
--- a/src/mpid/ch3/include/mpidimpl.h
+++ b/src/mpid/ch3/include/mpidimpl.h
@@ -2059,4 +2059,11 @@ int MPIDI_CH3_ReqHandler_ReqOpsComplete(MPIDI_VC_t *, MPID_Request *,
             *(eager_threshold_p) = (vc)->eager_max_msg_sz;          \
     } while (0)
 
+
+int MPIDI_CH3I_Progress_register_hook(int (*progress_fn)(int*));
+int MPIDI_CH3I_Progress_deregister_hook(int (*progress_fn)(int*));
+
+#define MPID_Progress_register_hook(fn_) MPIDI_CH3I_Progress_register_hook(fn_)
+#define MPID_Progress_deregister_hook(fn_) MPIDI_CH3I_Progress_deregister_hook(fn_)
+
 #endif /* !defined(MPICH_MPIDIMPL_H_INCLUDED) */
diff --git a/src/mpid/ch3/src/mpid_rma.c b/src/mpid/ch3/src/mpid_rma.c
index 0c3892e..0452fc3 100644
--- a/src/mpid/ch3/src/mpid_rma.c
+++ b/src/mpid/ch3/src/mpid_rma.c
@@ -392,6 +392,11 @@ static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
     MPIU_CHKPMEM_MALLOC(win_elem, MPIDI_RMA_Win_list_t *, sizeof(MPIDI_RMA_Win_list_t), mpi_errno,
                         "Window list element");
     win_elem->win_ptr = *win_ptr;
+
+    if (MPIDI_RMA_Win_list == NULL) {
+        mpi_errno = MPID_Progress_register_hook(MPIDI_CH3I_RMA_Make_progress_global);
+        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    }
     MPL_LL_APPEND(MPIDI_RMA_Win_list, MPIDI_RMA_Win_list_tail, win_elem);
 
     if (MPIDI_CH3U_Win_hooks.win_init != NULL) {
diff --git a/src/mpid/ch3/src/mpidi_rma.c b/src/mpid/ch3/src/mpidi_rma.c
index 28c9063..d047a29 100644
--- a/src/mpid/ch3/src/mpidi_rma.c
+++ b/src/mpid/ch3/src/mpidi_rma.c
@@ -223,6 +223,9 @@ int MPIDI_Win_free(MPID_Win ** win_ptr)
     MPL_LL_DELETE(MPIDI_RMA_Win_list, MPIDI_RMA_Win_list_tail, win_elem);
     MPIU_Free(win_elem);
 
+    if (MPIDI_RMA_Win_list == NULL)
+        MPID_Progress_deregister_hook(MPIDI_CH3I_RMA_Make_progress_global);
+
     comm_ptr = (*win_ptr)->comm_ptr;
     mpi_errno = MPIR_Comm_free_impl(comm_ptr);
     if (mpi_errno)
diff --git a/src/mpid/common/hcoll/hcoll.h b/src/mpid/common/hcoll/hcoll.h
index 5671a0f..7956b6d 100644
--- a/src/mpid/common/hcoll/hcoll.h
+++ b/src/mpid/common/hcoll/hcoll.h
@@ -26,6 +26,6 @@ int hcoll_Iallgather_req(const void *sendbuf, int sendcount, MPI_Datatype sendty
                          MPID_Request ** request);
 int hcoll_Iallreduce_req(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
                          MPI_Op op, MPID_Comm * comm_ptr, MPID_Request ** request);
-int hcoll_do_progress(void);
+int hcoll_do_progress(int *made_progress);
 
 #endif
diff --git a/src/mpid/common/hcoll/hcoll_init.c b/src/mpid/common/hcoll/hcoll_init.c
index 613a832..ee1a364 100644
--- a/src/mpid/common/hcoll/hcoll_init.c
+++ b/src/mpid/common/hcoll/hcoll_init.c
@@ -23,6 +23,7 @@ int hcoll_destroy(void *param ATTRIBUTE((unused)))
 {
     if (1 == hcoll_initialized) {
         hcoll_finalize();
+        MPID_Progress_deregister_hook(hcoll_do_progress);
     }
     hcoll_initialized = 0;
     return 0;
@@ -79,7 +80,11 @@ int hcoll_initialize(void)
     if (mpi_errno)
         MPIU_ERR_POP(mpi_errno);
 
-    hcoll_initialized = 1;
+    if (!hcoll_initialized) {
+        hcoll_initialized = 1;
+        mpi_errno = MPID_Progress_register_hook(hcoll_do_progress);
+        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    }
     MPIR_Add_finalize(hcoll_destroy, 0, 0);
 
     mpi_errno =
@@ -213,11 +218,11 @@ int hcoll_comm_destroy(MPID_Comm * comm_ptr, void *param)
     goto fn_exit;
 }
 
-int hcoll_do_progress(void)
+int hcoll_do_progress(int *made_progress)
 {
-    if (1 == hcoll_initialized) {
-        hcoll_progress_fn();
-    }
+    if (made_progress)
+        *made_progress = 0;
+    hcoll_progress_fn();
 
     return MPI_SUCCESS;
 }
diff --git a/src/mpid/common/sched/mpid_sched.c b/src/mpid/common/sched/mpid_sched.c
index b01a4d3..52304e1 100644
--- a/src/mpid/common/sched/mpid_sched.c
+++ b/src/mpid/common/sched/mpid_sched.c
@@ -409,6 +409,10 @@ int MPID_Sched_start(MPID_Sched_t *sp, MPID_Comm *comm, int tag, MPID_Request **
 
     /* finally, enqueue in the list of all pending schedules so that the
      * progress engine can make progress on it */
+    if (all_schedules.head == NULL) {
+        mpi_errno = MPID_Progress_register_hook(MPIDU_Sched_progress);
+        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    }
     MPL_DL_APPEND(all_schedules.head, s);
 
     MPIU_DBG_MSG_P(COMM, TYPICAL, "started schedule s=%p\n", s);
@@ -936,7 +940,13 @@ fn_fail:
 #define FCNAME MPIU_QUOTE(FUNCNAME)
 int MPIDU_Sched_progress(int *made_progress)
 {
-    return MPIDU_Sched_progress_state(&all_schedules, made_progress);
+    int mpi_errno;
+
+    mpi_errno = MPIDU_Sched_progress_state(&all_schedules, made_progress);
+    if (!mpi_errno && all_schedules.head == NULL)
+        MPIDI_CH3I_Progress_deregister_hook(MPIDU_Sched_progress);
+
+    return mpi_errno;
 }
 
 static const char *entry_to_str(enum MPIDU_Sched_entry_type type) ATTRIBUTE((unused,used));

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

Summary of changes:
 src/mpi/errhan/errnames.txt                        |    1 +
 .../ch3/channels/nemesis/include/mpidi_ch3_impl.h  |    2 +
 src/mpid/ch3/channels/nemesis/src/ch3_progress.c   |   96 +++++++++++---
 .../ch3/channels/sock/include/mpidi_ch3_impl.h     |    2 +
 src/mpid/ch3/channels/sock/src/ch3_progress.c      |  132 +++++++++++++-------
 src/mpid/ch3/include/mpidimpl.h                    |    7 +
 src/mpid/ch3/src/mpid_rma.c                        |    5 +
 src/mpid/ch3/src/mpidi_rma.c                       |    3 +
 src/mpid/common/hcoll/hcoll.h                      |    2 +-
 src/mpid/common/hcoll/hcoll_init.c                 |   15 ++-
 src/mpid/common/sched/mpid_sched.c                 |   12 ++-
 src/mpid/pamid/include/mpidimpl.h                  |    6 +
 src/mpid/pamid/src/mpid_progress.c                 |   81 ++++++++++++
 13 files changed, 290 insertions(+), 74 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list