[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1-175-gfdb733f

Service Account noreply at mpich.org
Wed Apr 23 15:47:10 CDT 2014


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

The branch, master has been updated
       via  fdb733f39d8dec453952a31868196def05333089 (commit)
      from  1cc4f6db6996f4e8c824743e878cef59dee74a11 (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/fdb733f39d8dec453952a31868196def05333089

commit fdb733f39d8dec453952a31868196def05333089
Author: Pavan Balaji <balaji at anl.gov>
Date:   Wed Apr 23 01:17:07 2014 -0500

    Check for shared memory support capability in Comm_split_type.
    
    Before returning a larger than size 1 communicator in comm_split type,
    make sure that the platform gives us the right tools to support shared
    memory.  For example, on FreeBSD, pthread_mutexes don't work
    correctly, even though they are a part of POSIX.  In such cases, we
    return a size 1 communicator in comm_split_type.
    
    Signed-off-by: Xin Zhao <xinzhao3 at illinois.edu>

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 e6367d3..5dd7f36 100644
--- a/src/mpid/ch3/channels/nemesis/include/mpidi_ch3_impl.h
+++ b/src/mpid/ch3/channels/nemesis/include/mpidi_ch3_impl.h
@@ -46,6 +46,7 @@ extern struct MPID_Request *MPIDI_CH3I_shm_active_send;
     /* the refcounts */                                                         \
     GENERIC_Q_ENQUEUE_MULTIPLE(qp, ep0, ep1, dev.next)
 
+int MPIDI_CH3I_Shm_supported(void);
 int MPIDI_CH3I_Progress_init(void);
 int MPIDI_CH3I_Progress_finalize(void);
 int MPIDI_CH3I_Shm_send_progress(void);
diff --git a/src/mpid/ch3/channels/nemesis/src/ch3_init.c b/src/mpid/ch3/channels/nemesis/src/ch3_init.c
index bec2a40..78a44a9 100644
--- a/src/mpid/ch3/channels/nemesis/src/ch3_init.c
+++ b/src/mpid/ch3/channels/nemesis/src/ch3_init.c
@@ -30,8 +30,12 @@ static int split_type(MPID_Comm * comm_ptr, int stype, int key,
     MPIR_Rank_t nid;
     int mpi_errno = MPI_SUCCESS;
 
-    mpi_errno = MPID_Get_node_id(comm_ptr, comm_ptr->rank, &id);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (MPIDI_CH3I_Shm_supported()) {
+        mpi_errno = MPID_Get_node_id(comm_ptr, comm_ptr->rank, &id);
+        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    }
+    else
+        id = comm_ptr->rank;
 
     nid = (stype == MPI_COMM_TYPE_SHARED) ? id : MPI_UNDEFINED;
     mpi_errno = MPIR_Comm_split_impl(comm_ptr, nid, key, newcomm_ptr);
@@ -46,6 +50,21 @@ static int split_type(MPID_Comm * comm_ptr, int stype, int key,
     /* --END ERROR HANDLING-- */
 }
 
+int MPIDI_CH3I_Shm_supported(void)
+{
+    int mutex_err;
+    pthread_mutexattr_t attr;
+
+    /* Test for PTHREAD_PROCESS_SHARED support.  Some platforms do not support
+     * this capability even though it is a part of the pthreads core API (e.g.,
+     * FreeBSD does not support this as of version 9.1) */
+    pthread_mutexattr_init(&attr);
+    mutex_err = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
+    pthread_mutexattr_destroy(&attr);
+
+    return !mutex_err;
+}
+
 static MPID_CommOps comm_fns = {
     split_type
 };
diff --git a/src/mpid/ch3/channels/nemesis/src/ch3_win_fns.c b/src/mpid/ch3/channels/nemesis/src/ch3_win_fns.c
index fc70901..41ebc03 100644
--- a/src/mpid/ch3/channels/nemesis/src/ch3_win_fns.c
+++ b/src/mpid/ch3/channels/nemesis/src/ch3_win_fns.c
@@ -26,22 +26,11 @@ static int MPIDI_CH3I_Win_allocate_shm(MPI_Aint size, int disp_unit, MPID_Info *
 int MPIDI_CH3_Win_fns_init(MPIDI_CH3U_Win_fns_t *win_fns)
 {
     int mpi_errno = MPI_SUCCESS;
-    int mutex_err;
-    pthread_mutexattr_t attr;
     MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_WIN_FNS_INIT);
 
     MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_CH3_WIN_FNS_INIT);
 
-    /* Test for PTHREAD_PROCESS_SHARED support.  Some platforms do not support
-     * this capability even though it is a part of the pthreads core API (e.g.,
-     * FreeBSD does not support this as of version 9.1) */
-    pthread_mutexattr_init(&attr);
-    mutex_err = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
-    pthread_mutexattr_destroy(&attr);
-
-    /* Only allocate shared memory windows if we can use
-     * pthread_mutexattr_setpshared correctly. */
-    if (!mutex_err)
+    if (MPIDI_CH3I_Shm_supported())
         win_fns->allocate_shm = MPIDI_CH3I_Win_allocate_shm;
 
     MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_CH3_WIN_FNS_INIT);

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

Summary of changes:
 .../ch3/channels/nemesis/include/mpidi_ch3_impl.h  |    1 +
 src/mpid/ch3/channels/nemesis/src/ch3_init.c       |   23 ++++++++++++++++++-
 src/mpid/ch3/channels/nemesis/src/ch3_win_fns.c    |   13 +----------
 3 files changed, 23 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list