Commit e1d9becf authored by James Dinan's avatar James Dinan
Browse files

[svn-r10679] 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
parent 251ee801
#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
......@@ -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 @@ int main(int argc, char *argv[])
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++;
}
}
......
......@@ -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 @@ int main(int argc, char *argv[])
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++;
}
}
......
......@@ -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 @@ int main(int argc, char *argv[])
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++;
}
}
......
......@@ -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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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++;
}
}
......
......@@ -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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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++;
}
}
......
......@@ -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 @@ int main(int argc, char *argv[])
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++;
}
}
......
......@@ -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 @@ int main(int argc, char *argv[])
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++;
}
}
......
......@@ -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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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++;
}
}
......
......@@ -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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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++;
}
}
......
......@@ -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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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++;
}
}
......
......@@ -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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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++;
}
}
......
......@@ -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 @@ int main(int argc, char *argv[])
{
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++;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment