[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.0.2-23-g89407ec

mysql vizuser noreply at mpich.org
Thu Feb 21 11:33:51 CST 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  89407ecc99f5b08a6fd44132ae44faa99dc9a71e (commit)
      from  e971ce3d34f599a6e0ca35beaf3e1f9d391b81fc (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/89407ecc99f5b08a6fd44132ae44faa99dc9a71e

commit 89407ecc99f5b08a6fd44132ae44faa99dc9a71e
Author: James Dinan <dinan at mcs.anl.gov>
Date:   Thu Feb 21 11:27:17 2013 -0600

    Minor cleanups to MCS mutex test
    
    Reviewer: none

diff --git a/test/mpi/rma/mcs-mutex.c b/test/mpi/rma/mcs-mutex.c
index 614e0dc..533fbdb 100644
--- a/test/mpi/rma/mcs-mutex.c
+++ b/test/mpi/rma/mcs-mutex.c
@@ -48,8 +48,8 @@ int MCS_Mutex_create(int tail_rank, MPI_Comm comm, MCS_Mutex * hdl_out)
 
     MPI_Win_lock_all(0, hdl->window);
 
-    hdl->base[0] = -1;
-    hdl->base[1] = -1;
+    hdl->base[0] = MPI_PROC_NULL;
+    hdl->base[1] = MPI_PROC_NULL;
 
     MPI_Win_sync(hdl->window);
     MPI_Barrier(hdl->comm);
@@ -96,7 +96,7 @@ int MCS_Mutex_lock(MCS_Mutex hdl)
 
     /* This store is safe, since it cannot happen concurrently with a remote
      * write */
-    hdl->base[MCS_MTX_ELEM_DISP] = -1;
+    hdl->base[MCS_MTX_ELEM_DISP] = MPI_PROC_NULL;
     MPI_Win_sync(hdl->window);
 
     MPI_Fetch_and_op(&rank, &prev, MPI_INT, hdl->tail_rank, MCS_MTX_TAIL_DISP,
@@ -105,7 +105,7 @@ int MCS_Mutex_lock(MCS_Mutex hdl)
 
     /* If there was a previous tail, update their next pointer and wait for
      * notification.  Otherwise, the mutex was successfully acquired. */
-    if (prev != -1) {
+    if (prev != MPI_PROC_NULL) {
         /* Wait for notification */
         MPI_Status status;
 
@@ -113,7 +113,7 @@ int MCS_Mutex_lock(MCS_Mutex hdl)
         MPI_Win_flush(prev, hdl->window);
 
         debug_print("%2d: LOCK   - waiting for notification from %d\n", rank, prev);
-        MPI_Recv(NULL, 0, MPI_BYTE, prev, MPI_MUTEX_TAG, hdl->comm, &status);
+        MPI_Recv(NULL, 0, MPI_BYTE, prev, MCS_MUTEX_TAG, hdl->comm, &status);
     }
 
     debug_print("%2d: LOCK   - lock acquired\n", rank);
@@ -131,14 +131,14 @@ int MCS_Mutex_lock(MCS_Mutex hdl)
 int MCS_Mutex_trylock(MCS_Mutex hdl, int *success)
 {
     int rank, nproc;
-    int tail, nil = -1;
+    int tail, nil = MPI_PROC_NULL;
 
     MPI_Comm_rank(hdl->comm, &rank);
     MPI_Comm_size(hdl->comm, &nproc);
 
     /* This store is safe, since it cannot happen concurrently with a remote
      * write */
-    hdl->base[MCS_MTX_ELEM_DISP] = -1;
+    hdl->base[MCS_MTX_ELEM_DISP] = MPI_PROC_NULL;
     MPI_Win_sync(hdl->window);
 
     /* Check if the lock is available and claim it if it is. */
@@ -146,7 +146,7 @@ int MCS_Mutex_trylock(MCS_Mutex hdl, int *success)
                          MCS_MTX_TAIL_DISP, hdl->window);
     MPI_Win_flush(hdl->tail_rank, hdl->window);
 
-    /* If the old tail was -1, we have claimed the mutex */
+    /* If the old tail was MPI_PROC_NULL, we have claimed the mutex */
     *success = (tail == nil);
 
     debug_print("%2d: TRYLOCK - %s\n", rank, (*success) ? "Success" : "Non-success");
@@ -175,9 +175,9 @@ int MCS_Mutex_unlock(MCS_Mutex hdl)
                      hdl->window);
     MPI_Win_flush(rank, hdl->window);
 
-    if ( next == -1) {
+    if ( next == MPI_PROC_NULL) {
         int tail;
-        int nil = -1;
+        int nil = MPI_PROC_NULL;
 
         /* Check if we are the at the tail of the lock queue.  If so, we're
          * done.  If not, we need to send notification. */
@@ -196,7 +196,7 @@ int MCS_Mutex_unlock(MCS_Mutex hdl)
                                  MPI_NO_OP, hdl->window);
 
                 MPI_Win_flush(rank, hdl->window);
-                if (next != -1) break;
+                if (next != MPI_PROC_NULL) break;
 
                 MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag,
                            MPI_STATUS_IGNORE);
@@ -205,9 +205,9 @@ int MCS_Mutex_unlock(MCS_Mutex hdl)
     }
 
     /* Notify the next waiting process */
-    if (next != -1) {
+    if (next != MPI_PROC_NULL) {
         debug_print("%2d: UNLOCK - notifying %d\n", rank, next);
-        MPI_Send(NULL, 0, MPI_BYTE, next, MPI_MUTEX_TAG, hdl->comm);
+        MPI_Send(NULL, 0, MPI_BYTE, next, MCS_MUTEX_TAG, hdl->comm);
     }
 
     debug_print("%2d: UNLOCK - lock released\n", rank);
diff --git a/test/mpi/rma/mcs-mutex.h b/test/mpi/rma/mcs-mutex.h
index ac6a17c..c8d8843 100644
--- a/test/mpi/rma/mcs-mutex.h
+++ b/test/mpi/rma/mcs-mutex.h
@@ -9,7 +9,7 @@
 
 #include <mpi.h>
 
-#define MPI_MUTEX_TAG 100
+#define MCS_MUTEX_TAG 100
 
 #ifdef ENABLE_DEBUG
 #define debug_print(...) do { printf(__VA_ARGS__); } while (0)

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

Summary of changes:
 test/mpi/rma/mcs-mutex.c |   26 +++++++++++++-------------
 test/mpi/rma/mcs-mutex.h |    2 +-
 2 files changed, 14 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list