[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2a2-37-gc44a365

Service Account noreply at mpich.org
Mon Dec 8 11:11:01 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  c44a365ae8073e0d930cd6dc79a1d4c11bdd07bd (commit)
      from  28a29352ff9f3e9fbdee6350d93649d4f99d2191 (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/c44a365ae8073e0d930cd6dc79a1d4c11bdd07bd

commit c44a365ae8073e0d930cd6dc79a1d4c11bdd07bd
Author: artem.v.yalozo <artem.v.yalozo at intel.com>
Date:   Thu Oct 23 11:48:41 2014 +0400

    Windows conformance: RMA mutexes
    
    This patch provides the following fix wrt Windows conformance feature
    (makes single code working on both platforms Linux and Windows):
        - RMA mutexes fix for Windows
    
    Change-Id: Ib4f7b2ec8a07813f0ed35281a1d584637c84c0a9
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/mpi/errhan/errnames.txt b/src/mpi/errhan/errnames.txt
index 011d9fa..eff8eaa 100644
--- a/src/mpi/errhan/errnames.txt
+++ b/src/mpi/errhan/errnames.txt
@@ -590,7 +590,6 @@ is too big (> MPIU_SHMW_GHND_SZ)
 **msgrcv:msgrcv failed
 **msgrcv %d:msgrcv returned %d
 **nextbootmsg:failed to get the next bootstrap message
-**winwait:WaitForSingleObject failed
 **CreateThread:CreateThread failed
 **CreateThread %d:CreateThread failed, error %d
 **FindWindowEx:FindWindowEx failed
@@ -815,6 +814,8 @@ is too big (> MPIU_SHMW_GHND_SZ)
 **pthread_unlock %s:pthread_unlock failed (%s)
 **pthread_mutex:pthread mutex routine failed
 **pthread_mutex %s:pthread mutex routine failed (%s)
+**windows_mutex:Windows mutex routine failed
+**windows_mutex %s:Windows mutex routine failed (%s)
 **badportrange:MPICH_PORT_RANGE - invalid range specified
 **argstr_missingifname:Missing ifname or invalid host/port description in business card
 **rtspkt:failure occurred while attempting to send RTS packet
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 90aec70..33a28d0 100644
--- a/src/mpid/ch3/channels/nemesis/include/mpidi_ch3_impl.h
+++ b/src/mpid/ch3/channels/nemesis/include/mpidi_ch3_impl.h
@@ -87,6 +87,7 @@ int MPIDI_CH3_SHM_Win_free(MPID_Win **win_ptr);
 
 /* Shared memory window atomic/accumulate mutex implementation */
 
+#if !defined(HAVE_WINDOWS_H)
 #define MPIDI_CH3I_SHM_MUTEX_LOCK(win_ptr)                                              \
     do {                                                                                \
         int pt_err = pthread_mutex_lock((win_ptr)->shm_mutex);                          \
@@ -126,6 +127,64 @@ int MPIDI_CH3_SHM_Win_free(MPID_Win **win_ptr);
         MPIU_ERR_CHKANDJUMP1(pt_err, mpi_errno, MPI_ERR_OTHER, "**pthread_mutex",       \
                              "**pthread_mutex %s", strerror(pt_err));                   \
     } while (0);
+#else
+#define HANDLE_WIN_MUTEX_ERROR()                                                        \
+    do {                                                                                \
+        HLOCAL str;                                                                     \
+        char error_msg[MPIU_STRERROR_BUF_SIZE];                                         \
+        DWORD error = GetLastError();                                                   \
+        int num_bytes = FormatMessage(                                                  \
+        FORMAT_MESSAGE_FROM_SYSTEM |                                                    \
+        FORMAT_MESSAGE_ALLOCATE_BUFFER,                                                 \
+        0,                                                                              \
+        error,                                                                          \
+        MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ),                                    \
+        (LPTSTR) &str,                                                                  \
+        0,0);                                                                           \
+                                                                                        \
+        if (num_bytes != 0) {                                                           \
+            int pt_err = 1;                                                             \
+            int mpi_errno = MPI_ERR_OTHER;                                              \
+            MPIU_Strncpy(error_msg, str, MPIU_STRERROR_BUF_SIZE);                       \
+            LocalFree(str);                                                             \
+            strtok(error_msg, "\r\n");                                                  \
+            MPIU_ERR_CHKANDJUMP1(pt_err, mpi_errno, MPI_ERR_OTHER, "**windows_mutex",   \
+                                 "**windows_mutex %s", error_msg);                      \
+        }                                                                               \
+    } while (0);
+
+#define MPIDI_CH3I_SHM_MUTEX_LOCK(win_ptr)                                              \
+    do {                                                                                \
+        DWORD result = WaitForSingleObject(*((win_ptr)->shm_mutex), INFINITE);          \
+        if (result == WAIT_FAILED) {                                                    \
+            HANDLE_WIN_MUTEX_ERROR();                                                   \
+        }                                                                               \
+    } while (0);
+
+#define MPIDI_CH3I_SHM_MUTEX_UNLOCK(win_ptr)                                            \
+    do {                                                                                \
+        BOOL result = ReleaseMutex(*((win_ptr)->shm_mutex));                            \
+        if (!result) {                                                                  \
+            HANDLE_WIN_MUTEX_ERROR();                                                   \
+        }                                                                               \
+    } while (0);
+
+#define MPIDI_CH3I_SHM_MUTEX_INIT(win_ptr)                                              \
+    do {                                                                                \
+        *((win_ptr)->shm_mutex) = CreateMutex(NULL, FALSE, NULL);                       \
+        if (*((win_ptr)->shm_mutex) == NULL) {                                          \
+            HANDLE_WIN_MUTEX_ERROR();                                                   \
+        }                                                                               \
+    } while (0);
+
+#define MPIDI_CH3I_SHM_MUTEX_DESTROY(win_ptr)                                           \
+    do {                                                                                \
+        BOOL result = CloseHandle(*((win_ptr)->shm_mutex));                             \
+        if (!result) {                                                                  \
+            HANDLE_WIN_MUTEX_ERROR();                                                   \
+        }                                                                               \
+    } while (0);
+#endif /* !defined(HAVE_WINDOWS_H) */
 
 
 /* Starting of shared window list */

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

Summary of changes:
 src/mpi/errhan/errnames.txt                        |    3 +-
 .../ch3/channels/nemesis/include/mpidi_ch3_impl.h  |   59 ++++++++++++++++++++
 2 files changed, 61 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list