[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2-87-g7150bbc

Service Account noreply at mpich.org
Wed Jan 6 13:22:35 CST 2016


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  7150bbc02ec87d6320fe73fc71b904836642cad4 (commit)
      from  42f00d4b2660d9fbc3fd4f444e61fab018aea44c (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/7150bbc02ec87d6320fe73fc71b904836642cad4

commit 7150bbc02ec87d6320fe73fc71b904836642cad4
Author: Lena Oden <loden at anl.gov>
Date:   Fri Dec 18 15:47:35 2015 -0600

    Renaming of MPID_Sched functions to MPIDU_Sched
    
    This patch renames the scheduling functions in mpid/sched/comm
    from the MPID to the MPIDU namespace. An additional file in
    src/mpid/ch3/include/ is created to rename back to the MPID
    namespace for ch3
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/include/mpir_nbc.h b/src/include/mpir_nbc.h
index faca4ef..bc70dbf 100644
--- a/src/include/mpir_nbc.h
+++ b/src/include/mpir_nbc.h
@@ -41,6 +41,8 @@
  * mechanism as well.
  */
 
+#define MPID_SCHED_NULL (NULL)
+
 /* Open question: should tag allocation be rolled into Sched_start?  Keeping it
  * separate potentially allows more parallelism in the future, but it also
  * pushes more work onto the clients of this interface. */
@@ -98,12 +100,6 @@ int MPID_Sched_send_defer(const void *buf, const MPI_Aint *count, MPI_Datatype d
  * useful in conjunction with MPID_Sched_send_defer. */
 int MPID_Sched_recv_status(void *buf, MPI_Aint count, MPI_Datatype datatype, int src, MPID_Comm *comm, MPI_Status *status, MPID_Sched_t s);
 
-/* Sched_cb_t funcitons take a comm parameter, the value of which will be the
- * comm passed to Sched_start */
-/* callback entries must be used judiciously, otherwise they will prevent
- * caching opportunities */
-typedef int (MPID_Sched_cb_t)(MPID_Comm *comm, int tag, void *state);
-typedef int (MPID_Sched_cb2_t)(MPID_Comm *comm, int tag, void *state, void *state2);
 /* buffer management, fancy reductions, etc */
 int MPID_Sched_cb(MPID_Sched_cb_t *cb_p, void *cb_state, MPID_Sched_t s);
 int MPID_Sched_cb2(MPID_Sched_cb2_t *cb_p, void *cb_state, void *cb_state2, MPID_Sched_t s);
diff --git a/src/mpid/Makefile.mk b/src/mpid/Makefile.mk
index fda4667..b1a06ae 100644
--- a/src/mpid/Makefile.mk
+++ b/src/mpid/Makefile.mk
@@ -5,6 +5,12 @@
 ##     See COPYRIGHT in top-level directory.
 ##
 
+AM_CPPFLAGS += -I$(top_srcdir)/src/mpid/include
+
+noinst_HEADERS +=                          \
+    src/mpid/include/mpidu_pre.h
+
+
 include $(top_srcdir)/src/mpid/ch3/Makefile.mk
 include $(top_srcdir)/src/mpid/pamid/Makefile.mk
 include $(top_srcdir)/src/mpid/common/Makefile.mk
diff --git a/src/mpid/ch3/Makefile.mk b/src/mpid/ch3/Makefile.mk
index e04f49d..5e16b40 100644
--- a/src/mpid/ch3/Makefile.mk
+++ b/src/mpid/ch3/Makefile.mk
@@ -21,7 +21,8 @@ noinst_HEADERS +=                      \
     src/mpid/ch3/include/mpidpost.h    \
     src/mpid/ch3/include/mpidpre.h     \
     src/mpid/ch3/include/mpid_thread.h \
-    src/mpid/ch3/include/mpidrma.h
+    src/mpid/ch3/include/mpidrma.h     \
+    src/mpid/ch3/include/mpid_sched.h
 
 include $(top_srcdir)/src/mpid/ch3/src/Makefile.mk
 include $(top_srcdir)/src/mpid/ch3/util/Makefile.mk
diff --git a/src/mpid/ch3/include/mpid_sched.h b/src/mpid/ch3/include/mpid_sched.h
new file mode 100644
index 0000000..5b82fac
--- /dev/null
+++ b/src/mpid/ch3/include/mpid_sched.h
@@ -0,0 +1,26 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2015 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef MPID_SCHED_H_INCLUDED
+#define MPID_SCHED_H_INCLUDED
+#include "mpidu_sched.h"
+
+#define MPID_Sched_cb MPIDU_Sched_cb
+#define MPID_Sched_cb2 MPIDU_Sched_cb2
+#define MPID_Sched_next_tag  MPIDU_Sched_next_tag
+#define MPID_Sched_create MPIDU_Sched_create
+#define MPID_Sched_clone MPIDU_Sched_clone
+#define MPID_Sched_start MPIDU_Sched_start
+#define MPID_Sched_send MPIDU_Sched_send
+#define MPID_Sched_send_defer MPIDU_Sched_send_defer
+#define MPID_Sched_recv MPIDU_Sched_recv
+#define MPID_Sched_recv_status MPIDU_Sched_recv_status
+#define MPID_Sched_ssend MPIDU_Sched_ssend
+#define MPID_Sched_reduce MPIDU_Sched_reduce
+#define MPID_Sched_copy MPIDU_Sched_copy
+#define MPID_Sched_barrier MPIDU_Sched_barrier
+
+#endif /* MPID_SCHED_H_INCLUDED */
diff --git a/src/mpid/ch3/include/mpidimpl.h b/src/mpid/ch3/include/mpidimpl.h
index 3b04c34..b94f886 100644
--- a/src/mpid/ch3/include/mpidimpl.h
+++ b/src/mpid/ch3/include/mpidimpl.h
@@ -21,17 +21,11 @@
 
 #include "mpiimpl.h"
 
-#if !defined(MPICH_MPIDPRE_H_INCLUDED)
-#include "mpidpre.h"
-#endif
-
 #include "mpidftb.h"
 
 /* Add the ch3 packet definitions */
 #include "mpidpkt.h"
 
-#include "mpid_sched.h"
-
 /* We need to match the size of MPIU_Pint to the relevant Format control
  */
 #define MPIDI_MSG_SZ_FMT MPIU_PINT_FMT_DEC_SPEC
diff --git a/src/mpid/ch3/include/mpidpre.h b/src/mpid/ch3/include/mpidpre.h
index 9a25b58..32ae02c 100644
--- a/src/mpid/ch3/include/mpidpre.h
+++ b/src/mpid/ch3/include/mpidpre.h
@@ -28,6 +28,8 @@ typedef MPIU_Pint MPIDI_msg_sz_t;
 
 #include "mpid_thread.h"
 
+#include "mpid_sched.h"
+
 /* We simply use the fallback timer functionality and do not define
  * our own */
 #include "mpid_timers_fallback.h"
@@ -84,9 +86,6 @@ typedef int32_t MPIDI_Rank_t;
 typedef MPIDI_Rank_t MPID_Node_id_t;
 
 
-/* provides "pre" typedefs and such for NBC scheduling mechanism */
-#include "mpid_sched_pre.h"
-
 /* For the typical communication system for which the ch3 channel is
    appropriate, 16 bits is sufficient for the rank.  By also using 16
    bits for the context, we can reduce the size of the match
diff --git a/src/mpid/common/sched/Makefile.mk b/src/mpid/common/sched/Makefile.mk
index 3dbfe06..660bc78 100644
--- a/src/mpid/common/sched/Makefile.mk
+++ b/src/mpid/common/sched/Makefile.mk
@@ -8,15 +8,14 @@
 if BUILD_MPID_COMMON_SCHED
 
 mpi_core_sources +=      \
-    src/mpid/common/sched/mpid_sched.c
+    src/mpid/common/sched/mpidu_sched.c
 
 # so that the the device (e.g., ch3) can successfully include mpid_sched_pre.h
 # There are no AC_OUTPUT_FILES, so the builddir path does not need to be added.
 AM_CPPFLAGS += -I$(top_srcdir)/src/mpid/common/sched
 
 noinst_HEADERS +=                          \
-    src/mpid/common/sched/mpid_sched.h     \
-    src/mpid/common/sched/mpid_sched_pre.h
+    src/mpid/common/sched/mpidu_sched.h
 
 
 endif BUILD_MPID_COMMON_SCHED
diff --git a/src/mpid/common/sched/mpid_sched_pre.h b/src/mpid/common/sched/mpid_sched_pre.h
deleted file mode 100644
index 4fe5c7d..0000000
--- a/src/mpid/common/sched/mpid_sched_pre.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* -*- Mode: c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
-/*
- *  (C) 2011 by Argonne National Laboratory.
- *      See COPYRIGHT in top-level directory.
- */
-
-/* this file should be included by the using device's mpidpre.h */
-
-#ifndef MPID_SCHED_PRE_H_INCLUDED
-#define MPID_SCHED_PRE_H_INCLUDED
-
-#define MPID_SCHED_NULL (NULL)
-struct MPIDU_Sched; /* forward decl, see mpidimpl.h for actual decl */
-typedef struct MPIDU_Sched * MPID_Sched_t;
-
-#endif /* !defined(MPID_SCHED_PRE_H_INCLUDED) */
diff --git a/src/mpid/common/sched/mpid_sched.c b/src/mpid/common/sched/mpidu_sched.c
similarity index 63%
rename from src/mpid/common/sched/mpid_sched.c
rename to src/mpid/common/sched/mpidu_sched.c
index b3c14c8..5c3ca7c 100644
--- a/src/mpid/common/sched/mpid_sched.c
+++ b/src/mpid/common/sched/mpidu_sched.c
@@ -15,7 +15,7 @@
 #define dprintf fprintf
 #else
 /* FIXME this requires VA_ARGS macros */
-#define dprintf(...) do{}while(0)
+#define dprintf(...) do {} while (0)
 #endif
 
 /* helper macros to improve code readability */
@@ -44,7 +44,7 @@
 
 /* TODO move to a header somewhere? */
 void MPIDU_Sched_dump(struct MPIDU_Sched *s);
-void MPIDU_Sched_dump_fh(struct MPIDU_Sched *s, FILE *fh);
+void MPIDU_Sched_dump_fh(struct MPIDU_Sched *s, FILE * fh);
 
 struct MPIDU_Sched_state {
     struct MPIDU_Sched *head;
@@ -52,7 +52,7 @@ struct MPIDU_Sched_state {
 };
 
 /* holds on to all incomplete schedules on which progress should be made */
-struct MPIDU_Sched_state all_schedules = {NULL};
+struct MPIDU_Sched_state all_schedules = { NULL };
 
 static int nbc_progress_hook_id = 0;
 
@@ -68,10 +68,10 @@ int MPIDU_Sched_are_pending(void)
 }
 
 #undef FUNCNAME
-#define FUNCNAME MPID_Sched_next_tag
+#define FUNCNAME MPIDU_Sched_next_tag
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-int MPID_Sched_next_tag(MPID_Comm *comm_ptr, int *tag)
+int MPIDU_Sched_next_tag(MPID_Comm * comm_ptr, int *tag)
 {
     int mpi_errno = MPI_SUCCESS;
     /* TODO there should be an internal accessor/utility macro for getting the
@@ -113,7 +113,7 @@ int MPID_Sched_next_tag(MPID_Comm *comm_ptr, int *tag)
         comm_ptr->next_sched_tag = MPIR_FIRST_NBC_TAG;
     }
 
-fn_fail:
+  fn_fail:
     return mpi_errno;
 }
 
@@ -133,140 +133,152 @@ static int MPIDU_Sched_start_entry(struct MPIDU_Sched *s, size_t idx, struct MPI
     MPIU_Assert(e->status == MPIDU_SCHED_ENTRY_STATUS_NOT_STARTED);
 
     switch (e->type) {
-        case MPIDU_SCHED_ENTRY_SEND:
-            comm = e->u.send.comm;
-            MPIU_DBG_MSG_D(COMM, VERBOSE, "starting SEND entry %d\n", (int) idx);
-            if (e->u.send.count_p) {
-                /* deferred send */
-                /* originally there was no branch and send.count_p was set to
-                 * &send.count, but this requires patching up the pointers
-                 * during realloc of entries, so this is easier */
-                ret_errno = MPIC_Isend(e->u.send.buf, *e->u.send.count_p, e->u.send.datatype,
-                                       e->u.send.dest, s->tag, comm, &e->u.send.sreq, &r->errflag);
+    case MPIDU_SCHED_ENTRY_SEND:
+        comm = e->u.send.comm;
+        MPIU_DBG_MSG_D(COMM, VERBOSE, "starting SEND entry %d\n", (int) idx);
+        if (e->u.send.count_p) {
+            /* deferred send */
+            /* originally there was no branch and send.count_p was set to
+             * &send.count, but this requires patching up the pointers
+             * during realloc of entries, so this is easier */
+            ret_errno = MPIC_Isend(e->u.send.buf, *e->u.send.count_p, e->u.send.datatype,
+                                   e->u.send.dest, s->tag, comm, &e->u.send.sreq, &r->errflag);
+        }
+        else {
+            if (e->u.send.is_sync) {
+                ret_errno = MPIC_Issend(e->u.send.buf, e->u.send.count, e->u.send.datatype,
+                                        e->u.send.dest, s->tag, comm, &e->u.send.sreq, &r->errflag);
             }
             else {
-                if (e->u.send.is_sync) {
-                    ret_errno = MPIC_Issend(e->u.send.buf, e->u.send.count, e->u.send.datatype,
-                                            e->u.send.dest, s->tag, comm, &e->u.send.sreq, &r->errflag);
+                ret_errno = MPIC_Isend(e->u.send.buf, e->u.send.count, e->u.send.datatype,
+                                       e->u.send.dest, s->tag, comm, &e->u.send.sreq, &r->errflag);
+            }
+        }
+        /* Check if the error is actually fatal to the NBC or we can continue. */
+        if (unlikely(ret_errno)) {
+            if (MPIR_ERR_NONE == r->errflag) {
+                if (MPIX_ERR_PROC_FAILED == MPIR_ERR_GET_CLASS(ret_errno)) {
+                    r->errflag = MPIR_ERR_PROC_FAILED;
+                }
+                else {
+                    r->errflag = MPIR_ERR_OTHER;
+                }
+            }
+            e->status = MPIDU_SCHED_ENTRY_STATUS_FAILED;
+            MPIU_DBG_MSG_D(COMM, VERBOSE, "Sched SEND failed. Errflag: %d\n", (int) r->errflag);
+        }
+        else {
+            e->status = MPIDU_SCHED_ENTRY_STATUS_STARTED;
+        }
+        break;
+    case MPIDU_SCHED_ENTRY_RECV:
+        MPIU_DBG_MSG_D(COMM, VERBOSE, "starting RECV entry %d\n", (int) idx);
+        comm = e->u.recv.comm;
+        ret_errno = MPIC_Irecv(e->u.recv.buf, e->u.recv.count, e->u.recv.datatype,
+                               e->u.recv.src, s->tag, comm, &e->u.recv.rreq);
+        /* Check if the error is actually fatal to the NBC or we can continue. */
+        if (unlikely(ret_errno)) {
+            if (MPIR_ERR_NONE == r->errflag) {
+                if (MPIX_ERR_PROC_FAILED == MPIR_ERR_GET_CLASS(ret_errno)) {
+                    r->errflag = MPIR_ERR_PROC_FAILED;
                 }
                 else {
-                    ret_errno = MPIC_Isend(e->u.send.buf, e->u.send.count, e->u.send.datatype,
-                                           e->u.send.dest, s->tag, comm, &e->u.send.sreq, &r->errflag);
+                    r->errflag = MPIR_ERR_OTHER;
                 }
             }
-            /* Check if the error is actually fatal to the NBC or we can continue. */
+            /* We should set the status to failed here - since the request is not freed. this
+             * will be handled later in MPIDU_Sched_progress_state, so set to started here */
+            e->status = MPIDU_SCHED_ENTRY_STATUS_STARTED;
+            MPIU_DBG_MSG_D(COMM, VERBOSE, "Sched RECV failed. Errflag: %d\n", (int) r->errflag);
+        }
+        else {
+            e->status = MPIDU_SCHED_ENTRY_STATUS_STARTED;
+        }
+        break;
+    case MPIDU_SCHED_ENTRY_REDUCE:
+        MPIU_DBG_MSG_D(COMM, VERBOSE, "starting REDUCE entry %d\n", (int) idx);
+        mpi_errno =
+            MPIR_Reduce_local_impl(e->u.reduce.inbuf, e->u.reduce.inoutbuf, e->u.reduce.count,
+                                   e->u.reduce.datatype, e->u.reduce.op);
+        if (mpi_errno)
+            MPIR_ERR_POP(mpi_errno);
+        if (HANDLE_GET_KIND(e->u.reduce.op) != HANDLE_KIND_BUILTIN) {
+            MPID_Op *op_ptr = NULL;
+            MPID_Op_get_ptr(e->u.reduce.op, op_ptr);
+            MPIR_Op_release(op_ptr);
+        }
+        dtype_release_if_not_builtin(e->u.reduce.datatype);
+        e->status = MPIDU_SCHED_ENTRY_STATUS_COMPLETE;
+        break;
+    case MPIDU_SCHED_ENTRY_COPY:
+        MPIU_DBG_MSG_D(COMM, VERBOSE, "starting COPY entry %d\n", (int) idx);
+        mpi_errno = MPIR_Localcopy(e->u.copy.inbuf, e->u.copy.incount, e->u.copy.intype,
+                                   e->u.copy.outbuf, e->u.copy.outcount, e->u.copy.outtype);
+        if (mpi_errno)
+            MPIR_ERR_POP(mpi_errno);
+        dtype_release_if_not_builtin(e->u.copy.intype);
+        dtype_release_if_not_builtin(e->u.copy.outtype);
+        e->status = MPIDU_SCHED_ENTRY_STATUS_COMPLETE;
+        break;
+    case MPIDU_SCHED_ENTRY_NOP:
+        MPIU_DBG_MSG_D(COMM, VERBOSE, "starting NOOP entry %d\n", (int) idx);
+        /* nothing to be done */
+        break;
+    case MPIDU_SCHED_ENTRY_CB:
+        MPIU_DBG_MSG_D(COMM, VERBOSE, "starting CB entry %d\n", (int) idx);
+        if (e->u.cb.cb_type == MPIDU_SCHED_CB_TYPE_1) {
+            ret_errno = e->u.cb.u.cb_p(r->comm, s->tag, e->u.cb.cb_state);
+            /* Sched entries list can be reallocated inside callback */
+            e = &s->entries[idx];
             if (unlikely(ret_errno)) {
                 if (MPIR_ERR_NONE == r->errflag) {
                     if (MPIX_ERR_PROC_FAILED == MPIR_ERR_GET_CLASS(ret_errno)) {
                         r->errflag = MPIR_ERR_PROC_FAILED;
-                    } else {
+                    }
+                    else {
                         r->errflag = MPIR_ERR_OTHER;
                     }
                 }
                 e->status = MPIDU_SCHED_ENTRY_STATUS_FAILED;
-                MPIU_DBG_MSG_D(COMM, VERBOSE, "Sched SEND failed. Errflag: %d\n", (int) r->errflag);
-            } else {
-                e->status = MPIDU_SCHED_ENTRY_STATUS_STARTED;
             }
-            break;
-        case MPIDU_SCHED_ENTRY_RECV:
-            MPIU_DBG_MSG_D(COMM, VERBOSE, "starting RECV entry %d\n", (int) idx);
-            comm = e->u.recv.comm;
-            ret_errno = MPIC_Irecv(e->u.recv.buf, e->u.recv.count, e->u.recv.datatype,
-                                   e->u.recv.src, s->tag, comm, &e->u.recv.rreq);
-            /* Check if the error is actually fatal to the NBC or we can continue. */
+            else {
+                e->status = MPIDU_SCHED_ENTRY_STATUS_COMPLETE;
+            }
+        }
+        else if (e->u.cb.cb_type == MPIDU_SCHED_CB_TYPE_2) {
+            ret_errno = e->u.cb.u.cb2_p(r->comm, s->tag, e->u.cb.cb_state, e->u.cb.cb_state2);
+            /* Sched entries list can be reallocated inside callback */
+            e = &s->entries[idx];
             if (unlikely(ret_errno)) {
                 if (MPIR_ERR_NONE == r->errflag) {
                     if (MPIX_ERR_PROC_FAILED == MPIR_ERR_GET_CLASS(ret_errno)) {
                         r->errflag = MPIR_ERR_PROC_FAILED;
-                    } else {
-                        r->errflag = MPIR_ERR_OTHER;
                     }
-                }
-               /* We should set the status to failed here - since the request is not freed. this
-                * will be handled later in MPIDU_Sched_progress_state, so set to started here */
-                e->status = MPIDU_SCHED_ENTRY_STATUS_STARTED;
-                MPIU_DBG_MSG_D(COMM, VERBOSE, "Sched RECV failed. Errflag: %d\n", (int) r->errflag);
-            } else {
-                e->status = MPIDU_SCHED_ENTRY_STATUS_STARTED;
-            }
-            break;
-        case MPIDU_SCHED_ENTRY_REDUCE:
-            MPIU_DBG_MSG_D(COMM, VERBOSE, "starting REDUCE entry %d\n", (int) idx);
-            mpi_errno = MPIR_Reduce_local_impl(e->u.reduce.inbuf, e->u.reduce.inoutbuf, e->u.reduce.count,
-                                               e->u.reduce.datatype, e->u.reduce.op);
-            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
-            if (HANDLE_GET_KIND(e->u.reduce.op) != HANDLE_KIND_BUILTIN) {
-                MPID_Op *op_ptr = NULL;
-                MPID_Op_get_ptr(e->u.reduce.op, op_ptr);
-                MPIR_Op_release(op_ptr);
-            }
-            dtype_release_if_not_builtin(e->u.reduce.datatype);
-            e->status = MPIDU_SCHED_ENTRY_STATUS_COMPLETE;
-            break;
-        case MPIDU_SCHED_ENTRY_COPY:
-            MPIU_DBG_MSG_D(COMM, VERBOSE, "starting COPY entry %d\n", (int) idx);
-            mpi_errno = MPIR_Localcopy(e->u.copy.inbuf, e->u.copy.incount, e->u.copy.intype,
-                                       e->u.copy.outbuf, e->u.copy.outcount, e->u.copy.outtype);
-            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
-            dtype_release_if_not_builtin(e->u.copy.intype);
-            dtype_release_if_not_builtin(e->u.copy.outtype);
-            e->status = MPIDU_SCHED_ENTRY_STATUS_COMPLETE;
-            break;
-        case MPIDU_SCHED_ENTRY_NOP:
-            MPIU_DBG_MSG_D(COMM, VERBOSE, "starting NOOP entry %d\n", (int) idx);
-            /* nothing to be done */
-            break;
-        case MPIDU_SCHED_ENTRY_CB:
-            MPIU_DBG_MSG_D(COMM, VERBOSE, "starting CB entry %d\n", (int) idx);
-            if (e->u.cb.cb_type == MPIDU_SCHED_CB_TYPE_1) {
-                ret_errno = e->u.cb.u.cb_p(r->comm, s->tag, e->u.cb.cb_state);
-                /* Sched entries list can be reallocated inside callback */
-                e = &s->entries[idx];
-                if (unlikely(ret_errno)) {
-                    if (MPIR_ERR_NONE == r->errflag) {
-                        if (MPIX_ERR_PROC_FAILED == MPIR_ERR_GET_CLASS(ret_errno)) {
-                            r->errflag = MPIR_ERR_PROC_FAILED;
-                        } else {
-                            r->errflag = MPIR_ERR_OTHER;
-                        }
-                    }
-                    e->status = MPIDU_SCHED_ENTRY_STATUS_FAILED;
-                } else {
-                    e->status = MPIDU_SCHED_ENTRY_STATUS_COMPLETE;
-                }
-            }
-            else if (e->u.cb.cb_type == MPIDU_SCHED_CB_TYPE_2) {
-                ret_errno = e->u.cb.u.cb2_p(r->comm, s->tag, e->u.cb.cb_state, e->u.cb.cb_state2);
-                /* Sched entries list can be reallocated inside callback */
-                e = &s->entries[idx];
-                if (unlikely(ret_errno)) {
-                    if (MPIR_ERR_NONE == r->errflag) {
-                        if (MPIX_ERR_PROC_FAILED == MPIR_ERR_GET_CLASS(ret_errno)) {
-                            r->errflag = MPIR_ERR_PROC_FAILED;
-                        } else {
-                            r->errflag = MPIR_ERR_OTHER;
-                        }
+                    else {
+                        r->errflag = MPIR_ERR_OTHER;
                     }
-                    e->status = MPIDU_SCHED_ENTRY_STATUS_FAILED;
-                } else {
-                    e->status = MPIDU_SCHED_ENTRY_STATUS_COMPLETE;
                 }
+                e->status = MPIDU_SCHED_ENTRY_STATUS_FAILED;
             }
             else {
-                MPIU_DBG_MSG_D(COMM, TYPICAL, "unknown callback type, e->u.cb.cb_type=%d", e->u.cb.cb_type);
                 e->status = MPIDU_SCHED_ENTRY_STATUS_COMPLETE;
             }
+        }
+        else {
+            MPIU_DBG_MSG_D(COMM, TYPICAL, "unknown callback type, e->u.cb.cb_type=%d",
+                           e->u.cb.cb_type);
+            e->status = MPIDU_SCHED_ENTRY_STATUS_COMPLETE;
+        }
 
-            break;
-        default:
-            MPIU_DBG_MSG_D(COMM, TYPICAL, "unknown entry type, e->type=%d", e->type);
-            break;
+        break;
+    default:
+        MPIU_DBG_MSG_D(COMM, TYPICAL, "unknown entry type, e->type=%d", e->type);
+        break;
     }
 
-fn_exit:
+  fn_exit:
     return mpi_errno;
-fn_fail:
+  fn_fail:
     e->status = MPIDU_SCHED_ENTRY_STATUS_FAILED;
     if (r)
         r->status.MPI_ERROR = mpi_errno;
@@ -292,34 +304,35 @@ static int MPIDU_Sched_continue(struct MPIDU_Sched *s)
             mpi_errno = MPIDU_Sched_start_entry(s, i, e);
             /* Sched entries list can be reallocated inside callback */
             e = &s->entries[i];
-            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
+            if (mpi_errno)
+                MPIR_ERR_POP(mpi_errno);
         }
 
         /* _start_entry may have completed the operation, but won't update s->idx */
         if (i == s->idx && e->status >= MPIDU_SCHED_ENTRY_STATUS_COMPLETE) {
-            ++s->idx; /* this is valid even for barrier entries */
+            ++s->idx;   /* this is valid even for barrier entries */
         }
 
         /* watch the indexing, s->idx might have been incremented above, so
          * ||-short-circuit matters here */
-        if (e->is_barrier && (e->status < MPIDU_SCHED_ENTRY_STATUS_COMPLETE || (s->idx != i+1))) {
+        if (e->is_barrier && (e->status < MPIDU_SCHED_ENTRY_STATUS_COMPLETE || (s->idx != i + 1))) {
             /* we've hit a barrier but outstanding operations before this
              * barrier remain, so we cannot proceed past the barrier */
             break;
         }
     }
-fn_exit:
+  fn_exit:
     return mpi_errno;
-fn_fail:
+  fn_fail:
     goto fn_exit;
 }
 
 #undef FUNCNAME
-#define FUNCNAME MPID_Sched_create
+#define FUNCNAME MPIDU_Sched_create
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
 /* creates a new opaque schedule object and returns a handle to it in (*sp) */
-int MPID_Sched_create(MPID_Sched_t *sp)
+int MPIDU_Sched_create(MPID_Sched_t * sp)
 {
     int mpi_errno = MPI_SUCCESS;
     struct MPIDU_Sched *s;
@@ -328,7 +341,8 @@ int MPID_Sched_create(MPID_Sched_t *sp)
     *sp = NULL;
 
     /* this mem will be freed by the progress engine when the request is completed */
-    MPIU_CHKPMEM_MALLOC(s, struct MPIDU_Sched *, sizeof(struct MPIDU_Sched), mpi_errno, "schedule object");
+    MPIU_CHKPMEM_MALLOC(s, struct MPIDU_Sched *, sizeof(struct MPIDU_Sched), mpi_errno,
+                        "schedule object");
 
     s->size = MPIDU_SCHED_INITIAL_ENTRIES;
     s->idx = 0;
@@ -336,29 +350,31 @@ int MPID_Sched_create(MPID_Sched_t *sp)
     s->tag = -1;
     s->req = NULL;
     s->entries = NULL;
-    s->next = NULL; /* only needed for sanity checks */
-    s->prev = NULL; /* only needed for sanity checks */
+    s->next = NULL;     /* only needed for sanity checks */
+    s->prev = NULL;     /* only needed for sanity checks */
 
     /* this mem will be freed by the progress engine when the request is completed */
-    MPIU_CHKPMEM_MALLOC(s->entries, struct MPIDU_Sched_entry *, MPIDU_SCHED_INITIAL_ENTRIES*sizeof(struct MPIDU_Sched_entry), mpi_errno, "schedule entries vector");
+    MPIU_CHKPMEM_MALLOC(s->entries, struct MPIDU_Sched_entry *,
+                        MPIDU_SCHED_INITIAL_ENTRIES * sizeof(struct MPIDU_Sched_entry), mpi_errno,
+                        "schedule entries vector");
 
     /* TODO in a debug build, defensively mark all entries as status=INVALID */
 
     MPIU_CHKPMEM_COMMIT();
     *sp = s;
-fn_exit:
+  fn_exit:
     return mpi_errno;
-fn_fail:
+  fn_fail:
     MPIU_CHKPMEM_REAP();
     goto fn_exit;
 }
 
 #undef FUNCNAME
-#define FUNCNAME MPID_Sched_clone
+#define FUNCNAME MPIDU_Sched_clone
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
 /* clones orig and returns a handle to the new schedule in (*cloned) */
-int MPID_Sched_clone(MPID_Sched_t orig, MPID_Sched_t *cloned)
+int MPIDU_Sched_clone(MPID_Sched_t orig, MPID_Sched_t * cloned)
 {
     int mpi_errno = MPI_SUCCESS;
     /* TODO implement this function for real */
@@ -368,12 +384,12 @@ int MPID_Sched_clone(MPID_Sched_t orig, MPID_Sched_t *cloned)
 }
 
 #undef FUNCNAME
-#define FUNCNAME MPID_Sched_start
+#define FUNCNAME MPIDU_Sched_start
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
 /* sets (*sp) to MPID_SCHED_NULL and gives you back a request pointer in (*req).
  * The caller is giving up ownership of the opaque schedule object. */
-int MPID_Sched_start(MPID_Sched_t *sp, MPID_Comm *comm, int tag, MPID_Request **req)
+int MPIDU_Sched_start(MPID_Sched_t * sp, MPID_Comm * comm, int tag, MPID_Request ** req)
 {
     int mpi_errno = MPI_SUCCESS;
     MPID_Request *r;
@@ -392,7 +408,8 @@ int MPID_Sched_start(MPID_Sched_t *sp, MPID_Comm *comm, int tag, MPID_Request **
 
     /* now create and populate the request */
     r = MPID_Request_create();
-    if (!r) MPIR_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem");
+    if (!r)
+        MPIR_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**nomem");
     r->kind = MPID_COLL_REQUEST;
     /* FIXME is this right when comm/datatype GC is used? */
     MPIR_Comm_add_ref(comm);
@@ -410,14 +427,15 @@ int MPID_Sched_start(MPID_Sched_t *sp, MPID_Comm *comm, int tag, MPID_Request **
      * engine about this req+sched, otherwise we have more MT issues to worry
      * about.  Skipping this step will increase latency. */
     mpi_errno = MPIDU_Sched_continue(s);
-    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
+    if (mpi_errno)
+        MPIR_ERR_POP(mpi_errno);
 
     /* 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,
-                                                &nbc_progress_hook_id);
-        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
+        mpi_errno = MPID_Progress_register_hook(MPIDU_Sched_progress, &nbc_progress_hook_id);
+        if (mpi_errno)
+            MPIR_ERR_POP(mpi_errno);
 
         MPID_Progress_activate_hook(nbc_progress_hook_id);
     }
@@ -426,14 +444,14 @@ int MPID_Sched_start(MPID_Sched_t *sp, MPID_Comm *comm, int tag, MPID_Request **
     MPIU_DBG_MSG_P(COMM, TYPICAL, "started schedule s=%p\n", s);
     MPIDU_Sched_dump(s);
 
-fn_exit:
+  fn_exit:
     return mpi_errno;
-fn_fail:
+  fn_fail:
     if (*req)
         *req = NULL;
     if (r) {
-        MPID_Request_release(r); /* the schedule's ref */
-        MPID_Request_release(r); /* the user's ref */
+        MPID_Request_release(r);        /* the schedule's ref */
+        MPID_Request_release(r);        /* the user's ref */
     }
 
     goto fn_exit;
@@ -456,8 +474,9 @@ static int MPIDU_Sched_add_entry(struct MPIDU_Sched *s, int *idx, struct MPIDU_S
 
     if (s->num_entries == s->size) {
         /* need to grow the entries array */
-        s->entries = MPIU_Realloc(s->entries, 2*s->size*sizeof(struct MPIDU_Sched_entry));
-        if (s->entries == NULL) MPIR_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem");
+        s->entries = MPIU_Realloc(s->entries, 2 * s->size * sizeof(struct MPIDU_Sched_entry));
+        if (s->entries == NULL)
+            MPIR_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**nomem");
         s->size *= 2;
     }
 
@@ -468,24 +487,26 @@ static int MPIDU_Sched_add_entry(struct MPIDU_Sched *s, int *idx, struct MPIDU_S
         *idx = i;
     if (e != NULL)
         *e = ei;
-fn_exit:
+  fn_exit:
     return mpi_errno;
-fn_fail:
+  fn_fail:
     goto fn_exit;
 }
 
 #undef FUNCNAME
-#define FUNCNAME MPID_Sched_send
+#define FUNCNAME MPIDU_Sched_send
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
 /* do these ops need an entry handle returned? */
-int MPID_Sched_send(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s)
+int MPIDU_Sched_send(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest,
+                     MPID_Comm * comm, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
     struct MPIDU_Sched_entry *e = NULL;
 
     mpi_errno = MPIDU_Sched_add_entry(s, NULL, &e);
-    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
+    if (mpi_errno)
+        MPIR_ERR_POP(mpi_errno);
 
     e->type = MPIDU_SCHED_ENTRY_SEND;
     e->status = MPIDU_SCHED_ENTRY_STATUS_NOT_STARTED;
@@ -496,7 +517,7 @@ int MPID_Sched_send(const void *buf, MPI_Aint count, MPI_Datatype datatype, int
     e->u.send.count_p = NULL;
     e->u.send.datatype = datatype;
     e->u.send.dest = dest;
-    e->u.send.sreq = NULL; /* will be populated by _start_entry */
+    e->u.send.sreq = NULL;      /* will be populated by _start_entry */
     e->u.send.comm = comm;
     e->u.send.is_sync = FALSE;
 
@@ -506,24 +527,26 @@ int MPID_Sched_send(const void *buf, MPI_Aint count, MPI_Datatype datatype, int
     MPIR_Comm_add_ref(comm);
     dtype_add_ref_if_not_builtin(datatype);
 
-fn_exit:
+  fn_exit:
     return mpi_errno;
-fn_fail:
+  fn_fail:
     goto fn_exit;
 }
 
 
 #undef FUNCNAME
-#define FUNCNAME MPID_Sched_ssend
+#define FUNCNAME MPIDU_Sched_ssend
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-int MPID_Sched_ssend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s)
+int MPIDU_Sched_ssend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest,
+                      MPID_Comm * comm, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
     struct MPIDU_Sched_entry *e = NULL;
 
     mpi_errno = MPIDU_Sched_add_entry(s, NULL, &e);
-    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
+    if (mpi_errno)
+        MPIR_ERR_POP(mpi_errno);
 
     e->type = MPIDU_SCHED_ENTRY_SEND;
     e->status = MPIDU_SCHED_ENTRY_STATUS_NOT_STARTED;
@@ -534,7 +557,7 @@ int MPID_Sched_ssend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int
     e->u.send.count_p = NULL;
     e->u.send.datatype = datatype;
     e->u.send.dest = dest;
-    e->u.send.sreq = NULL; /* will be populated by _start_entry */
+    e->u.send.sreq = NULL;      /* will be populated by _start_entry */
     e->u.send.comm = comm;
     e->u.send.is_sync = TRUE;
 
@@ -544,24 +567,26 @@ int MPID_Sched_ssend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int
     MPIR_Comm_add_ref(comm);
     dtype_add_ref_if_not_builtin(datatype);
 
-fn_exit:
+  fn_exit:
     return mpi_errno;
-fn_fail:
+  fn_fail:
     goto fn_exit;
 }
 
 
 #undef FUNCNAME
-#define FUNCNAME MPID_Sched_send_defer
+#define FUNCNAME MPIDU_Sched_send_defer
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-int MPID_Sched_send_defer(const void *buf, const MPI_Aint *count, MPI_Datatype datatype, int dest, MPID_Comm *comm, MPID_Sched_t s)
+int MPIDU_Sched_send_defer(const void *buf, const MPI_Aint * count, MPI_Datatype datatype, int dest,
+                           MPID_Comm * comm, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
     struct MPIDU_Sched_entry *e = NULL;
 
     mpi_errno = MPIDU_Sched_add_entry(s, NULL, &e);
-    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
+    if (mpi_errno)
+        MPIR_ERR_POP(mpi_errno);
 
     e->type = MPIDU_SCHED_ENTRY_SEND;
     e->status = MPIDU_SCHED_ENTRY_STATUS_NOT_STARTED;
@@ -572,7 +597,7 @@ int MPID_Sched_send_defer(const void *buf, const MPI_Aint *count, MPI_Datatype d
     e->u.send.count_p = count;
     e->u.send.datatype = datatype;
     e->u.send.dest = dest;
-    e->u.send.sreq = NULL; /* will be populated by _start_entry */
+    e->u.send.sreq = NULL;      /* will be populated by _start_entry */
     e->u.send.comm = comm;
     e->u.send.is_sync = FALSE;
 
@@ -582,23 +607,25 @@ int MPID_Sched_send_defer(const void *buf, const MPI_Aint *count, MPI_Datatype d
     MPIR_Comm_add_ref(comm);
     dtype_add_ref_if_not_builtin(datatype);
 
-fn_exit:
+  fn_exit:
     return mpi_errno;
-fn_fail:
+  fn_fail:
     goto fn_exit;
 }
 
 #undef FUNCNAME
-#define FUNCNAME MPID_Sched_recv_status
+#define FUNCNAME MPIDU_Sched_recv_status
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-int MPID_Sched_recv_status(void *buf, MPI_Aint count, MPI_Datatype datatype, int src, MPID_Comm *comm, MPI_Status *status, MPID_Sched_t s)
+int MPIDU_Sched_recv_status(void *buf, MPI_Aint count, MPI_Datatype datatype, int src,
+                            MPID_Comm * comm, MPI_Status * status, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
     struct MPIDU_Sched_entry *e = NULL;
 
     mpi_errno = MPIDU_Sched_add_entry(s, NULL, &e);
-    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
+    if (mpi_errno)
+        MPIR_ERR_POP(mpi_errno);
 
     e->type = MPIDU_SCHED_ENTRY_RECV;
     e->status = MPIDU_SCHED_ENTRY_STATUS_NOT_STARTED;
@@ -608,30 +635,32 @@ int MPID_Sched_recv_status(void *buf, MPI_Aint count, MPI_Datatype datatype, int
     e->u.recv.count = count;
     e->u.recv.datatype = datatype;
     e->u.recv.src = src;
-    e->u.recv.rreq = NULL; /* will be populated by _start_entry */
+    e->u.recv.rreq = NULL;      /* will be populated by _start_entry */
     e->u.recv.comm = comm;
     e->u.recv.status = status;
     status->MPI_ERROR = MPI_SUCCESS;
     MPIR_Comm_add_ref(comm);
     dtype_add_ref_if_not_builtin(datatype);
 
-fn_exit:
+  fn_exit:
     return mpi_errno;
-fn_fail:
+  fn_fail:
     goto fn_exit;
 }
 
 #undef FUNCNAME
-#define FUNCNAME MPID_Sched_recv
+#define FUNCNAME MPIDU_Sched_recv
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-int MPID_Sched_recv(void *buf, MPI_Aint count, MPI_Datatype datatype, int src, MPID_Comm *comm, MPID_Sched_t s)
+int MPIDU_Sched_recv(void *buf, MPI_Aint count, MPI_Datatype datatype, int src, MPID_Comm * comm,
+                     MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
     struct MPIDU_Sched_entry *e = NULL;
 
     mpi_errno = MPIDU_Sched_add_entry(s, NULL, &e);
-    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
+    if (mpi_errno)
+        MPIR_ERR_POP(mpi_errno);
 
     e->type = MPIDU_SCHED_ENTRY_RECV;
     e->status = MPIDU_SCHED_ENTRY_STATUS_NOT_STARTED;
@@ -641,31 +670,33 @@ int MPID_Sched_recv(void *buf, MPI_Aint count, MPI_Datatype datatype, int src, M
     e->u.recv.count = count;
     e->u.recv.datatype = datatype;
     e->u.recv.src = src;
-    e->u.recv.rreq = NULL; /* will be populated by _start_entry */
+    e->u.recv.rreq = NULL;      /* will be populated by _start_entry */
     e->u.recv.comm = comm;
     e->u.recv.status = MPI_STATUS_IGNORE;
 
     MPIR_Comm_add_ref(comm);
     dtype_add_ref_if_not_builtin(datatype);
 
-fn_exit:
+  fn_exit:
     return mpi_errno;
-fn_fail:
+  fn_fail:
     goto fn_exit;
 }
 
 #undef FUNCNAME
-#define FUNCNAME MPID_Sched_reduce
+#define FUNCNAME MPIDU_Sched_reduce
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-int MPID_Sched_reduce(const void *inbuf, void *inoutbuf, MPI_Aint count, MPI_Datatype datatype, MPI_Op op, MPID_Sched_t s)
+int MPIDU_Sched_reduce(const void *inbuf, void *inoutbuf, MPI_Aint count, MPI_Datatype datatype,
+                       MPI_Op op, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
     struct MPIDU_Sched_entry *e = NULL;
     struct MPIDU_Sched_reduce *reduce = NULL;
 
     mpi_errno = MPIDU_Sched_add_entry(s, NULL, &e);
-    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
+    if (mpi_errno)
+        MPIR_ERR_POP(mpi_errno);
 
     e->type = MPIDU_SCHED_ENTRY_REDUCE;
     e->status = MPIDU_SCHED_ENTRY_STATUS_NOT_STARTED;
@@ -685,14 +716,14 @@ int MPID_Sched_reduce(const void *inbuf, void *inoutbuf, MPI_Aint count, MPI_Dat
         MPIR_Op_add_ref(op_ptr);
     }
 
-fn_exit:
+  fn_exit:
     return mpi_errno;
-fn_fail:
+  fn_fail:
     goto fn_exit;
 }
 
 #undef FUNCNAME
-#define FUNCNAME MPID_Sched_copy
+#define FUNCNAME MPIDU_Sched_copy
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
 /* Schedules a copy of "incount" copies of "intype" from "inbuf" to "outbuf" as
@@ -702,15 +733,16 @@ fn_fail:
  *
  * Packing/unpacking can be accomplished by passing MPI_PACKED as either intype
  * or outtype. */
-int MPID_Sched_copy(const void *inbuf,  MPI_Aint incount,  MPI_Datatype intype,
-                    void *outbuf, MPI_Aint outcount, MPI_Datatype outtype, MPID_Sched_t s)
+int MPIDU_Sched_copy(const void *inbuf, MPI_Aint incount, MPI_Datatype intype,
+                     void *outbuf, MPI_Aint outcount, MPI_Datatype outtype, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
     struct MPIDU_Sched_entry *e = NULL;
     struct MPIDU_Sched_copy *copy = NULL;
 
     mpi_errno = MPIDU_Sched_add_entry(s, NULL, &e);
-    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
+    if (mpi_errno)
+        MPIR_ERR_POP(mpi_errno);
 
     e->type = MPIDU_SCHED_ENTRY_COPY;
     e->status = MPIDU_SCHED_ENTRY_STATUS_NOT_STARTED;
@@ -742,47 +774,48 @@ int MPID_Sched_copy(const void *inbuf,  MPI_Aint incount,  MPI_Datatype intype,
     }
 #endif
 
-fn_exit:
+  fn_exit:
     return mpi_errno;
-fn_fail:
+  fn_fail:
     goto fn_exit;
 }
 
 #undef FUNCNAME
-#define FUNCNAME MPID_Sched_barrier
+#define FUNCNAME MPIDU_Sched_barrier
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
 /* require that all previously added ops are complete before subsequent ops
  * may begin to execute */
-int MPID_Sched_barrier(MPID_Sched_t s)
+int MPIDU_Sched_barrier(MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
 
     /* mark the previous entry as a barrier unless we're at the beginning, which
      * would be a pointless barrier */
     if (s->num_entries > 0) {
-        s->entries[s->num_entries-1].is_barrier = TRUE;
+        s->entries[s->num_entries - 1].is_barrier = TRUE;
     }
 
-fn_exit:
+  fn_exit:
     return mpi_errno;
-fn_fail:
+  fn_fail:
     goto fn_exit;
 }
 
 #undef FUNCNAME
-#define FUNCNAME MPID_Sched_cb
+#define FUNCNAME MPIDU_Sched_cb
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
 /* buffer management, fancy reductions, etc */
-int MPID_Sched_cb(MPID_Sched_cb_t *cb_p, void *cb_state, MPID_Sched_t s)
+int MPIDU_Sched_cb(MPID_Sched_cb_t * cb_p, void *cb_state, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
     struct MPIDU_Sched_entry *e = NULL;
     struct MPIDU_Sched_cb *cb = NULL;
 
     mpi_errno = MPIDU_Sched_add_entry(s, NULL, &e);
-    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
+    if (mpi_errno)
+        MPIR_ERR_POP(mpi_errno);
 
     e->type = MPIDU_SCHED_ENTRY_CB;
     e->status = MPIDU_SCHED_ENTRY_STATUS_NOT_STARTED;
@@ -794,25 +827,26 @@ int MPID_Sched_cb(MPID_Sched_cb_t *cb_p, void *cb_state, MPID_Sched_t s)
     cb->cb_state = cb_state;
     cb->cb_state2 = NULL;
 
-fn_exit:
+  fn_exit:
     return mpi_errno;
-fn_fail:
+  fn_fail:
     goto fn_exit;
 }
 
 #undef FUNCNAME
-#define FUNCNAME MPID_Sched_cb2
+#define FUNCNAME MPIDU_Sched_cb2
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
 /* buffer management, fancy reductions, etc */
-int MPID_Sched_cb2(MPID_Sched_cb2_t *cb_p, void *cb_state, void *cb_state2, MPID_Sched_t s)
+int MPIDU_Sched_cb2(MPID_Sched_cb2_t * cb_p, void *cb_state, void *cb_state2, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
     struct MPIDU_Sched_entry *e = NULL;
     struct MPIDU_Sched_cb *cb = NULL;
 
     mpi_errno = MPIDU_Sched_add_entry(s, NULL, &e);
-    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
+    if (mpi_errno)
+        MPIR_ERR_POP(mpi_errno);
 
     e->type = MPIDU_SCHED_ENTRY_CB;
     e->status = MPIDU_SCHED_ENTRY_STATUS_NOT_STARTED;
@@ -824,9 +858,9 @@ int MPID_Sched_cb2(MPID_Sched_cb2_t *cb_p, void *cb_state, void *cb_state2, MPID
     cb->cb_state = cb_state;
     cb->cb_state2 = cb_state2;
 
-fn_exit:
+  fn_exit:
     return mpi_errno;
-fn_fail:
+  fn_fail:
     goto fn_exit;
 }
 
@@ -846,49 +880,53 @@ static int MPIDU_Sched_progress_state(struct MPIDU_Sched_state *state, int *made
         *made_progress = FALSE;
 
     MPL_DL_FOREACH_SAFE(state->head, s, tmp) {
-        /*MPIDU_Sched_dump(s);*/
+        /*MPIDU_Sched_dump(s); */
 
         for (i = s->idx; i < s->num_entries; ++i) {
             struct MPIDU_Sched_entry *e = &s->entries[i];
 
             switch (e->type) {
-                case MPIDU_SCHED_ENTRY_SEND:
-                    if (e->u.send.sreq != NULL && MPID_Request_is_complete(e->u.send.sreq)) {
-                        MPIU_DBG_MSG_FMT(COMM, VERBOSE, (MPIU_DBG_FDEST, "completed SEND entry %d, sreq=%p\n", (int) i, e->u.send.sreq));
-                        if (s->req->errflag != MPIR_ERR_NONE)
-                            e->status = MPIDU_SCHED_ENTRY_STATUS_FAILED;
-                        else
-                            e->status = MPIDU_SCHED_ENTRY_STATUS_COMPLETE;
-                        MPID_Request_release(e->u.send.sreq);
-                        e->u.send.sreq = NULL;
-                        MPIR_Comm_release(e->u.send.comm);
-                        dtype_release_if_not_builtin(e->u.send.datatype);
-                    }
-                    break;
-                case MPIDU_SCHED_ENTRY_RECV:
-                    if (e->u.recv.rreq != NULL && MPID_Request_is_complete(e->u.recv.rreq)) {
-                        MPIU_DBG_MSG_FMT(COMM, VERBOSE, (MPIU_DBG_FDEST, "completed RECV entry %d, rreq=%p\n", (int) i, e->u.recv.rreq));
-                        MPIR_Process_status(&e->u.recv.rreq->status, &s->req->errflag);
-                        if (e->u.recv.status != MPI_STATUS_IGNORE) {
-                            int recvd;
-                            e->u.recv.status->MPI_ERROR = e->u.recv.rreq->status.MPI_ERROR;
-                            MPIR_Get_count_impl(&e->u.recv.rreq->status, MPI_BYTE, &recvd);
-                            MPIR_STATUS_SET_COUNT(*(e->u.recv.status), recvd);
-                        }
-                        if (s->req->errflag != MPIR_ERR_NONE)
-                            e->status = MPIDU_SCHED_ENTRY_STATUS_FAILED;
-                        else
-                            e->status = MPIDU_SCHED_ENTRY_STATUS_COMPLETE;
-                        MPID_Request_release(e->u.recv.rreq);
-                        e->u.recv.rreq = NULL;
-                        MPIR_Comm_release(e->u.recv.comm);
-                        dtype_release_if_not_builtin(e->u.recv.datatype);
+            case MPIDU_SCHED_ENTRY_SEND:
+                if (e->u.send.sreq != NULL && MPID_Request_is_complete(e->u.send.sreq)) {
+                    MPIU_DBG_MSG_FMT(COMM, VERBOSE,
+                                     (MPIU_DBG_FDEST, "completed SEND entry %d, sreq=%p\n", (int) i,
+                                      e->u.send.sreq));
+                    if (s->req->errflag != MPIR_ERR_NONE)
+                        e->status = MPIDU_SCHED_ENTRY_STATUS_FAILED;
+                    else
+                        e->status = MPIDU_SCHED_ENTRY_STATUS_COMPLETE;
+                    MPID_Request_release(e->u.send.sreq);
+                    e->u.send.sreq = NULL;
+                    MPIR_Comm_release(e->u.send.comm);
+                    dtype_release_if_not_builtin(e->u.send.datatype);
+                }
+                break;
+            case MPIDU_SCHED_ENTRY_RECV:
+                if (e->u.recv.rreq != NULL && MPID_Request_is_complete(e->u.recv.rreq)) {
+                    MPIU_DBG_MSG_FMT(COMM, VERBOSE,
+                                     (MPIU_DBG_FDEST, "completed RECV entry %d, rreq=%p\n", (int) i,
+                                      e->u.recv.rreq));
+                    MPIR_Process_status(&e->u.recv.rreq->status, &s->req->errflag);
+                    if (e->u.recv.status != MPI_STATUS_IGNORE) {
+                        int recvd;
+                        e->u.recv.status->MPI_ERROR = e->u.recv.rreq->status.MPI_ERROR;
+                        MPIR_Get_count_impl(&e->u.recv.rreq->status, MPI_BYTE, &recvd);
+                        MPIR_STATUS_SET_COUNT(*(e->u.recv.status), recvd);
                     }
-                    break;
-                default:
-                    /* all other entry types don't have any sub-requests that
-                     * need to be checked */
-                    break;
+                    if (s->req->errflag != MPIR_ERR_NONE)
+                        e->status = MPIDU_SCHED_ENTRY_STATUS_FAILED;
+                    else
+                        e->status = MPIDU_SCHED_ENTRY_STATUS_COMPLETE;
+                    MPID_Request_release(e->u.recv.rreq);
+                    e->u.recv.rreq = NULL;
+                    MPIR_Comm_release(e->u.recv.comm);
+                    dtype_release_if_not_builtin(e->u.recv.datatype);
+                }
+                break;
+            default:
+                /* all other entry types don't have any sub-requests that
+                 * need to be checked */
+                break;
             }
 
             if (i == s->idx && e->status >= MPIDU_SCHED_ENTRY_STATUS_COMPLETE) {
@@ -897,7 +935,8 @@ static int MPIDU_Sched_progress_state(struct MPIDU_Sched_state *state, int *made
                 if (e->is_barrier) {
                     /* post/perform the next round of operations */
                     mpi_errno = MPIDU_Sched_continue(s);
-                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
+                    if (mpi_errno)
+                        MPIR_ERR_POP(mpi_errno);
                 }
             }
             else if (e->is_barrier && e->status < MPIDU_SCHED_ENTRY_STATUS_COMPLETE) {
@@ -907,22 +946,23 @@ static int MPIDU_Sched_progress_state(struct MPIDU_Sched_state *state, int *made
         }
 
         if (s->idx == s->num_entries) {
-            MPIU_DBG_MSG_FMT(COMM, VERBOSE, (MPIU_DBG_FDEST, "completing and dequeuing s=%p r=%p\n", s, s->req));
+            MPIU_DBG_MSG_FMT(COMM, VERBOSE,
+                             (MPIU_DBG_FDEST, "completing and dequeuing s=%p r=%p\n", s, s->req));
 
             /* dequeue this schedule from the state, it's complete */
             MPL_DL_DELETE(state->head, s);
 
             /* TODO refactor into a sched_complete routine? */
             switch (s->req->errflag) {
-                case MPIR_ERR_PROC_FAILED:
-                    MPIR_ERR_SET(s->req->status.MPI_ERROR, MPIX_ERR_PROC_FAILED, "**comm");
-                    break;
-                case MPIR_ERR_OTHER:
-                    MPIR_ERR_SET(s->req->status.MPI_ERROR, MPI_ERR_OTHER, "**comm");
-                    break;
-                case MPIR_ERR_NONE:
-                default:
-                    break;
+            case MPIR_ERR_PROC_FAILED:
+                MPIR_ERR_SET(s->req->status.MPI_ERROR, MPIX_ERR_PROC_FAILED, "**comm");
+                break;
+            case MPIR_ERR_OTHER:
+                MPIR_ERR_SET(s->req->status.MPI_ERROR, MPI_ERR_OTHER, "**comm");
+                break;
+            case MPIR_ERR_NONE:
+            default:
+                break;
             }
 
             mpi_errno = MPID_Request_complete(s->req);
@@ -939,9 +979,9 @@ static int MPIDU_Sched_progress_state(struct MPIDU_Sched_state *state, int *made
         }
     }
 
-fn_exit:
+  fn_exit:
     return mpi_errno;
-fn_fail:
+  fn_fail:
     goto fn_exit;
 }
 
@@ -963,24 +1003,24 @@ int MPIDU_Sched_progress(int *made_progress)
     return mpi_errno;
 }
 
-static const char *entry_to_str(enum MPIDU_Sched_entry_type type) ATTRIBUTE((unused,used));
+static const char *entry_to_str(enum MPIDU_Sched_entry_type type) ATTRIBUTE((unused, used));
 static const char *entry_to_str(enum MPIDU_Sched_entry_type type)
 {
-    switch(type) {
-        case MPIDU_SCHED_ENTRY_SEND:
-            return "SEND";
-        case MPIDU_SCHED_ENTRY_RECV:
-            return "RECV";
-        case MPIDU_SCHED_ENTRY_REDUCE:
-            return "REDUCE";
-        case MPIDU_SCHED_ENTRY_COPY:
-            return "COPY";
-        case MPIDU_SCHED_ENTRY_NOP:
-            return "NOP";
-        case MPIDU_SCHED_ENTRY_CB:
-            return "CB";
-        default:
-            return "(out of range)";
+    switch (type) {
+    case MPIDU_SCHED_ENTRY_SEND:
+        return "SEND";
+    case MPIDU_SCHED_ENTRY_RECV:
+        return "RECV";
+    case MPIDU_SCHED_ENTRY_REDUCE:
+        return "REDUCE";
+    case MPIDU_SCHED_ENTRY_COPY:
+        return "COPY";
+    case MPIDU_SCHED_ENTRY_NOP:
+        return "NOP";
+    case MPIDU_SCHED_ENTRY_CB:
+        return "CB";
+    default:
+        return "(out of range)";
     }
 }
 
@@ -989,7 +1029,7 @@ static const char *entry_to_str(enum MPIDU_Sched_entry_type type)
 #define FUNCNAME MPIDU_Sched_dump_fh
 #undef FCNAME
 #define FCNAME MPL_QUOTE(FUNCNAME)
-void MPIDU_Sched_dump_fh(struct MPIDU_Sched *s, FILE *fh)
+void MPIDU_Sched_dump_fh(struct MPIDU_Sched *s, FILE * fh)
 {
     int i;
     dprintf(fh, "--------------------------------\n");
@@ -1005,14 +1045,15 @@ void MPIDU_Sched_dump_fh(struct MPIDU_Sched *s, FILE *fh)
             dprintf(fh, "&s->entries[%d]=%p\n", i, &s->entries[i]);
             dprintf(fh, "s->entries[%d].type=%s\n", i, entry_to_str(s->entries[i].type));
             dprintf(fh, "s->entries[%d].status=%d\n", i, s->entries[i].status);
-            dprintf(fh, "s->entries[%d].is_barrier=%s\n", i, (s->entries[i].is_barrier ? "TRUE" : "FALSE"));
+            dprintf(fh, "s->entries[%d].is_barrier=%s\n", i,
+                    (s->entries[i].is_barrier ? "TRUE" : "FALSE"));
         }
     }
     dprintf(fh, "--------------------------------\n");
     /*
-    dprintf(fh, "s->next=%p\n", s->next);
-    dprintf(fh, "s->prev=%p\n", s->prev);
-    */
+     * dprintf(fh, "s->next=%p\n", s->next);
+     * dprintf(fh, "s->prev=%p\n", s->prev);
+     */
 }
 
 /* utility function for debugging, dumps the given schedule object to stderr */
@@ -1024,4 +1065,3 @@ void MPIDU_Sched_dump(struct MPIDU_Sched *s)
 {
     MPIDU_Sched_dump_fh(s, stderr);
 }
-
diff --git a/src/mpid/common/sched/mpid_sched.h b/src/mpid/common/sched/mpidu_sched.h
similarity index 51%
rename from src/mpid/common/sched/mpid_sched.h
rename to src/mpid/common/sched/mpidu_sched.h
index 296f304..9680f06 100644
--- a/src/mpid/common/sched/mpid_sched.h
+++ b/src/mpid/common/sched/mpidu_sched.h
@@ -4,16 +4,15 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-/* this file should be included by the using device's mpidimpl.h */
-
-#ifndef MPID_SCHED_H_INCLUDED
-#define MPID_SCHED_H_INCLUDED
+#ifndef MPIDU_SCHED_H_INCLUDED
+#define MPIDU_SCHED_H_INCLUDED
 
+//#include "mpidu_pre.h"
 /* FIXME open questions:
  * - Should the schedule hold a pointer to the nbc request and the nbc request
  *   hold a pointer to the schedule?  This could cause MT issues.
  */
-
+#include "mpidu_pre.h"
 
 enum MPIDU_Sched_entry_type {
     MPIDU_SCHED_ENTRY_INVALID_LB = 0,
@@ -34,9 +33,9 @@ struct MPIDU_Sched_send {
     const MPI_Aint *count_p;
     MPI_Datatype datatype;
     int dest;
-    MPID_Comm *comm;
-    MPID_Request *sreq;
-    int is_sync; /* TRUE iff this send is an ssend */
+    struct MPID_Comm *comm;
+    struct MPID_Request *sreq;
+    int is_sync;                /* TRUE iff this send is an ssend */
 };
 
 struct MPIDU_Sched_recv {
@@ -44,8 +43,8 @@ struct MPIDU_Sched_recv {
     MPI_Aint count;
     MPI_Datatype datatype;
     int src;
-    MPID_Comm *comm;
-    MPID_Request *rreq;
+    struct MPID_Comm *comm;
+    struct MPID_Request *rreq;
     MPI_Status *status;
 };
 
@@ -69,8 +68,8 @@ struct MPIDU_Sched_copy {
 /* nop entries have no args, so no structure is needed */
 
 enum MPIDU_Sched_cb_type {
-    MPIDU_SCHED_CB_TYPE_1 = 0, /* single state arg type --> MPID_Sched_cb_t */
-    MPIDU_SCHED_CB_TYPE_2      /* double state arg type --> MPID_Sched_cb2_t */
+    MPIDU_SCHED_CB_TYPE_1 = 0,  /* single state arg type --> MPID_Sched_cb_t */
+    MPIDU_SCHED_CB_TYPE_2       /* double state arg type --> MPID_Sched_cb2_t */
 };
 
 struct MPIDU_Sched_cb {
@@ -80,15 +79,15 @@ struct MPIDU_Sched_cb {
         MPID_Sched_cb2_t *cb2_p;
     } u;
     void *cb_state;
-    void *cb_state2; /* unused for single-param callbacks */
+    void *cb_state2;            /* unused for single-param callbacks */
 };
 
 enum MPIDU_Sched_entry_status {
     MPIDU_SCHED_ENTRY_STATUS_NOT_STARTED = 0,
     MPIDU_SCHED_ENTRY_STATUS_STARTED,
     MPIDU_SCHED_ENTRY_STATUS_COMPLETE,
-    MPIDU_SCHED_ENTRY_STATUS_FAILED, /* indicates a failure occurred while executing the entry */
-    MPIDU_SCHED_ENTRY_STATUS_INVALID /* indicates an invalid entry, or invalid status value */
+    MPIDU_SCHED_ENTRY_STATUS_FAILED,    /* indicates a failure occurred while executing the entry */
+    MPIDU_SCHED_ENTRY_STATUS_INVALID    /* indicates an invalid entry, or invalid status value */
 };
 
 /* Use a tagged union for schedule entries.  Not always space optimal, but saves
@@ -108,19 +107,35 @@ struct MPIDU_Sched_entry {
 };
 
 struct MPIDU_Sched {
-    size_t size; /* capacity (in entries) of the entries array */
-    size_t idx;  /* index into entries array of first yet-outstanding entry */
-    int num_entries; /* number of populated entries, num_entries <= size */
+    size_t size;                /* capacity (in entries) of the entries array */
+    size_t idx;                 /* index into entries array of first yet-outstanding entry */
+    int num_entries;            /* number of populated entries, num_entries <= size */
     int tag;
-    MPID_Request *req; /* really needed? could cause MT problems... */
+    struct MPID_Request *req;   /* really needed? could cause MT problems... */
     struct MPIDU_Sched_entry *entries;
 
-    struct MPIDU_Sched *next; /* linked-list next pointer */
-    struct MPIDU_Sched *prev; /* linked-list next pointer */
+    struct MPIDU_Sched *next;   /* linked-list next pointer */
+    struct MPIDU_Sched *prev;   /* linked-list next pointer */
 };
 
 /* prototypes */
 int MPIDU_Sched_progress(int *made_progress);
 int MPIDU_Sched_are_pending(void);
-
-#endif /* !defined(MPID_SCHED_H_INCLUDED) */
+int MPIDU_Sched_next_tag(struct MPID_Comm *comm_ptr, int *tag);
+int MPIDU_Sched_create(MPID_Sched_t * sp);
+int MPIDU_Sched_clone(MPID_Sched_t orig, MPID_Sched_t * cloned);
+int MPIDU_Sched_start(MPID_Sched_t * sp, struct MPID_Comm *comm, int tag,
+                      struct MPID_Request **req);
+int MPIDU_Sched_send(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest,
+                     struct MPID_Comm *comm, MPID_Sched_t s);
+int MPIDU_Sched_recv(void *buf, MPI_Aint count, MPI_Datatype datatype, int src,
+                     struct MPID_Comm *comm, MPID_Sched_t s);
+int MPID_Sched_ssend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest,
+                     struct MPID_Comm *comm, MPID_Sched_t s);
+int MPID_Sched_reduce(const void *inbuf, void *inoutbuf, MPI_Aint count, MPI_Datatype datatype,
+                      MPI_Op op, MPID_Sched_t s);
+int MPIDU_Sched_copy(const void *inbuf, MPI_Aint incount, MPI_Datatype intype, void *outbuf,
+                     MPI_Aint outcount, MPI_Datatype outtype, MPID_Sched_t s);
+int MPIDU_Sched_barrier(MPID_Sched_t s);
+
+#endif /* !defined(MPIDU_SCHED_H_INCLUDED) */
diff --git a/src/mpid/include/mpidu_pre.h b/src/mpid/include/mpidu_pre.h
new file mode 100644
index 0000000..a89671a
--- /dev/null
+++ b/src/mpid/include/mpidu_pre.h
@@ -0,0 +1,25 @@
+/* -*- Mode: c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2015by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef MPIDU_PRE_H_INCLUDED
+#define MPIDU_PRE_H_INCLUDED
+
+
+
+/* some common MPI forward declarations */
+
+struct MPID_Request;
+struct MPID_Comm;
+
+/* Scheduling forward declarations */
+
+struct MPIDU_Sched;
+typedef struct MPIDU_Sched *MPID_Sched_t;
+
+typedef int (MPID_Sched_cb_t) (struct MPID_Comm * comm, int tag, void *state);
+typedef int (MPID_Sched_cb2_t) (struct MPID_Comm * comm, int tag, void *state, void *state2);
+
+#endif
diff --git a/src/mpid/pamid/include/mpidpre.h b/src/mpid/pamid/include/mpidpre.h
index 20d2175..2ca50d2 100644
--- a/src/mpid/pamid/include/mpidpre.h
+++ b/src/mpid/pamid/include/mpidpre.h
@@ -38,7 +38,7 @@
 #include <pami.h>
 
 /* provides "pre" typedefs and such for NBC scheduling mechanism */
-#include "mpid_sched_pre.h"
+#include "mpidu_pre.h"
 
 /** \brief Creates a compile error if the condition is false. */
 #define MPID_assert_static(expr) ({ switch(0){case 0:case expr:;} })

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

Summary of changes:
 src/include/mpir_nbc.h                             |    8 +-
 src/mpid/Makefile.mk                               |    6 +
 src/mpid/ch3/Makefile.mk                           |    3 +-
 src/mpid/ch3/include/mpid_sched.h                  |   26 +
 src/mpid/ch3/include/mpidimpl.h                    |    6 -
 src/mpid/ch3/include/mpidpre.h                     |    5 +-
 src/mpid/common/sched/Makefile.mk                  |    5 +-
 src/mpid/common/sched/mpid_sched_pre.h             |   16 -
 .../common/sched/{mpid_sched.c => mpidu_sched.c}   |  576 +++++++++++---------
 .../common/sched/{mpid_sched.h => mpidu_sched.h}   |   61 ++-
 src/mpid/include/mpidu_pre.h                       |   25 +
 src/mpid/pamid/include/mpidpre.h                   |    2 +-
 12 files changed, 412 insertions(+), 327 deletions(-)
 create mode 100644 src/mpid/ch3/include/mpid_sched.h
 delete mode 100644 src/mpid/common/sched/mpid_sched_pre.h
 rename src/mpid/common/sched/{mpid_sched.c => mpidu_sched.c} (63%)
 rename src/mpid/common/sched/{mpid_sched.h => mpidu_sched.h} (51%)
 create mode 100644 src/mpid/include/mpidu_pre.h


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list