[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1rc3-15-g503da0c

mysql vizuser noreply at mpich.org
Thu Feb 13 13:57:31 CST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  503da0c79099a3ef0cf022e5c615662e5376ca99 (commit)
      from  c48f6b1b52b98a28ffe0d796a5b2f3cdcc46fb77 (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/503da0c79099a3ef0cf022e5c615662e5376ca99

commit 503da0c79099a3ef0cf022e5c615662e5376ca99
Author: Haizhu Liu <haizhu at us.ibm.com>
Date:   Sun Sep 29 23:09:55 2013 -0400

    PAMId support of MPI 3.0 functions:
    MPI_Mprobe/MPI_Improbe/MPI_Mrecv/MPI_Imrecv
    
    (ibm) F192956
    
    Signed-off-by: Su Huang <suhuang at us.ibm.com>

diff --git a/src/mpid/pamid/src/mpid_improbe.c b/src/mpid/pamid/src/mpid_improbe.c
index 0a3bd2b..ebac24c 100644
--- a/src/mpid/pamid/src/mpid_improbe.c
+++ b/src/mpid/pamid/src/mpid_improbe.c
@@ -6,102 +6,45 @@
 
 #include "mpidimpl.h"
 
-int (*MPIDI_Anysource_improbe_fn)(int tag, MPID_Comm * comm, int context_offset,
-                                  int *flag, MPID_Request **message,
-                                  MPI_Status * status) = NULL;
-
-#undef FUNCNAME
-#define FUNCNAME MPID_Improbe
-#undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
 int MPID_Improbe(int source, int tag, MPID_Comm *comm, int context_offset,
                  int *flag, MPID_Request **message, MPI_Status *status)
 {
     int mpi_errno = MPI_SUCCESS;
-#if 0
-    int context_id = comm->recvcontext_id + context_offset;
-
-    *message = NULL;
+    const int context = comm->recvcontext_id + context_offset;
+    int pami_source;
+    int foundp = FALSE;
+    MPID_Request * rreq = NULL;
 
     if (source == MPI_PROC_NULL)
-    {
+      {
         MPIR_Status_set_procnull(status);
+        /* We set the flag to true because an MPI_Recv with this rank will
+         * return immediately */
         *flag = TRUE;
-        *message = NULL; /* should be interpreted as MPI_MESSAGE_NO_PROC */
-        goto fn_exit;
-    }
-
-#ifdef ENABLE_COMM_OVERRIDES
-    if (MPIDI_Anysource_improbe_fn) {
-        if (source == MPI_ANY_SOURCE) {
-            /* if it's anysource, check shm, then check the network.
-               If still not found, call progress, and check again. */
-
-            /* check shm*/
-            MPIU_THREAD_CS_ENTER(MSGQUEUE,);
-            *message = MPIDI_CH3U_Recvq_FDU_matchonly(source, tag, context_id, comm, flag);
-            MPIU_THREAD_CS_EXIT(MSGQUEUE,);
-            if (!*flag) {
-                /* not found, check network */
-                mpi_errno = MPIDI_Anysource_improbe_fn(tag, comm, context_offset, flag, message, status);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-                if (!*flag) {
-                    /* still not found, make some progress*/
-                    mpi_errno = MPIDI_CH3_Progress_poke();
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-                    /* check shm again */
-                    MPIU_THREAD_CS_ENTER(MSGQUEUE,);
-                    *message = MPIDI_CH3U_Recvq_FDU_matchonly(source, tag, context_id, comm, flag);
-                    MPIU_THREAD_CS_EXIT(MSGQUEUE,);
-                    if (!*flag) {
-                        /* check network again */
-                        mpi_errno = MPIDI_Anysource_improbe_fn(tag, comm, context_offset, flag, message, status);
-                        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-                    }
-                }
-            }
-            goto fn_exit;
-        }
-        else {
-            /* it's not anysource, check if the netmod has overridden it */
-            MPIDI_VC_t * vc;
-            MPIDI_Comm_get_vc_set_active(comm, source, &vc);
-            if (vc->comm_ops && vc->comm_ops->probe) {
-                mpi_errno = vc->comm_ops->improbe(vc, source, tag, comm, context_offset, flag, message, status);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-                goto fn_exit;
-            }
-            /* fall-through to shm case */
-        }
+        *message = NULL;
+        return MPI_SUCCESS;
+      }
+
+    if(source != MPI_ANY_SOURCE) {
+      pami_source = MPID_VCR_GET_LPID(comm->vcr, source);
+    } else {
+      pami_source = MPI_ANY_SOURCE;
     }
+#ifndef OUT_OF_ORDER_HANDLING
+    rreq = MPIDI_Recvq_FDU(source, tag, context, &foundp);
+#else
+    rreq = MPIDI_Recvq_FDU(source, pami_source, tag, context, &foundp);
 #endif
-
-    MPIU_THREAD_CS_ENTER(MSGQUEUE,);
-    *message = MPIDI_CH3U_Recvq_FDU_matchonly(source, tag, context_id, comm, flag);
-    MPIU_THREAD_CS_EXIT(MSGQUEUE,);
-
-    if (!*flag) {
-        /* Always try to advance progress before returning failure
-           from the improbe test. */
-        /* FIXME: It would be helpful to know if the Progress_poke
-           operation causes any change in state; we could then avoid
-           a second test of the receive queue if we knew that nothing
-           had changed */
-        mpi_errno = MPID_Progress_poke();
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-        MPIU_THREAD_CS_ENTER(MSGQUEUE,);
-        *message = MPIDI_CH3U_Recvq_FDU_matchonly(source, tag, context_id, comm, flag);
-        MPIU_THREAD_CS_EXIT(MSGQUEUE,);
+    if (rreq==NULL) {
+      MPID_Progress_poke();
     }
-
-    if (*flag && *message) {
-        (*message)->kind = MPID_REQUEST_MPROBE;
-        MPIR_Request_extract_status((*message), status);
+    else {
+      rreq->kind = MPID_REQUEST_MPROBE;
+      MPIR_Request_extract_status(rreq, status);
     }
-#endif
-fn_exit:
-    return mpi_errno;
-fn_fail:
-    goto fn_exit;
+
+    *message = rreq;
+    *flag = foundp;
+    return MPI_SUCCESS;
 }
 
diff --git a/src/mpid/pamid/src/mpid_imrecv.c b/src/mpid/pamid/src/mpid_imrecv.c
index 2dd4439..e2e35fe 100644
--- a/src/mpid/pamid/src/mpid_imrecv.c
+++ b/src/mpid/pamid/src/mpid_imrecv.c
@@ -6,127 +6,87 @@
 
 #include "mpidimpl.h"
 
-#undef FUNCNAME
-#define FUNCNAME MPID_Imrecv
-#undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
 int MPID_Imrecv(void *buf, int count, MPI_Datatype datatype,
                 MPID_Request *message, MPID_Request **rreqp)
 {
-    int mpi_errno = MPI_SUCCESS;
-#if 0
-    MPID_Request *rreq;
-    MPID_Comm *comm;
-    MPIDI_VC_t *vc = NULL;
-
-    /* message==NULL is equivalent to MPI_MESSAGE_NO_PROC being passed at the
-     * upper level */
-    if (message == NULL)
+  int mpi_errno = MPI_SUCCESS;
+
+  MPID_Request * rreq;
+  int found;
+
+  /* ---------------------------------------- */
+  /* NULL rank means empty request            */
+  /* ---------------------------------------- */
+  if (unlikely(message == NULL))
     {
-        MPIDI_Request_create_null_rreq(rreq, mpi_errno, fn_fail);
-        *rreqp = rreq;
-        goto fn_exit;
+      rreq = MPIDI_Request_create2();
+      MPIR_Status_set_procnull(&rreq->status);
+      rreq->kind = MPID_REQUEST_RECV;
+      MPIDI_Request_complete(rreq);
+      *rreqp = rreq;
+      return MPI_SUCCESS;
+
     }
 
-    MPIU_Assert(message != NULL);
-    MPIU_Assert(message->kind == MPID_REQUEST_MPROBE);
+  MPIU_Assert(message != NULL);
+  MPIU_Assert(message->kind == MPID_REQUEST_MPROBE);
 
-    /* promote the request object to be a "real" recv request */
-    message->kind = MPID_REQUEST_RECV;
+  /* promote the request object to be a "real" recv request */
+  message->kind = MPID_REQUEST_RECV;
 
-    *rreqp = rreq = message;
+  *rreqp = rreq = message;
 
-    comm = rreq->comm;
+#ifdef OUT_OF_ORDER_HANDLING
+  if ((MPIDI_In_cntr[rreq->mpid.peer_pami].n_OutOfOrderMsgs>0))
+     MPIDI_Recvq_process_out_of_order_msgs(rreq->mpid.peer_pami, MPIDI_Context[0]);
+#endif
 
-    /* the following code was adapted from FDU_or_AEP and MPID_Irecv */
-    /* comm was already added at FDU (mprobe) time */
-    rreq->dev.user_buf = buf;
-    rreq->dev.user_count = count;
-    rreq->dev.datatype = datatype;
+#if (MPIDI_STATISTICS)
+  MPID_NSTAT(mpid_statp->recvs);
+#endif
 
-    if (MPIDI_Request_get_msg_type(rreq) == MPIDI_REQUEST_EAGER_MSG)
-    {
-        int recv_pending;
-
-        /* This is an eager message */
-        MPIU_DBG_MSG(CH3_OTHER,VERBOSE,"eager message in the request");
-
-        /* If this is an eager synchronous message, then we need to send an
-           acknowledgement back to the sender. */
-        if (MPIDI_Request_get_sync_send_flag(rreq))
-        {
-            MPIDI_Comm_get_vc_set_active(comm, rreq->dev.match.parts.rank, &vc);
-            mpi_errno = MPIDI_CH3_EagerSyncAck(vc, rreq);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-        }
-
-        /* the request was found in the unexpected queue, so it has a
-           recv_pending_count of at least 1 */
-        MPIDI_Request_decr_pending(rreq);
-        MPIDI_Request_check_pending(rreq, &recv_pending);
-
-        if (MPID_Request_is_complete(rreq)) {
-            /* is it ever possible to have (cc==0 && recv_pending>0) ? */
-            MPIU_Assert(!recv_pending);
-
-            /* All of the data has arrived, we need to copy the data and
-               then free the buffer. */
-            if (rreq->dev.recv_data_sz > 0)
-            {
-                MPIDI_CH3U_Request_unpack_uebuf(rreq);
-                MPIU_Free(rreq->dev.tmpbuf);
-            }
-
-            mpi_errno = rreq->status.MPI_ERROR;
-            goto fn_exit;
-        }
-        else
-        {
-            /* there should never be outstanding completion events for an unexpected
-             * recv without also having a "pending recv" */
-            MPIU_Assert(recv_pending);
-            /* The data is still being transfered across the net.  We'll
-               leave it to the progress engine to handle once the
-               entire message has arrived. */
-            if (HANDLE_GET_KIND(datatype) != HANDLE_KIND_BUILTIN)
-            {
-                MPID_Datatype_get_ptr(datatype, rreq->dev.datatype_ptr);
-                MPID_Datatype_add_ref(rreq->dev.datatype_ptr);
-            }
-
-        }
-    }
-    else if (MPIDI_Request_get_msg_type(rreq) == MPIDI_REQUEST_RNDV_MSG)
-    {
-        MPIDI_Comm_get_vc_set_active(comm, rreq->dev.match.parts.rank, &vc);
-
-        mpi_errno = vc->rndvRecv_fn(vc, rreq);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-        if (HANDLE_GET_KIND(datatype) != HANDLE_KIND_BUILTIN)
-        {
-            MPID_Datatype_get_ptr(datatype, rreq->dev.datatype_ptr);
-            MPID_Datatype_add_ref(rreq->dev.datatype_ptr);
-        }
-    }
-    else if (MPIDI_Request_get_msg_type(rreq) == MPIDI_REQUEST_SELF_MSG)
-    {
-        mpi_errno = MPIDI_CH3_RecvFromSelf(rreq, buf, count, datatype);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-    }
-    else
+#ifdef MPIDI_TRACE
+{
+  size_t ll;
+  ll = count * MPID_Datatype_get_basic_size(datatype);
+  /*MPIDI_SET_PR_REC(rreq,buf,count,ll,datatype,pami_source,rank,tag,comm,is_blocking); */
+}
+#endif
+
+  /* ----------------------------------------------------------------- */
+  /* populate request with our data                                    */
+  /* We can do this because this is not a multithreaded implementation */
+  /* ----------------------------------------------------------------- */
+
+  rreq->mpid.userbuf      = buf;
+  rreq->mpid.userbufcount = count;
+  rreq->mpid.datatype     = datatype;
+  MPIDI_RecvMsg_Unexp(rreq, buf, count, datatype);
+  mpi_errno = rreq->status.MPI_ERROR;
+  if (TOKEN_FLOW_CONTROL_ON) {
+     #if TOKEN_FLOW_CONTROL
+     if ((rreq->mpid.uebuflen) && (!(rreq->mpid.envelope.msginfo.isRzv))) {
+       MPIDI_Token_cntr[(rreq->mpid.peer_pami)].unmatched--;
+       MPIDI_Update_rettoks(rreq->mpid.peer_pami);
+     }
+     MPIDI_Must_return_tokens(MPIDI_Context[0],(rreq->mpid.peer_pami));
+     #else
+     MPID_assert_always(0);
+     #endif
+  }
+
+#ifdef OUT_OF_ORDER_HANDLING
+  if ((MPIDI_In_cntr[rreq->mpid.peer_pami].n_OutOfOrderMsgs>0))
+     MPIDI_Recvq_process_out_of_order_msgs(rreq->mpid.peer_pami, MPIDI_Context[0]);
+#endif
+
+#ifdef MPIDI_STATISTICS
+  if (!(MPID_cc_is_complete(&rreq->cc)))
     {
-        /* --BEGIN ERROR HANDLING-- */
-        int msg_type = MPIDI_Request_get_msg_type(rreq);
-        MPID_Request_release(rreq);
-        rreq = NULL;
-        MPIU_ERR_SETANDJUMP1(mpi_errno,MPI_ERR_INTERN, "**ch3|badmsgtype",
-                             "**ch3|badmsgtype %d", msg_type);
-        /* --END ERROR HANDLING-- */
+        MPID_NSTAT(mpid_statp->recvWaitsComplete);
     }
 #endif
-fn_exit:
-    return mpi_errno;
-fn_fail:
-    goto fn_exit;
+
+  return mpi_errno;
 }
 
diff --git a/src/mpid/pamid/src/mpid_mprobe.c b/src/mpid/pamid/src/mpid_mprobe.c
index 436c1a5..ec1a6fc 100644
--- a/src/mpid/pamid/src/mpid_mprobe.c
+++ b/src/mpid/pamid/src/mpid_mprobe.c
@@ -6,62 +6,37 @@
 
 #include "mpidimpl.h"
 
-#undef FUNCNAME
-#define FUNCNAME MPID_Mprobe
-#undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
 int MPID_Mprobe(int source, int tag, MPID_Comm *comm, int context_offset,
                 MPID_Request **message, MPI_Status *status)
 {
     int mpi_errno = MPI_SUCCESS;
-#if 0
-    MPID_Progress_state progress_state;
-    int found = FALSE;
-    int context_id = comm->recvcontext_id + context_offset;
-
-    *message = NULL;
+    const int context = comm->recvcontext_id + context_offset;
+    int pami_source;
+    int foundp;
+    MPID_Request * rreq = NULL;
 
     if (source == MPI_PROC_NULL)
-    {
-        MPIR_Status_set_procnull(status);
-        found = TRUE;
-        *message = NULL; /* should be interpreted as MPI_MESSAGE_NO_PROC */
-        goto fn_exit;
-    }
-
-    /* Inefficient implementation: we poll the unexpected queue looking for a
-     * matching request, interleaved with calls to progress.  If there are many
-     * non-matching unexpected messages in the queue then we will end up
-     * needlessly scanning the UQ.
-     *
-     * A smarter implementation would enqueue a partial request (one lacking the
-     * recv buffer triple) onto the PQ.  Unfortunately, this is a lot harder to
-     * do than it seems at first because of the spread-out nature of callers to
-     * various CH3U_Recvq routines and especially because of the enqueue/dequeue
-     * hooks for native MX tag matching support. */
-    MPIDI_CH3_Progress_start(&progress_state);
-    do
-    {
-        MPIU_THREAD_CS_ENTER(MSGQUEUE,);
-        *message = MPIDI_CH3U_Recvq_FDU_matchonly(source, tag, context_id, comm, &found);
-        MPIU_THREAD_CS_EXIT(MSGQUEUE,);
-        if (found)
-            break;
-
-        mpi_errno = MPIDI_CH3_Progress_wait(&progress_state);
+      {
+          MPIR_Status_set_procnull(status);
+          return MPI_SUCCESS;
+      }
+
+    if(source != MPI_ANY_SOURCE) {
+      pami_source = MPID_VCR_GET_LPID(comm->vcr, source);
+    } else {
+      pami_source = MPI_ANY_SOURCE;
     }
-    while(mpi_errno == MPI_SUCCESS);
-    MPIDI_CH3_Progress_end(&progress_state);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+#ifndef OUT_OF_ORDER_HANDLING
+    MPID_PROGRESS_WAIT_WHILE((rreq=MPIDI_Recvq_FDU(source, tag, context, &foundp) ) == NULL );
+#else
+    MPID_PROGRESS_WAIT_WHILE((rreq=MPIDI_Recvq_FDU(source, pami_source, tag, context, &foundp) ) == NULL );
+#endif
 
-    if (*message) {
-        (*message)->kind = MPID_REQUEST_MPROBE;
-        MPIR_Request_extract_status((*message), status);
+    if (rreq) {
+       rreq->kind = MPID_REQUEST_MPROBE;
+       MPIR_Request_extract_status(rreq, status);
     }
-#endif
-fn_exit:
-    return mpi_errno;
-fn_fail:
-    goto fn_exit;
+     *message = rreq;
+    return MPI_SUCCESS;
 }
 
diff --git a/src/mpid/pamid/src/mpid_mrecv.c b/src/mpid/pamid/src/mpid_mrecv.c
index ff5fba8..fdd2b70 100644
--- a/src/mpid/pamid/src/mpid_mrecv.c
+++ b/src/mpid/pamid/src/mpid_mrecv.c
@@ -6,10 +6,6 @@
 
 #include "mpidimpl.h"
 
-#undef FUNCNAME
-#define FUNCNAME MPID_Imrecv
-#undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
 int MPID_Mrecv(void *buf, int count, MPI_Datatype datatype,
                MPID_Request *message, MPI_Status *status)
 {
@@ -21,7 +17,7 @@ int MPID_Mrecv(void *buf, int count, MPI_Datatype datatype,
     if (message == NULL) {
         /* treat as though MPI_MESSAGE_NO_PROC was passed */
         MPIR_Status_set_procnull(status);
-        goto fn_exit;
+	return mpi_errno;
     }
 
     /* There is no optimized MPID_Mrecv at this time because there is no real
@@ -29,30 +25,10 @@ int MPID_Mrecv(void *buf, int count, MPI_Datatype datatype,
      * creating a request unnecessarily for messages that are already present
      * and eligible for immediate completion. */
     mpi_errno = MPID_Imrecv(buf, count, datatype, message, &rreq);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
 
-    if (!MPID_Request_is_complete(rreq)) {
-        MPID_Progress_state progress_state;
+    MPID_PROGRESS_WAIT_WHILE(!MPID_Request_is_complete(rreq));
 
-        MPID_Progress_start(&progress_state);
-        while (!MPID_Request_is_complete(rreq))
-        {
-            mpi_errno = MPID_Progress_wait(&progress_state);
-            if (mpi_errno) {
-                /* --BEGIN ERROR HANDLING-- */
-                MPID_Progress_end(&progress_state);
-                MPIU_ERR_POP(mpi_errno);
-                /* --END ERROR HANDLING-- */
-            }
-        }
-        MPID_Progress_end(&progress_state);
-    }
     mpi_errno = MPIR_Request_complete(&req_handle, rreq, status, &active_flag);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-
-fn_exit:
     return mpi_errno;
-fn_fail:
-    goto fn_exit;
 }
 

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

Summary of changes:
 src/mpid/pamid/src/mpid_improbe.c |  113 ++++++------------------
 src/mpid/pamid/src/mpid_imrecv.c  |  176 ++++++++++++++-----------------------
 src/mpid/pamid/src/mpid_mprobe.c  |   71 +++++----------
 src/mpid/pamid/src/mpid_mrecv.c   |   28 +------
 4 files changed, 121 insertions(+), 267 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list