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

Service Account noreply at mpich.org
Tue Jul 21 22:00:59 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  7ca8ec3fc9421261dcab47af36a9f5e4ef6c2e28 (commit)
       via  aceee6d924abce30a14da0f1bb53ddedd841c99c (commit)
      from  3ad0e71d9232c84d2b3eae9d72f1b2198c379f71 (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/7ca8ec3fc9421261dcab47af36a9f5e4ef6c2e28

commit 7ca8ec3fc9421261dcab47af36a9f5e4ef6c2e28
Author: Xin Zhao <xinzhao3 at illinois.edu>
Date:   Tue Jul 21 21:15:32 2015 -0500

    Modify comments about request completion callback.
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/src/include/mpiimpl.h b/src/include/mpiimpl.h
index cab4045..d90f8de 100644
--- a/src/include/mpiimpl.h
+++ b/src/include/mpiimpl.h
@@ -1547,9 +1547,28 @@ typedef struct MPID_Request {
     /* Errflag for NBC requests. Not used by other requests. */
     mpir_errflag_t errflag;
 
-    /* request_completed_cb: the callback function triggered when this request
-     * is completed, i.e. CC is set to 0. Inside request_completed_cb, progress
-     * engine should not be called. */
+    /* Notes about request_completed_cb:
+     *
+     *   1. The callback function is triggered when this requests
+     *      completion count reaches 0.
+     *
+     *   2. The callback function should be nonblocking.
+     *
+     *   3. The callback function should not poke the progress engine,
+     *      or call any function that pokes the progress engine.
+     *
+     *   4. The callback function can complete other requests, thus
+     *      calling those requests' callback functions.  However, the
+     *      recursion depth of request completion function is limited.
+     *      If we ever need deeper recurisve calls, we need to change
+     *      to an iterative design instead of a recursive design for
+     *      request completion.
+     *
+     *   5. In multithreaded programs, since the callback function is
+     *      nonblocking and never calls the progress engine, it would
+     *      never yield the lock to other threads.  So the recursion
+     *      should be multithreading-safe.
+     */
     int (*request_completed_cb)(struct MPID_Request *);
 
     /* Other, device-specific information */

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

commit aceee6d924abce30a14da0f1bb53ddedd841c99c
Author: Xin Zhao <xinzhao3 at illinois.edu>
Date:   Tue Jul 21 21:14:41 2015 -0500

    Add an assert to check the recursion depth of MPID_Request_complete.
    
    We allow a depth of up to 2 for recursive calls of
    MPID_Request_complete.  Arbitrary levels of recursion can cause weird
    failures that might be hard to debug.  For now, a level of two is
    sufficient.  Currently this only happens when completing the user
    request in request-based RMA operations.
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/src/mpid/ch3/src/ch3u_request.c b/src/mpid/ch3/src/ch3u_request.c
index 63e444c..53230f1 100644
--- a/src/mpid/ch3/src/ch3u_request.c
+++ b/src/mpid/ch3/src/ch3u_request.c
@@ -21,6 +21,9 @@
 #define MPID_REQUEST_PREALLOC 8
 #endif
 
+/* Max depth of recursive calls of MPID_Request_complete */
+#define REQUEST_CB_DEPTH 2
+
 MPID_Request MPID_Request_direct[MPID_REQUEST_PREALLOC] = {{0}};
 MPIU_Object_alloc_t MPID_Request_mem = {
     0, 0, 0, 0, MPID_REQUEST, sizeof(MPID_Request), MPID_Request_direct,
@@ -611,6 +614,10 @@ int MPID_Request_complete(MPID_Request *req)
 {
     int incomplete;
     int mpi_errno = MPI_SUCCESS;
+    static int called_cnt = 0;
+
+    MPIU_Assert(called_cnt <= REQUEST_CB_DEPTH);
+    called_cnt++;
 
     MPIDI_CH3U_Request_decrement_cc(req, &incomplete);
     if (!incomplete) {
@@ -627,6 +634,7 @@ int MPID_Request_complete(MPID_Request *req)
     }
 
  fn_exit:
+    called_cnt--;
     return mpi_errno;
  fn_fail:
     goto fn_exit;

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

Summary of changes:
 src/include/mpiimpl.h           |   25 ++++++++++++++++++++++---
 src/mpid/ch3/src/ch3u_request.c |    8 ++++++++
 2 files changed, 30 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list