Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update RMA tests
[simgrid.git] / teshsuite / smpi / mpich3-test / rma / compare_and_swap.c
index 96eace1..c9f1696 100644 (file)
 
 #define ITER 100
 
-int main(int argc, char **argv) {
-    int       i, j, rank, nproc;
-    int       errors = 0, all_errors = 0;
-    int      *val_ptr;
-    MPI_Win   win;
+int main(int argc, char **argv)
+{
+    int i, rank, nproc;
+    int errors = 0, all_errors = 0;
+    int *val_ptr;
+    MPI_Win win;
 
     MPI_Init(&argc, &argv);
 
@@ -39,8 +40,8 @@ int main(int argc, char **argv) {
         MPI_Compare_and_swap(&next, &i, &result, MPI_INT, rank, 0, win);
         MPI_Win_unlock(rank, win);
         if (result != i) {
-            SQUELCH( printf("%d->%d -- Error: next=%d compare=%d result=%d val=%d\n", rank,
-                           rank, next, i, result, *val_ptr); );
+            SQUELCH(printf("%d->%d -- Error: next=%d compare=%d result=%d val=%d\n", rank,
+                           rank, next, i, result, *val_ptr););
             errors++;
         }
     }
@@ -55,12 +56,12 @@ int main(int argc, char **argv) {
 
     for (i = 0; i < ITER; i++) {
         int next = i + 1, result = -1;
-        MPI_Win_lock(MPI_LOCK_EXCLUSIVE, (rank+1)%nproc, 0, win);
-        MPI_Compare_and_swap(&next, &i, &result, MPI_INT, (rank+1)%nproc, 0, win);
-        MPI_Win_unlock((rank+1)%nproc, win);
+        MPI_Win_lock(MPI_LOCK_EXCLUSIVE, (rank + 1) % nproc, 0, win);
+        MPI_Compare_and_swap(&next, &i, &result, MPI_INT, (rank + 1) % nproc, 0, win);
+        MPI_Win_unlock((rank + 1) % nproc, win);
         if (result != i) {
-            SQUELCH( printf("%d->%d -- Error: next=%d compare=%d result=%d val=%d\n", rank,
-                           (rank+1)%nproc, next, i, result, *val_ptr); );
+            SQUELCH(printf("%d->%d -- Error: next=%d compare=%d result=%d val=%d\n", rank,
+                           (rank + 1) % nproc, next, i, result, *val_ptr););
             errors++;
         }
     }
@@ -89,7 +90,7 @@ int main(int argc, char **argv) {
 
     if (rank == 0 && nproc > 1) {
         if (*val_ptr != ITER) {
-            SQUELCH( printf("%d - Error: expected=%d val=%d\n", rank, ITER, *val_ptr); );
+            SQUELCH(printf("%d - Error: expected=%d val=%d\n", rank, ITER, *val_ptr););
             errors++;
         }
     }