[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.0.4-354-g1182a62

mysql vizuser noreply at mpich.org
Fri Jul 19 13:39:47 CDT 2013


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  1182a62aaa1b016f9fefcf78485b6b80b765eb47 (commit)
      from  1ffd39ba42b3ef1c6ae7e09484d7257b756bfab1 (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/1182a62aaa1b016f9fefcf78485b6b80b765eb47

commit 1182a62aaa1b016f9fefcf78485b6b80b765eb47
Author: Xin Zhao <xinzhao3 at illinois.edu>
Date:   Fri Jul 19 02:18:07 2013 -0500

    fix bug of zero-byte shared window allocation.
    
    In MPIDI_CH3I_Win_allocate_shared, if the size of shared memory
    segment is 0, we just set window's base to NULL, do not allocate
    shared memory segment and mutex memory region.
    
    In MPIDI_CH3I_SHM_Win_free, we detach the shared memory segment
    and mutex memory region only when the size of shared memory segment
    is not 0.
    
    Signed-off-by: Pavan Balaji <balaji at mcs.anl.gov>

diff --git a/src/mpid/ch3/channels/nemesis/src/ch3_rma_shm.c b/src/mpid/ch3/channels/nemesis/src/ch3_rma_shm.c
index 09b101b..08c6a1d 100644
--- a/src/mpid/ch3/channels/nemesis/src/ch3_rma_shm.c
+++ b/src/mpid/ch3/channels/nemesis/src/ch3_rma_shm.c
@@ -68,16 +68,19 @@ int MPIDI_CH3_SHM_Win_free(MPID_Win **win_ptr)
     if ((*win_ptr)->shm_allocated) {
         /* free shm_base_addrs that's only used for shared memory windows */
         MPIU_Free((*win_ptr)->shm_base_addrs);
-        /* detach from shared memory segment */
-        mpi_errno = MPIU_SHMW_Seg_detach((*win_ptr)->shm_segment_handle, (char **)&(*win_ptr)->shm_base_addr,
+
+        if ((*win_ptr)->shm_segment_len > 0) {
+            /* detach from shared memory segment */
+            mpi_errno = MPIU_SHMW_Seg_detach((*win_ptr)->shm_segment_handle, (char **)&(*win_ptr)->shm_base_addr,
                                          (*win_ptr)->shm_segment_len);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
 
-        MPIU_SHMW_Hnd_finalize(&(*win_ptr)->shm_segment_handle);
+            MPIU_SHMW_Hnd_finalize(&(*win_ptr)->shm_segment_handle);
+        }
     }
 
     /* Free shared process mutex memory region */
-    if ((*win_ptr)->shm_mutex) {
+    if ((*win_ptr)->shm_mutex && (*win_ptr)->shm_segment_len > 0) {
 
         if ((*win_ptr)->comm_ptr->rank == 0) {
             MPIDI_CH3I_SHM_MUTEX_DESTROY(*win_ptr);
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 138b473..8942ed2 100644
--- a/src/mpid/ch3/channels/nemesis/src/ch3_win_fns.c
+++ b/src/mpid/ch3/channels/nemesis/src/ch3_win_fns.c
@@ -133,6 +133,11 @@ static int MPIDI_CH3I_Win_allocate_shared(MPI_Aint size, int disp_unit, MPID_Inf
             (*win_ptr)->shm_segment_len += (*win_ptr)->sizes[i];
     }
 
+    if ((*win_ptr)->shm_segment_len == 0) {
+        (*win_ptr)->base = NULL;
+    }
+
+    else {
     mpi_errno = MPIU_SHMW_Hnd_init(&(*win_ptr)->shm_segment_handle);
     if (mpi_errno) MPIU_ERR_POP(mpi_errno);
 
@@ -252,6 +257,7 @@ static int MPIDI_CH3I_Win_allocate_shared(MPI_Aint size, int disp_unit, MPID_Inf
     }
 
     (*win_ptr)->base = (*win_ptr)->shm_base_addrs[rank];
+    }
 
     /* get the base addresses of the windows.  Note we reuse tmp_buf from above
        since it's at least as large as we need it for this allgather. */

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

Summary of changes:
 src/mpid/ch3/channels/nemesis/src/ch3_rma_shm.c |   13 ++++++++-----
 src/mpid/ch3/channels/nemesis/src/ch3_win_fns.c |    6 ++++++
 2 files changed, 14 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list