Commit 55624189 authored by William Gropp's avatar William Gropp
Browse files

[svn-r7011] Added testing for MPI version in configure; runtest now implements...

[svn-r7011] Added testing for MPI version in configure; runtest now implements an mpiversion=2.2 option for tests so that tests that require new routines are not run on older MPI implementations, and enhanced error reporting from many of the tests to help in giving more specific error messages for MPI implementations that fail the tests (these particular tests chosen because they failed on one or more versions of the IBM MPI implementation)
parent 0fbda9c6
......@@ -86,28 +86,40 @@ struct double_test { double a; int b; };
free(in); free(out); free(sol); \
} while(0)
/* The logic on the error check on MPI_Allreduce assumes that all
MPI_Allreduce routines return a failure if any do - this is sufficient
for MPI implementations that reject some of the valid op/datatype pairs
(and motivated this addition, as some versions of the IBM MPI
failed in just this way).
*/
#define ALLREDUCE_AND_FREE(mpi_type, mpi_op, in, out, sol) \
{ \
int i, lerrcnt = 0; \
MPI_Allreduce(in, out, count, mpi_type, mpi_op, MPI_COMM_WORLD); \
for (i = 0; i < count; i++) { \
if (out[i] != sol[i]) { \
cerrcnt++; \
lerrcnt++; \
} \
int i, rc, lerrcnt = 0; \
rc = MPI_Allreduce(in, out, count, mpi_type, mpi_op, MPI_COMM_WORLD); \
if (rc) { lerrcnt++; cerrcnt++; MTestPrintError( rc ); } \
else { \
for (i = 0; i < count; i++) { \
if (out[i] != sol[i]) { \
cerrcnt++; \
lerrcnt++; \
} \
} \
} \
ERROR_CHECK_AND_FREE(lerrcnt, mpi_type, mpi_op); \
}
#define STRUCT_ALLREDUCE_AND_FREE(mpi_type, mpi_op, in, out, sol) \
{ \
int i, lerrcnt = 0; \
MPI_Allreduce(in, out, count, mpi_type, mpi_op, MPI_COMM_WORLD); \
for (i = 0; i < count; i++) { \
if ((out[i].a != sol[i].a) || (out[i].b != sol[i].b)) { \
cerrcnt++; \
lerrcnt++; \
} \
int i, rc, lerrcnt = 0; \
rc = MPI_Allreduce(in, out, count, mpi_type, mpi_op, MPI_COMM_WORLD); \
if (rc) { lerrcnt++; cerrcnt++; MTestPrintError( rc ); } \
else { \
for (i = 0; i < count; i++) { \
if ((out[i].a != sol[i].a) || (out[i].b != sol[i].b)) { \
cerrcnt++; \
lerrcnt++; \
} \
} \
} \
ERROR_CHECK_AND_FREE(lerrcnt, mpi_type, mpi_op); \
}
......@@ -322,6 +334,11 @@ int main( int argc, char **argv )
fprintf( stderr, "At least 2 processes required\n" );
MPI_Abort( MPI_COMM_WORLD, 1 );
}
/* Set errors return so that we can provide better information
should a routine reject one of the operand/datatype pairs */
MPI_Errhandler_set( MPI_COMM_WORLD, MPI_ERRORS_RETURN );
count = 10;
test_types_set2(sum, 1);
......@@ -378,6 +395,7 @@ int main( int argc, char **argv )
minloc_test(struct float_test, MPI_FLOAT_INT);
minloc_test(struct double_test, MPI_DOUBLE_INT);
MPI_Errhandler_set( MPI_COMM_WORLD, MPI_ERRORS_ARE_FATAL );
MTest_Finalize( cerrcnt );
MPI_Finalize();
return 0;
......
......@@ -19,6 +19,7 @@ static char MTEST_Descrip[] = "Test MPI_BAND operations on optional datatypes du
int main( int argc, char *argv[] )
{
int errs = 0;
int rc;
int rank, size;
MPI_Comm comm;
char cinbuf[3], coutbuf[3];
......@@ -34,6 +35,9 @@ int main( int argc, char *argv[] )
MTest_Init( &argc, &argv );
comm = MPI_COMM_WORLD;
/* Set errors return so that we can provide better information
should a routine reject one of the operand/datatype pairs */
MPI_Errhandler_set( comm, MPI_ERRORS_RETURN );
MPI_Comm_rank( comm, &rank );
MPI_Comm_size( comm, &size );
......@@ -48,19 +52,25 @@ int main( int argc, char *argv[] )
coutbuf[0] = 0;
coutbuf[1] = 1;
coutbuf[2] = 1;
MPI_Reduce( cinbuf, coutbuf, 3, MPI_CHAR, MPI_BAND, 0, comm );
if (rank == 0) {
if (coutbuf[0] != (char)0xff) {
errs++;
fprintf( stderr, "char BAND(1) test failed\n" );
}
if (coutbuf[1]) {
errs++;
fprintf( stderr, "char BAND(0) test failed\n" );
}
if (coutbuf[2] != (char)0xf0 && size > 1) {
errs++;
fprintf( stderr, "char BAND(>) test failed\n" );
rc = MPI_Reduce( cinbuf, coutbuf, 3, MPI_CHAR, MPI_BAND, 0, comm );
if (rc) {
MTestPrintErrorMsg( "MPI_BAND and MPI_CHAR", rc );
errs++;
}
else {
if (rank == 0) {
if (coutbuf[0] != (char)0xff) {
errs++;
fprintf( stderr, "char BAND(1) test failed\n" );
}
if (coutbuf[1]) {
errs++;
fprintf( stderr, "char BAND(0) test failed\n" );
}
if (coutbuf[2] != (char)0xf0 && size > 1) {
errs++;
fprintf( stderr, "char BAND(>) test failed\n" );
}
}
}
#endif /* USE_STRICT_MPI */
......@@ -74,19 +84,25 @@ int main( int argc, char *argv[] )
scoutbuf[0] = 0;
scoutbuf[1] = 1;
scoutbuf[2] = 1;
MPI_Reduce( scinbuf, scoutbuf, 3, MPI_SIGNED_CHAR, MPI_BAND, 0, comm );
if (rank == 0) {
if (scoutbuf[0] != (signed char)0xff) {
errs++;
fprintf( stderr, "signed char BAND(1) test failed\n" );
}
if (scoutbuf[1]) {
errs++;
fprintf( stderr, "signed char BAND(0) test failed\n" );
}
if (scoutbuf[2] != (signed char)0xf0 && size > 1) {
errs++;
fprintf( stderr, "signed char BAND(>) test failed\n" );
rc = MPI_Reduce( scinbuf, scoutbuf, 3, MPI_SIGNED_CHAR, MPI_BAND, 0, comm );
if (rc) {
MTestPrintErrorMsg( "MPI_BAND and MPI_SIGNED_CHAR", rc );
errs++;
}
else {
if (rank == 0) {
if (scoutbuf[0] != (signed char)0xff) {
errs++;
fprintf( stderr, "signed char BAND(1) test failed\n" );
}
if (scoutbuf[1]) {
errs++;
fprintf( stderr, "signed char BAND(0) test failed\n" );
}
if (scoutbuf[2] != (signed char)0xf0 && size > 1) {
errs++;
fprintf( stderr, "signed char BAND(>) test failed\n" );
}
}
}
......@@ -99,19 +115,25 @@ int main( int argc, char *argv[] )
ucoutbuf[0] = 0;
ucoutbuf[1] = 1;
ucoutbuf[2] = 1;
MPI_Reduce( ucinbuf, ucoutbuf, 3, MPI_UNSIGNED_CHAR, MPI_BAND, 0, comm );
if (rank == 0) {
if (ucoutbuf[0] != 0xff) {
errs++;
fprintf( stderr, "unsigned char BAND(1) test failed\n" );
}
if (ucoutbuf[1]) {
errs++;
fprintf( stderr, "unsigned char BAND(0) test failed\n" );
}
if (ucoutbuf[2] != 0xf0 && size > 1) {
errs++;
fprintf( stderr, "unsigned char BAND(>) test failed\n" );
rc = MPI_Reduce( ucinbuf, ucoutbuf, 3, MPI_UNSIGNED_CHAR, MPI_BAND, 0, comm );
if (rc) {
MTestPrintErrorMsg( "MPI_BAND and MPI_UNSIGNED_CHAR", rc );
errs++;
}
else {
if (rank == 0) {
if (ucoutbuf[0] != 0xff) {
errs++;
fprintf( stderr, "unsigned char BAND(1) test failed\n" );
}
if (ucoutbuf[1]) {
errs++;
fprintf( stderr, "unsigned char BAND(0) test failed\n" );
}
if (ucoutbuf[2] != 0xf0 && size > 1) {
errs++;
fprintf( stderr, "unsigned char BAND(>) test failed\n" );
}
}
}
......@@ -124,19 +146,25 @@ int main( int argc, char *argv[] )
coutbuf[0] = 0;
coutbuf[1] = 1;
coutbuf[2] = 1;
MPI_Reduce( cinbuf, coutbuf, 3, MPI_BYTE, MPI_BAND, 0, comm );
if (rank == 0) {
if (coutbuf[0] != (char)0xff) {
errs++;
fprintf( stderr, "byte BAND(1) test failed\n" );
}
if (coutbuf[1]) {
errs++;
fprintf( stderr, "byte BAND(0) test failed\n" );
}
if (coutbuf[2] != (char)0xf0 && size > 1) {
errs++;
fprintf( stderr, "byte BAND(>) test failed\n" );
rc = MPI_Reduce( cinbuf, coutbuf, 3, MPI_BYTE, MPI_BAND, 0, comm );
if (rc) {
MTestPrintErrorMsg( "MPI_BAND and MPI_BYTE", rc );
errs++;
}
else {
if (rank == 0) {
if (coutbuf[0] != (char)0xff) {
errs++;
fprintf( stderr, "byte BAND(1) test failed\n" );
}
if (coutbuf[1]) {
errs++;
fprintf( stderr, "byte BAND(0) test failed\n" );
}
if (coutbuf[2] != (char)0xf0 && size > 1) {
errs++;
fprintf( stderr, "byte BAND(>) test failed\n" );
}
}
}
......@@ -149,19 +177,25 @@ int main( int argc, char *argv[] )
soutbuf[0] = 0;
soutbuf[1] = 1;
soutbuf[2] = 1;
MPI_Reduce( sinbuf, soutbuf, 3, MPI_SHORT, MPI_BAND, 0, comm );
if (rank == 0) {
if (soutbuf[0] != (short)0xffff) {
errs++;
fprintf( stderr, "short BAND(1) test failed\n" );
}
if (soutbuf[1]) {
errs++;
fprintf( stderr, "short BAND(0) test failed\n" );
}
if (soutbuf[2] != (short)0xf0f0 && size > 1) {
errs++;
fprintf( stderr, "short BAND(>) test failed\n" );
rc = MPI_Reduce( sinbuf, soutbuf, 3, MPI_SHORT, MPI_BAND, 0, comm );
if (rc) {
MTestPrintErrorMsg( "MPI_BAND and MPI_SHORT", rc );
errs++;
}
else {
if (rank == 0) {
if (soutbuf[0] != (short)0xffff) {
errs++;
fprintf( stderr, "short BAND(1) test failed\n" );
}
if (soutbuf[1]) {
errs++;
fprintf( stderr, "short BAND(0) test failed\n" );
}
if (soutbuf[2] != (short)0xf0f0 && size > 1) {
errs++;
fprintf( stderr, "short BAND(>) test failed\n" );
}
}
}
......@@ -174,19 +208,25 @@ int main( int argc, char *argv[] )
usoutbuf[0] = 0;
usoutbuf[1] = 1;
usoutbuf[2] = 1;
MPI_Reduce( usinbuf, usoutbuf, 3, MPI_UNSIGNED_SHORT, MPI_BAND, 0, comm );
if (rank == 0) {
if (usoutbuf[0] != 0xffff) {
errs++;
fprintf( stderr, "short BAND(1) test failed\n" );
}
if (usoutbuf[1]) {
errs++;
fprintf( stderr, "short BAND(0) test failed\n" );
}
if (usoutbuf[2] != 0xf0f0 && size > 1) {
errs++;
fprintf( stderr, "short BAND(>) test failed\n" );
rc = MPI_Reduce( usinbuf, usoutbuf, 3, MPI_UNSIGNED_SHORT, MPI_BAND, 0, comm );
if (rc) {
MTestPrintErrorMsg( "MPI_BAND and MPI_UNSIGNED_SHORT", rc );
errs++;
}
else {
if (rank == 0) {
if (usoutbuf[0] != 0xffff) {
errs++;
fprintf( stderr, "short BAND(1) test failed\n" );
}
if (usoutbuf[1]) {
errs++;
fprintf( stderr, "short BAND(0) test failed\n" );
}
if (usoutbuf[2] != 0xf0f0 && size > 1) {
errs++;
fprintf( stderr, "short BAND(>) test failed\n" );
}
}
}
......@@ -199,19 +239,25 @@ int main( int argc, char *argv[] )
uoutbuf[0] = 0;
uoutbuf[1] = 1;
uoutbuf[2] = 1;
MPI_Reduce( uinbuf, uoutbuf, 3, MPI_UNSIGNED, MPI_BAND, 0, comm );
if (rank == 0) {
if (uoutbuf[0] != 0xffffffff) {
errs++;
fprintf( stderr, "unsigned BAND(1) test failed\n" );
}
if (uoutbuf[1]) {
errs++;
fprintf( stderr, "unsigned BAND(0) test failed\n" );
}
if (uoutbuf[2] != 0xf0f0f0f0 && size > 1) {
errs++;
fprintf( stderr, "unsigned BAND(>) test failed\n" );
rc = MPI_Reduce( uinbuf, uoutbuf, 3, MPI_UNSIGNED, MPI_BAND, 0, comm );
if (rc) {
MTestPrintErrorMsg( "MPI_BAND and MPI_UNSIGNED", rc );
errs++;
}
else {
if (rank == 0) {
if (uoutbuf[0] != 0xffffffff) {
errs++;
fprintf( stderr, "unsigned BAND(1) test failed\n" );
}
if (uoutbuf[1]) {
errs++;
fprintf( stderr, "unsigned BAND(0) test failed\n" );
}
if (uoutbuf[2] != 0xf0f0f0f0 && size > 1) {
errs++;
fprintf( stderr, "unsigned BAND(>) test failed\n" );
}
}
}
......@@ -224,19 +270,25 @@ int main( int argc, char *argv[] )
loutbuf[0] = 0;
loutbuf[1] = 1;
loutbuf[2] = 1;
MPI_Reduce( linbuf, loutbuf, 3, MPI_LONG, MPI_BAND, 0, comm );
if (rank == 0) {
if (loutbuf[0] != 0xffffffff) {
errs++;
fprintf( stderr, "long BAND(1) test failed\n" );
}
if (loutbuf[1]) {
errs++;
fprintf( stderr, "long BAND(0) test failed\n" );
}
if (loutbuf[2] != 0xf0f0f0f0 && size > 1) {
errs++;
fprintf( stderr, "long BAND(>) test failed\n" );
rc = MPI_Reduce( linbuf, loutbuf, 3, MPI_LONG, MPI_BAND, 0, comm );
if (rc) {
MTestPrintErrorMsg( "MPI_BAND and MPI_LONG", rc );
errs++;
}
else {
if (rank == 0) {
if (loutbuf[0] != 0xffffffff) {
errs++;
fprintf( stderr, "long BAND(1) test failed\n" );
}
if (loutbuf[1]) {
errs++;
fprintf( stderr, "long BAND(0) test failed\n" );
}
if (loutbuf[2] != 0xf0f0f0f0 && size > 1) {
errs++;
fprintf( stderr, "long BAND(>) test failed\n" );
}
}
}
......@@ -249,19 +301,25 @@ int main( int argc, char *argv[] )
uloutbuf[0] = 0;
uloutbuf[1] = 1;
uloutbuf[2] = 1;
MPI_Reduce( ulinbuf, uloutbuf, 3, MPI_UNSIGNED_LONG, MPI_BAND, 0, comm );
if (rank == 0) {
if (uloutbuf[0] != 0xffffffff) {
errs++;
fprintf( stderr, "unsigned long BAND(1) test failed\n" );
}
if (uloutbuf[1]) {
errs++;
fprintf( stderr, "unsigned long BAND(0) test failed\n" );
}
if (uloutbuf[2] != 0xf0f0f0f0 && size > 1) {
errs++;
fprintf( stderr, "unsigned long BAND(>) test failed\n" );
rc = MPI_Reduce( ulinbuf, uloutbuf, 3, MPI_UNSIGNED_LONG, MPI_BAND, 0, comm );
if (rc) {
MTestPrintErrorMsg( "MPI_BAND and MPI_UNSIGNED_LONG", rc );
errs++;
}
else {
if (rank == 0) {
if (uloutbuf[0] != 0xffffffff) {
errs++;
fprintf( stderr, "unsigned long BAND(1) test failed\n" );
}
if (uloutbuf[1]) {
errs++;
fprintf( stderr, "unsigned long BAND(0) test failed\n" );
}
if (uloutbuf[2] != 0xf0f0f0f0 && size > 1) {
errs++;
fprintf( stderr, "unsigned long BAND(>) test failed\n" );
}
}
}
......@@ -278,25 +336,32 @@ int main( int argc, char *argv[] )
lloutbuf[2] = 1;
if (MPI_LONG_LONG != MPI_DATATYPE_NULL) {
MTestPrintfMsg( 10, "Reduce of MPI_LONG_LONG\n" );
MPI_Reduce( llinbuf, lloutbuf, 3, MPI_LONG_LONG, MPI_BAND, 0, comm );
if (rank == 0) {
if (lloutbuf[0] != 0xffffffff) {
errs++;
fprintf( stderr, "long long BAND(1) test failed\n" );
}
if (lloutbuf[1]) {
errs++;
fprintf( stderr, "long long BAND(0) test failed\n" );
}
if (lloutbuf[2] != 0xf0f0f0f0 && size > 1) {
errs++;
fprintf( stderr, "long long BAND(>) test failed\n" );
rc = MPI_Reduce( llinbuf, lloutbuf, 3, MPI_LONG_LONG, MPI_BAND, 0, comm );
if (rc) {
MTestPrintErrorMsg( "MPI_BAND and MPI_LONG_LONG", rc );
errs++;
}
else {
if (rank == 0) {
if (lloutbuf[0] != 0xffffffff) {
errs++;
fprintf( stderr, "long long BAND(1) test failed\n" );
}
if (lloutbuf[1]) {
errs++;
fprintf( stderr, "long long BAND(0) test failed\n" );
}
if (lloutbuf[2] != 0xf0f0f0f0 && size > 1) {
errs++;
fprintf( stderr, "long long BAND(>) test failed\n" );
}
}
}
}
}
#endif
MPI_Errhandler_set( comm, MPI_ERRORS_ARE_FATAL );
MTest_Finalize( errs );
MPI_Finalize();
return 0;
......
......@@ -19,6 +19,7 @@ static char MTEST_Descrip[] = "Test MPI_BOR operations on optional datatypes dup
int main( int argc, char *argv[] )
{
int errs = 0;
int rc;
int rank, size;
MPI_Comm comm;
char cinbuf[3], coutbuf[3];
......@@ -35,6 +36,9 @@ int main( int argc, char *argv[] )
MTest_Init( &argc, &argv );
comm = MPI_COMM_WORLD;
/* Set errors return so that we can provide better information
should a routine reject one of the operand/datatype pairs */
MPI_Errhandler_set( comm, MPI_ERRORS_RETURN );
MPI_Comm_rank( comm, &rank );
MPI_Comm_size( comm, &size );
......@@ -49,19 +53,25 @@ int main( int argc, char *argv[] )
coutbuf[0] = 0;
coutbuf[1] = 1;
coutbuf[2] = 1;
MPI_Reduce( cinbuf, coutbuf, 3, MPI_CHAR, MPI_BOR, 0, comm );
if (rank == 0) {
if (coutbuf[0] != (char)0xff) {
errs++;
fprintf( stderr, "char BOR(1) test failed\n" );
}
if (coutbuf[1]) {
errs++;
fprintf( stderr, "char BOR(0) test failed\n" );
}
if (coutbuf[2] != (char)0xff && size > 1) {
errs++;
fprintf( stderr, "char BOR(>) test failed\n" );
rc = MPI_Reduce( cinbuf, coutbuf, 3, MPI_CHAR, MPI_BOR, 0, comm );
if (rc) {
MTestPrintErrorMsg( "MPI_BOR and MPI_CHAR", rc );
errs++;
}
else {
if (rank == 0) {
if (coutbuf[0] != (char)0xff) {
errs++;
fprintf( stderr, "char BOR(1) test failed\n" );
}
if (coutbuf[1]) {
errs++;
fprintf( stderr, "char BOR(0) test failed\n" );
}
if (coutbuf[2] != (char)0xff && size > 1) {
errs++;
fprintf( stderr, "char BOR(>) test failed\n" );
}
}
}
#endif /* USE_STRICT_MPI */
......@@ -75,19 +85,25 @@ int main( int argc, char *argv[] )
scoutbuf[0] = 0;
scoutbuf[1] = 1;
scoutbuf[2] = 1;
MPI_Reduce( scinbuf, scoutbuf, 3, MPI_SIGNED_CHAR, MPI_BOR, 0, comm );
if (rank == 0) {
if (scoutbuf[0] != (signed char)0xff) {
errs++;
fprintf( stderr, "signed char BOR(1) test failed\n" );
}
if (scoutbuf[1]) {
errs++;
fprintf( stderr, "signed char BOR(0) test failed\n" );
}
if (scoutbuf[2] != (signed char)0xff && size > 1) {
errs++;
fprintf( stderr, "signed char BOR(>) test failed\n" );
rc = MPI_Reduce( scinbuf, scoutbuf, 3, MPI_SIGNED_CHAR, MPI_BOR, 0, comm );
if (rc) {
MTestPrintErrorMsg( "MPI_BOR and MPI_SIGNED_CHAR", rc );
errs++;
}
else {
if (rank == 0) {
if (scoutbuf[0] != (signed char)0xff) {
errs++;
fprintf( stderr, "signed char BOR(1) test failed\n" );
}
if (scoutbuf[1]) {
errs++;
fprintf( stderr, "signed char BOR(0) test failed\n" );
}
if (scoutbuf[2] != (signed char)0xff && size > 1) {
errs++;
fprintf( stderr, "signed char BOR(>) test failed\n" );
}
}
}
......@@ -100,19 +116,25 @@ int main( int argc, char *argv[] )
ucoutbuf[0] = 0;
ucoutbuf[1] = 1;
ucoutbuf[2] = 1;
MPI_Reduce( ucinbuf, ucoutbuf, 3, MPI_UNSIGNED_CHAR, MPI_BOR, 0, comm );
if (rank == 0) {
if (ucoutbuf[0] != 0xff) {
errs++;
fprintf( stderr, "unsigned char BOR(1) test failed\n" );
}
if (ucoutbuf[1]) {
errs++;
fprintf( stderr, "unsigned char BOR(0) test failed\n" );
}
if (ucoutbuf[2] != 0xff && size > 1) {
errs++;
fprintf( stderr, "unsigned char BOR(>) test failed\n" );
rc = MPI_Reduce( ucinbuf, ucoutbuf, 3, MPI_UNSIGNED_CHAR, MPI_BOR, 0, comm );
if (rc) {
MTestPrintErrorMsg( "MPI_BOR and MPI_UNSIGNED_CHAR", rc );
errs++;
}
else {
if (rank == 0) {
if (ucoutbuf[0] != 0xff) {
errs++;
fprintf( stderr, "unsigned char BOR(1) test failed\n" );
}
if (ucoutbuf[1]) {
errs++;
fprintf( stderr, "unsigned char BOR(0) test failed\n" );
}