[mpich-commits] r10679 - mpich2/trunk/test/mpi/rma

dinan at mcs.anl.gov dinan at mcs.anl.gov
Tue Nov 27 17:40:04 CST 2012


Author: dinan
Date: 2012-11-27 17:40:04 -0600 (Tue, 27 Nov 2012)
New Revision: 10679

Added:
   mpich2/trunk/test/mpi/rma/squelch.h
Modified:
   mpich2/trunk/test/mpi/rma/test1.c
   mpich2/trunk/test/mpi/rma/test1_am.c
   mpich2/trunk/test/mpi/rma/test1_dt.c
   mpich2/trunk/test/mpi/rma/test2.c
   mpich2/trunk/test/mpi/rma/test2_am.c
   mpich2/trunk/test/mpi/rma/test3.c
   mpich2/trunk/test/mpi/rma/test3_am.c
   mpich2/trunk/test/mpi/rma/test4.c
   mpich2/trunk/test/mpi/rma/test4_am.c
   mpich2/trunk/test/mpi/rma/test5.c
   mpich2/trunk/test/mpi/rma/test5_am.c
   mpich2/trunk/test/mpi/rma/transpose3.c
Log:
Updated RMA tests to squelch error messages

Many RMA tests did not limit their output when an error occurred.  This adds
the simple SQUELCH() macro to these tests to limit per-process error messages.

Reviewer: goodell

Added: mpich2/trunk/test/mpi/rma/squelch.h
===================================================================
--- mpich2/trunk/test/mpi/rma/squelch.h	                        (rev 0)
+++ mpich2/trunk/test/mpi/rma/squelch.h	2012-11-27 23:40:04 UTC (rev 10679)
@@ -0,0 +1,16 @@
+#ifndef SQUELCH_H_INCLUDED
+#define SQUELCH_H_INCLUDED
+
+static const int SQ_LIMIT   = 10;
+static       int SQ_COUNT   = 0;
+static       int SQ_VERBOSE = 0;
+
+#define SQUELCH(X)                              \
+  do {                                          \
+    if (SQ_COUNT < SQ_LIMIT || SQ_VERBOSE) {    \
+      SQ_COUNT++;                               \
+      X                                         \
+    }                                           \
+  } while (0)
+
+#endif

Modified: mpich2/trunk/test/mpi/rma/test1.c
===================================================================
--- mpich2/trunk/test/mpi/rma/test1.c	2012-11-27 23:40:02 UTC (rev 10678)
+++ mpich2/trunk/test/mpi/rma/test1.c	2012-11-27 23:40:04 UTC (rev 10679)
@@ -6,6 +6,7 @@
 #include "mpi.h" 
 #include "stdio.h"
 #include "mpitest.h"
+#include "squelch.h"
 
 /* tests a series of puts, gets, and accumulate on 2 processes using fence */
 
@@ -60,14 +61,14 @@
         if (rank == 1) {
             for (i=0; i<SIZE-1; i++) {
                 if (A[i] != B[i]) {
-                    printf("Put/Get Error: A[i]=%d, B[i]=%d\n", A[i], B[i]);
+                    SQUELCH( printf("Put/Get Error: A[i]=%d, B[i]=%d\n", A[i], B[i]); );
                     errs++;
  	            }
             }
         }
         else {
             if (B[SIZE-1] != SIZE - 1 - 3*(SIZE-1)) {
-                printf("Accumulate Error: B[SIZE-1] is %d, should be %d\n", B[SIZE-1], SIZE - 1 - 3*(SIZE-1));
+                SQUELCH( printf("Accumulate Error: B[SIZE-1] is %d, should be %d\n", B[SIZE-1], SIZE - 1 - 3*(SIZE-1)); );
                 errs++;
             }
  	   }

Modified: mpich2/trunk/test/mpi/rma/test1_am.c
===================================================================
--- mpich2/trunk/test/mpi/rma/test1_am.c	2012-11-27 23:40:02 UTC (rev 10678)
+++ mpich2/trunk/test/mpi/rma/test1_am.c	2012-11-27 23:40:04 UTC (rev 10679)
@@ -6,6 +6,7 @@
 #include "mpi.h" 
 #include "stdio.h"
 #include "mpitest.h"
+#include "squelch.h"
 
 /* tests a series of puts, gets, and accumulate on 2 processes using fence */
 
@@ -75,14 +76,14 @@
         if (rank == 1) {
             for (i=0; i<SIZE-1; i++) {
                 if (A[i] != B[i]) {
-                    printf("Put/Get Error: A[i]=%d, B[i]=%d\n", A[i], B[i]);
+                    SQUELCH( printf("Put/Get Error: A[i]=%d, B[i]=%d\n", A[i], B[i]); );
                     errs++;
  	       }
             }
         }
         else {
             if (B[SIZE-1] != SIZE - 1 - 3*(SIZE-1)) {
-                printf("Accumulate Error: B[SIZE-1] is %d, should be %d\n", B[SIZE-1], SIZE - 1 - 3*(SIZE-1));
+                SQUELCH( printf("Accumulate Error: B[SIZE-1] is %d, should be %d\n", B[SIZE-1], SIZE - 1 - 3*(SIZE-1)); );
                 errs++;
             }
  	    }

Modified: mpich2/trunk/test/mpi/rma/test1_dt.c
===================================================================
--- mpich2/trunk/test/mpi/rma/test1_dt.c	2012-11-27 23:40:02 UTC (rev 10678)
+++ mpich2/trunk/test/mpi/rma/test1_dt.c	2012-11-27 23:40:04 UTC (rev 10679)
@@ -6,6 +6,7 @@
 #include "mpi.h" 
 #include "stdio.h"
 #include "mpitest.h"
+#include "squelch.h"
 
 /* tests a series of puts, gets, and accumulate on 2 processes using fence */
 /* Same as test1.c but uses derived datatypes to receive data */
@@ -66,14 +67,14 @@
         if (rank == 1) {
             for (i=0; i<SIZE-2; i++) {
                 if (A[i] != B[i]) {
-                    printf("Put/Get Error: A[i]=%d, B[i]=%d\n", A[i], B[i]);
+                    SQUELCH( printf("Put/Get Error: A[i]=%d, B[i]=%d\n", A[i], B[i]); );
                     errs++;
                 }
             }
         }
         else {
             if (B[SIZE-1] != SIZE - 1 - 3*(SIZE-1)) {
-                printf("Accumulate Error: B[SIZE-1] is %d, should be %d\n", B[SIZE-1], SIZE - 1 - 3*(SIZE-1));
+                SQUELCH( printf("Accumulate Error: B[SIZE-1] is %d, should be %d\n", B[SIZE-1], SIZE - 1 - 3*(SIZE-1)); );
                 errs++;
             }
         }

Modified: mpich2/trunk/test/mpi/rma/test2.c
===================================================================
--- mpich2/trunk/test/mpi/rma/test2.c	2012-11-27 23:40:02 UTC (rev 10678)
+++ mpich2/trunk/test/mpi/rma/test2.c	2012-11-27 23:40:04 UTC (rev 10679)
@@ -6,6 +6,7 @@
 #include "mpi.h" 
 #include "stdio.h"
 #include "mpitest.h"
+#include "squelch.h"
 
 /* tests put and get with post/start/complete/wait on 2 processes */
 
@@ -50,7 +51,7 @@
 
             for (i=0; i<SIZE1; i++)
                 if (B[i] != (-4)*(i+SIZE1)) {
-                    printf("Get Error: B[i] is %d, should be %d\n", B[i], (-4)*(i+SIZE1));
+                    SQUELCH( printf("Get Error: B[i] is %d, should be %d\n", B[i], (-4)*(i+SIZE1)); );
                     errs++;
                 }
         }
@@ -64,7 +65,7 @@
 
             for (i=0; i<SIZE1; i++) {
                 if (B[i] != i) {
-                    printf("Put Error: B[i] is %d, should be %d\n", B[i], i);
+                    SQUELCH( printf("Put Error: B[i] is %d, should be %d\n", B[i], i); );
                     errs++;
                 }
             }

Modified: mpich2/trunk/test/mpi/rma/test2_am.c
===================================================================
--- mpich2/trunk/test/mpi/rma/test2_am.c	2012-11-27 23:40:02 UTC (rev 10678)
+++ mpich2/trunk/test/mpi/rma/test2_am.c	2012-11-27 23:40:04 UTC (rev 10679)
@@ -6,6 +6,7 @@
 #include "mpi.h" 
 #include "stdio.h"
 #include "mpitest.h"
+#include "squelch.h"
 
 /* tests put and get with post/start/complete/wait on 2 processes */
 
@@ -64,7 +65,7 @@
 
             for (i=0; i<SIZE1; i++)
                 if (B[i] != (-4)*(i+SIZE1)) {
-                    printf("Get Error: B[i] is %d, should be %d\n", B[i], (-4)*(i+SIZE1));
+                    SQUELCH( printf("Get Error: B[i] is %d, should be %d\n", B[i], (-4)*(i+SIZE1)); );
                     errs++;
                 }
         }
@@ -78,7 +79,7 @@
 
             for (i=0; i<SIZE1; i++) {
                 if (B[i] != i) {
-                    printf("Put Error: B[i] is %d, should be %d\n", B[i], i);
+                    SQUELCH( printf("Put Error: B[i] is %d, should be %d\n", B[i], i); );
                     errs++;
                 }
             }

Modified: mpich2/trunk/test/mpi/rma/test3.c
===================================================================
--- mpich2/trunk/test/mpi/rma/test3.c	2012-11-27 23:40:02 UTC (rev 10678)
+++ mpich2/trunk/test/mpi/rma/test3.c	2012-11-27 23:40:04 UTC (rev 10679)
@@ -7,6 +7,7 @@
 #include "stdio.h"
 #include "stdlib.h"
 #include "mpitest.h"
+#include "squelch.h"
 
 /* Tests the example in Fig 6.8, pg 142, MPI-2 standard. Process 1 has
    a blocking MPI_Recv between the Post and Wait. Therefore, this
@@ -76,11 +77,11 @@
 
             for (i=0; i<SIZE; i++) {
                 if (B[i] != i) {
-                    printf("Rank 1: Put Error: B[i] is %d, should be %d\n", B[i], i);
+                    SQUELCH( printf("Rank 1: Put Error: B[i] is %d, should be %d\n", B[i], i); );
                     errs++;
                 }
                 if (A[i] != SIZE + i) {
-                    printf("Rank 1: Send/Recv Error: A[i] is %d, should be %d\n", A[i], SIZE+i);
+                    SQUELCH( printf("Rank 1: Send/Recv Error: A[i] is %d, should be %d\n", A[i], SIZE+i); );
                     errs++;
                 }
             }

Modified: mpich2/trunk/test/mpi/rma/test3_am.c
===================================================================
--- mpich2/trunk/test/mpi/rma/test3_am.c	2012-11-27 23:40:02 UTC (rev 10678)
+++ mpich2/trunk/test/mpi/rma/test3_am.c	2012-11-27 23:40:04 UTC (rev 10679)
@@ -7,6 +7,7 @@
 #include "stdio.h"
 #include "stdlib.h"
 #include "mpitest.h"
+#include "squelch.h"
 
 /* Tests the example in Fig 6.8, pg 142, MPI-2 standard. Process 1 has
    a blocking MPI_Recv between the Post and Wait. Therefore, this
@@ -76,11 +77,11 @@
 
             for (i=0; i<SIZE; i++) {
                 if (B[i] != i) {
-                    printf("Rank 1: Put Error: B[i] is %d, should be %d\n", B[i], i);
+                    SQUELCH( printf("Rank 1: Put Error: B[i] is %d, should be %d\n", B[i], i); );
                     errs++;
                 }
                 if (A[i] != SIZE + i) {
-                    printf("Rank 1: Send/Recv Error: A[i] is %d, should be %d\n", A[i], SIZE+i);
+                    SQUELCH( printf("Rank 1: Send/Recv Error: A[i] is %d, should be %d\n", A[i], SIZE+i); );
                     errs++;
                 }
             }

Modified: mpich2/trunk/test/mpi/rma/test4.c
===================================================================
--- mpich2/trunk/test/mpi/rma/test4.c	2012-11-27 23:40:02 UTC (rev 10678)
+++ mpich2/trunk/test/mpi/rma/test4.c	2012-11-27 23:40:04 UTC (rev 10679)
@@ -7,6 +7,7 @@
 #include "stdio.h"
 #include "stdlib.h"
 #include "mpitest.h"
+#include "squelch.h"
 
 /* tests passive target RMA on 2 processes. tests the lock-single_op-unlock 
    optimization. */
@@ -55,7 +56,7 @@
 
             for (i=0; i<SIZE1; i++)
                 if (B[i] != (-4)*(i+SIZE1)) {
-                    printf("Get Error: B[%d] is %d, should be %d\n", i, B[i], (-4)*(i+SIZE1));
+                    SQUELCH( printf("Get Error: B[%d] is %d, should be %d\n", i, B[i], (-4)*(i+SIZE1)); );
                     errs++;
                 }
         }
@@ -67,7 +68,7 @@
 
             for (i=0; i<SIZE1; i++) {
                 if (B[i] != i) {
-                    printf("Put Error: B[%d] is %d, should be %d\n", i, B[i], i);
+                    SQUELCH( printf("Put Error: B[%d] is %d, should be %d\n", i, B[i], i); );
                     errs++;
                 }
             }

Modified: mpich2/trunk/test/mpi/rma/test4_am.c
===================================================================
--- mpich2/trunk/test/mpi/rma/test4_am.c	2012-11-27 23:40:02 UTC (rev 10678)
+++ mpich2/trunk/test/mpi/rma/test4_am.c	2012-11-27 23:40:04 UTC (rev 10679)
@@ -7,6 +7,7 @@
 #include "stdio.h"
 #include "stdlib.h"
 #include "mpitest.h"
+#include "squelch.h"
 
 /* tests passive target RMA on 2 processes. tests the lock-single_op-unlock 
    optimization. */
@@ -66,7 +67,7 @@
 
             for (i=0; i<SIZE1; i++)
                 if (B[i] != (-4)*(i+SIZE1)) {
-                    printf("Get Error: B[%d] is %d, should be %d\n", i, B[i], (-4)*(i+SIZE1));
+                    SQUELCH( printf("Get Error: B[%d] is %d, should be %d\n", i, B[i], (-4)*(i+SIZE1)); );
                     errs++;
                 }
         }
@@ -78,7 +79,7 @@
 
             for (i=0; i<SIZE1; i++) {
                 if (B[i] != i) {
-                    printf("Put Error: B[%d] is %d, should be %d\n", i, B[i], i);
+                    SQUELCH( printf("Put Error: B[%d] is %d, should be %d\n", i, B[i], i); );
                     errs++;
                 }
             }

Modified: mpich2/trunk/test/mpi/rma/test5.c
===================================================================
--- mpich2/trunk/test/mpi/rma/test5.c	2012-11-27 23:40:02 UTC (rev 10678)
+++ mpich2/trunk/test/mpi/rma/test5.c	2012-11-27 23:40:04 UTC (rev 10679)
@@ -6,6 +6,7 @@
 #include "mpi.h" 
 #include "stdio.h"
 #include "mpitest.h"
+#include "squelch.h"
 
 /* tests a series of Gets. Run on 2 processes. */
 
@@ -43,7 +44,7 @@
             MPI_Win_fence(0, win);
             for (i=0; i<SIZE; i++)
                 if (A[i] != 1000 + i) {
-                    printf("Rank 0: A[%d] is %d, should be %d\n", i, A[i], 1000+i);
+                    SQUELCH( printf("Rank 0: A[%d] is %d, should be %d\n", i, A[i], 1000+i); );
                     errs++;
                 }
         }
@@ -59,7 +60,7 @@
             MPI_Win_fence(0, win);
             for (i=0; i<SIZE; i++)
                 if (B[i] != 500 + i) {
-                    printf("Rank 1: B[%d] is %d, should be %d\n", i, B[i], 500+i);
+                    SQUELCH( printf("Rank 1: B[%d] is %d, should be %d\n", i, B[i], 500+i); );
                     errs++;
                 }
         }

Modified: mpich2/trunk/test/mpi/rma/test5_am.c
===================================================================
--- mpich2/trunk/test/mpi/rma/test5_am.c	2012-11-27 23:40:02 UTC (rev 10678)
+++ mpich2/trunk/test/mpi/rma/test5_am.c	2012-11-27 23:40:04 UTC (rev 10679)
@@ -6,6 +6,7 @@
 #include "mpi.h" 
 #include "stdio.h"
 #include "mpitest.h"
+#include "squelch.h"
 
 /* tests a series of Gets. Run on 2 processes. */
 
@@ -56,7 +57,7 @@
             MPI_Win_fence(0, win);
             for (i=0; i<SIZE; i++)
                 if (A[i] != 1000 + i) {
-                    printf("Rank 0: A[%d] is %d, should be %d\n", i, A[i], 1000+i);
+                    SQUELCH( printf("Rank 0: A[%d] is %d, should be %d\n", i, A[i], 1000+i); );
                     errs++;
                 }
         }
@@ -72,7 +73,7 @@
             MPI_Win_fence(0, win);
             for (i=0; i<SIZE; i++)
                 if (B[i] != 500 + i) {
-                    printf("Rank 1: B[%d] is %d, should be %d\n", i, B[i], 500+i);
+                    SQUELCH( printf("Rank 1: B[%d] is %d, should be %d\n", i, B[i], 500+i); );
                     errs++;
                 }
         }

Modified: mpich2/trunk/test/mpi/rma/transpose3.c
===================================================================
--- mpich2/trunk/test/mpi/rma/transpose3.c	2012-11-27 23:40:02 UTC (rev 10678)
+++ mpich2/trunk/test/mpi/rma/transpose3.c	2012-11-27 23:40:04 UTC (rev 10679)
@@ -6,6 +6,7 @@
 #include "mpi.h" 
 #include "stdio.h"
 #include "mpitest.h"
+#include "squelch.h"
 
 /* transposes a matrix using post/start/complete/wait and derived
    datatypes. Uses  vector and hvector (Example 3.32 from MPI 1.1
@@ -82,8 +83,8 @@
                     {
                         if (errs < 50)
                         {
-                            printf("Error: A[%d][%d]=%d should be %d\n", j, i,
-                                   A[j][i], i*NCOLS + j);
+                            SQUELCH( printf("Error: A[%d][%d]=%d should be %d\n", j, i,
+                                            A[j][i], i*NCOLS + j); );
                         }
                         errs++;
                     }



More information about the commits mailing list