From 7d18220729378bc55a4b8ccc298d80e03263f3f0 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Thu, 12 Sep 2013 13:52:30 +0200 Subject: [PATCH] Fix warnings about unused variables in mpich3-test. --- teshsuite/smpi/mpich3-test/coll/iallred.c | 4 +++- teshsuite/smpi/mpich3-test/coll/ibarrier.c | 9 ++++++--- teshsuite/smpi/mpich3-test/coll/icbarrier.c | 4 ++-- teshsuite/smpi/mpich3-test/coll/nonblocking.c | 12 ++++++++--- .../smpi/mpich3-test/coll/nonblocking2.c | 4 +++- .../smpi/mpich3-test/coll/nonblocking3.c | 6 +++--- .../smpi/mpich3-test/coll/op_commutative.c | 2 ++ .../smpi/mpich3-test/coll/red_scat_block.c | 5 ++++- .../smpi/mpich3-test/coll/red_scat_block2.c | 7 +++++-- .../smpi/mpich3-test/coll/reduce_local.c | 2 ++ .../smpi/mpich3-test/datatype/darray-cyclic.c | 2 +- .../mpich3-test/datatype/hindexed_block.c | 7 ++++++- .../smpi/mpich3-test/datatype/large-count.c | 14 +++++++++++++ .../datatype/simple-pack-external.c | 20 +++++++++---------- .../smpi/mpich3-test/datatype/simple-pack.c | 12 +++++------ .../mpich3-test/datatype/transpose-pack.c | 6 +++--- .../smpi/mpich3-test/pt2pt/large_message.c | 12 +++++------ teshsuite/smpi/mpich3-test/pt2pt/mprobe.c | 6 +++--- teshsuite/smpi/mpich3-test/pt2pt/pscancel.c | 4 ++-- teshsuite/smpi/mpich3-test/pt2pt/scancel.c | 4 ++-- 20 files changed, 92 insertions(+), 50 deletions(-) diff --git a/teshsuite/smpi/mpich3-test/coll/iallred.c b/teshsuite/smpi/mpich3-test/coll/iallred.c index f06b492cea..564a47f5af 100644 --- a/teshsuite/smpi/mpich3-test/coll/iallred.c +++ b/teshsuite/smpi/mpich3-test/coll/iallred.c @@ -14,9 +14,11 @@ int main(int argc, char *argv[]) { - MPI_Request request; int size, rank; +#if defined(TEST_NBC_ROUTINES) + MPI_Request request; int one = 1, two = 2, isum, sum; +#endif MPI_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD, &size); MPI_Comm_rank(MPI_COMM_WORLD, &rank); diff --git a/teshsuite/smpi/mpich3-test/coll/ibarrier.c b/teshsuite/smpi/mpich3-test/coll/ibarrier.c index bf2508bb4a..44d6703aaf 100644 --- a/teshsuite/smpi/mpich3-test/coll/ibarrier.c +++ b/teshsuite/smpi/mpich3-test/coll/ibarrier.c @@ -17,19 +17,22 @@ int main(int argc, char *argv[]) { +#if defined(TEST_NBC_ROUTINES) MPI_Request barrier; - int rank,i,done; + int i,done; +#endif + int rank; MPI_Init(&argc,&argv); MPI_Comm_rank(MPI_COMM_WORLD,&rank); - #if defined(TEST_NBC_ROUTINES) +#if defined(TEST_NBC_ROUTINES) MPI_Ibarrier(MPI_COMM_WORLD,&barrier); for (i=0,done=0; !done; i++) { usleep(1000); /*printf("[%d] MPI_Test: %d\n",rank,i);*/ MPI_Test(&barrier,&done,MPI_STATUS_IGNORE); } - #endif +#endif if (rank == 0) printf(" No Errors\n"); diff --git a/teshsuite/smpi/mpich3-test/coll/icbarrier.c b/teshsuite/smpi/mpich3-test/coll/icbarrier.c index 94adbc4816..b2d022a104 100644 --- a/teshsuite/smpi/mpich3-test/coll/icbarrier.c +++ b/teshsuite/smpi/mpich3-test/coll/icbarrier.c @@ -22,11 +22,11 @@ int main( int argc, char *argv[] ) int errs = 0, err; int leftGroup; MPI_Comm comm; - MPI_Datatype datatype; + /* MPI_Datatype datatype; */ MTest_Init( &argc, &argv ); - datatype = MPI_INT; + /* datatype = MPI_INT; */ /* Get an intercommunicator */ while (MTestGetIntercomm( &comm, &leftGroup, 4 )) { if (comm == MPI_COMM_NULL) diff --git a/teshsuite/smpi/mpich3-test/coll/nonblocking.c b/teshsuite/smpi/mpich3-test/coll/nonblocking.c index f30d81328e..8f49a99ad7 100644 --- a/teshsuite/smpi/mpich3-test/coll/nonblocking.c +++ b/teshsuite/smpi/mpich3-test/coll/nonblocking.c @@ -16,6 +16,10 @@ /* USE_STRICT_MPI may be defined in mpitestconf.h */ #include "mpitestconf.h" +#if !defined(USE_STRICT_MPI) && defined(MPICH) +#define TEST_NBC_ROUTINES 1 +#endif + #define NUM_INTS (2) #define my_assert(cond_) \ @@ -29,7 +33,6 @@ int main(int argc, char **argv) { int errs = 0; - int i; int rank, size; int *sbuf = NULL; int *rbuf = NULL; @@ -37,9 +40,12 @@ int main(int argc, char **argv) int *rcounts = NULL; int *sdispls = NULL; int *rdispls = NULL; - int *types = NULL; MPI_Comm comm; +#if defined(TEST_NBC_ROUTINES) + int i; + int *types = NULL; MPI_Request req; +#endif /* intentionally not using MTest_Init/MTest_Finalize in order to make it * easy to take this test and use it as an NBC sanity test outside of the @@ -51,7 +57,7 @@ int main(int argc, char **argv) MPI_Comm_size(comm, &size); MPI_Comm_rank(comm, &rank); -#if !defined(USE_STRICT_MPI) && defined(MPICH) +#if defined(TEST_NBC_ROUTINES) /* enough space for every process to contribute at least NUM_INTS ints to any * collective operation */ sbuf = malloc(NUM_INTS*size*sizeof(int)); diff --git a/teshsuite/smpi/mpich3-test/coll/nonblocking2.c b/teshsuite/smpi/mpich3-test/coll/nonblocking2.c index a323596f2f..bc8a2c270a 100644 --- a/teshsuite/smpi/mpich3-test/coll/nonblocking2.c +++ b/teshsuite/smpi/mpich3-test/coll/nonblocking2.c @@ -50,7 +50,6 @@ static void sum_fn(void *invec, void *inoutvec, int *len, MPI_Datatype *datatype int main(int argc, char **argv) { - int i, j; int rank, size; int *buf = NULL; int *recvbuf = NULL; @@ -60,8 +59,11 @@ int main(int argc, char **argv) int *rdispls = NULL; int *sendtypes = NULL; int *recvtypes = NULL; +#if defined(TEST_NBC_ROUTINES) + int i, j; char *buf_alias = NULL; MPI_Request req; +#endif MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); diff --git a/teshsuite/smpi/mpich3-test/coll/nonblocking3.c b/teshsuite/smpi/mpich3-test/coll/nonblocking3.c index e072def468..2c0ab32ba6 100644 --- a/teshsuite/smpi/mpich3-test/coll/nonblocking3.c +++ b/teshsuite/smpi/mpich3-test/coll/nonblocking3.c @@ -749,18 +749,18 @@ static void complete_something_somehow(unsigned int rndnum, int numreqs, MPI_Req int main(int argc, char **argv) { - int i, num_posted, num_completed; int wrank, wsize; +#if defined(TEST_NBC_ROUTINES) + int i, num_posted, num_completed; unsigned int seed = 0x10bc; unsigned int post_seq, complete_seq; -#if defined(TEST_NBC_ROUTINES) struct laundry larr[WINDOW]; -#endif MPI_Request reqs[WINDOW]; int outcount; int indices[WINDOW]; MPI_Comm comms[NUM_COMMS]; MPI_Comm comm; +#endif MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &wrank); diff --git a/teshsuite/smpi/mpich3-test/coll/op_commutative.c b/teshsuite/smpi/mpich3-test/coll/op_commutative.c index cc2b80a872..28043eff09 100644 --- a/teshsuite/smpi/mpich3-test/coll/op_commutative.c +++ b/teshsuite/smpi/mpich3-test/coll/op_commutative.c @@ -51,7 +51,9 @@ int main( int argc, char *argv[] ) { MPI_Op c_uop = MPI_OP_NULL; MPI_Op nc_uop = MPI_OP_NULL; +#if MTEST_HAVE_MIN_MPI_VERSION(2,2) int is_commutative = 0; +#endif MTest_Init(&argc, &argv); diff --git a/teshsuite/smpi/mpich3-test/coll/red_scat_block.c b/teshsuite/smpi/mpich3-test/coll/red_scat_block.c index 3092c8d5a2..7891cb6efc 100644 --- a/teshsuite/smpi/mpich3-test/coll/red_scat_block.c +++ b/teshsuite/smpi/mpich3-test/coll/red_scat_block.c @@ -20,9 +20,12 @@ int main(int argc, char **argv) { int err = 0; - int toterr, size, rank, i, sumval; + int toterr, size, rank; +#if MTEST_HAVE_MIN_MPI_VERSION(2,2) + int i, sumval; int *sendbuf; int *recvbuf; +#endif MPI_Comm comm; MPI_Init(&argc, &argv); diff --git a/teshsuite/smpi/mpich3-test/coll/red_scat_block2.c b/teshsuite/smpi/mpich3-test/coll/red_scat_block2.c index 5346905af9..e98273bdaf 100644 --- a/teshsuite/smpi/mpich3-test/coll/red_scat_block2.c +++ b/teshsuite/smpi/mpich3-test/coll/red_scat_block2.c @@ -70,12 +70,15 @@ void nc_sum(void *a, void *b, int *count, MPI_Datatype *type) int main( int argc, char **argv ) { +#if MTEST_HAVE_MIN_MPI_VERSION(2,2) int *sendbuf; int block_size; int *recvbuf; - int size, rank, i; - MPI_Comm comm; + int i; MPI_Op left_op, right_op, nc_sum_op; +#endif + int size, rank; + MPI_Comm comm; MTest_Init( &argc, &argv ); comm = MPI_COMM_WORLD; diff --git a/teshsuite/smpi/mpich3-test/coll/reduce_local.c b/teshsuite/smpi/mpich3-test/coll/reduce_local.c index 9bf68203ac..6521bb764a 100644 --- a/teshsuite/smpi/mpich3-test/coll/reduce_local.c +++ b/teshsuite/smpi/mpich3-test/coll/reduce_local.c @@ -40,11 +40,13 @@ static void user_op(void *invec, void *inoutvec, int *len, MPI_Datatype *datatyp int main( int argc, char *argv[] ) { int errs = 0; +#if MTEST_HAVE_MIN_MPI_VERSION(2,2) int i; int *inbuf = NULL; int *inoutbuf = NULL; int count = -1; MPI_Op uop = MPI_OP_NULL; +#endif MTest_Init(&argc, &argv); #if MTEST_HAVE_MIN_MPI_VERSION(2,2) diff --git a/teshsuite/smpi/mpich3-test/datatype/darray-cyclic.c b/teshsuite/smpi/mpich3-test/datatype/darray-cyclic.c index 947ec3204e..90eea4aec6 100644 --- a/teshsuite/smpi/mpich3-test/datatype/darray-cyclic.c +++ b/teshsuite/smpi/mpich3-test/datatype/darray-cyclic.c @@ -207,7 +207,7 @@ int main( int argc, char *argv[] ) int AllocateGrid( int nx, int ny, int **srcArray, int **destArray ) { int *src, *dest; - int i, j; + int i; src = (int *)malloc( nx*ny*sizeof(int) ); dest = (int *)malloc( nx*ny*sizeof(int) ); if (!src || !dest) { diff --git a/teshsuite/smpi/mpich3-test/datatype/hindexed_block.c b/teshsuite/smpi/mpich3-test/datatype/hindexed_block.c index da3fccdfbf..23f8f62153 100644 --- a/teshsuite/smpi/mpich3-test/datatype/hindexed_block.c +++ b/teshsuite/smpi/mpich3-test/datatype/hindexed_block.c @@ -15,7 +15,9 @@ #define TEST_HINDEXED_BLOCK 1 #endif +#if defined(TEST_HINDEXED_BLOCK) static int verbose = 0; +#endif /* tests */ int hindexed_block_contig_test(void); @@ -27,7 +29,10 @@ static int pack_and_unpack(char *typebuf, int count, MPI_Datatype datatype, int int main(int argc, char **argv) { - int err, errs = 0; +#if defined(TEST_HINDEXED_BLOCK) + int err; +#endif + int errs = 0; int rank; MPI_Init(&argc, &argv); /* MPI-1.2 doesn't allow for MPI_Init(0,0) */ diff --git a/teshsuite/smpi/mpich3-test/datatype/large-count.c b/teshsuite/smpi/mpich3-test/datatype/large-count.c index a272f4fdc1..31f6a2d419 100644 --- a/teshsuite/smpi/mpich3-test/datatype/large-count.c +++ b/teshsuite/smpi/mpich3-test/datatype/large-count.c @@ -24,6 +24,20 @@ } \ } while (0) +/* Abort when using unimplemented functions. Currently, it should not happen, + * since sizeof(MPI_Count) == sizeof(int), but it avoids compile errors about + * undefined functions. */ +#define err_unimpl(func) do { \ + fprintf(stderr, "ERROR: %s is not implemented\n", #func); \ + abort(); \ + } while (0) + +#define MPI_Type_size_x(a,b) err_unimpl(MPI_Type_size_x) +#define MPI_Type_get_extent_x(a,b,c) err_unimpl(MPI_Type_get_extent_x) +#define MPI_Type_get_true_extent_x(a,b,c) err_unimpl(MPI_Type_get_true_extent_x) +#define MPI_Get_elements_x(a,b,c) err_unimpl(MPI_Get_elements_x) +#define MPI_Status_set_elements_x(a,b,c) err_unimpl(MPI_Status_set_elements_x) + int main(int argc, char *argv[]) { int errs = 0; diff --git a/teshsuite/smpi/mpich3-test/datatype/simple-pack-external.c b/teshsuite/smpi/mpich3-test/datatype/simple-pack-external.c index 43f421c7ab..6465944ffd 100644 --- a/teshsuite/smpi/mpich3-test/datatype/simple-pack-external.c +++ b/teshsuite/smpi/mpich3-test/datatype/simple-pack-external.c @@ -68,9 +68,9 @@ int builtin_float_test(void) { int nints, nadds, ntypes, combiner; - int err, errs = 0; + int /* err, */ errs = 0; - err = MPI_Type_get_envelope(MPI_FLOAT, + /* err = */ MPI_Type_get_envelope(MPI_FLOAT, &nints, &nadds, &ntypes, @@ -219,7 +219,7 @@ int optimizable_vector_of_basics_test(void) int i; MPI_Aint sizeofint, sizeoftype, position; - int err, errs = 0; + int /* err, */ errs = 0; MPI_Pack_external_size((char*)"external32", 1, MPI_INT, &sizeofint); @@ -231,7 +231,7 @@ int optimizable_vector_of_basics_test(void) } /* set up type */ - err = MPI_Type_vector(10, + /* err = */ MPI_Type_vector(10, 2, 2, MPI_INT, @@ -251,7 +251,7 @@ int optimizable_vector_of_basics_test(void) buf = (char *) malloc(sizeoftype); position = 0; - err = MPI_Pack_external((char*)"external32", + /* err = */ MPI_Pack_external((char*)"external32", array, 1, parent_type, @@ -267,7 +267,7 @@ int optimizable_vector_of_basics_test(void) memset(array, 0, 20 * sizeof(int)); position = 0; - err = MPI_Unpack_external((char*)"external32", + /* err = */ MPI_Unpack_external((char*)"external32", buf, sizeoftype, &position, @@ -313,7 +313,7 @@ int struct_of_basics_test(void) MPI_Aint indices[10]; MPI_Datatype types[10]; - int err, errs = 0; + int /* err, */ errs = 0; MPI_Pack_external_size((char*)"external32", 1, MPI_INT, &sizeofint); @@ -333,7 +333,7 @@ int struct_of_basics_test(void) } /* set up type */ - err = MPI_Type_struct(10, + /* err = */ MPI_Type_struct(10, blocks, indices, types, @@ -352,7 +352,7 @@ int struct_of_basics_test(void) buf = (char *) malloc(sizeoftype); position = 0; - err = MPI_Pack_external((char*)"external32", + /* err = */ MPI_Pack_external((char*)"external32", array, 1, parent_type, @@ -368,7 +368,7 @@ int struct_of_basics_test(void) memset(array, 0, 20 * sizeof(int)); position = 0; - err = MPI_Unpack_external((char*)"external32", + /* err = */ MPI_Unpack_external((char*)"external32", buf, sizeoftype, &position, diff --git a/teshsuite/smpi/mpich3-test/datatype/simple-pack.c b/teshsuite/smpi/mpich3-test/datatype/simple-pack.c index d2119cdfb4..6e7b244ca0 100644 --- a/teshsuite/smpi/mpich3-test/datatype/simple-pack.c +++ b/teshsuite/smpi/mpich3-test/datatype/simple-pack.c @@ -69,9 +69,9 @@ int builtin_float_test(void) { int nints, nadds, ntypes, combiner; - int err, errs = 0; + int /* err, */ errs = 0; - err = MPI_Type_get_envelope(MPI_FLOAT, + /* err = */ MPI_Type_get_envelope(MPI_FLOAT, &nints, &nadds, &ntypes, @@ -217,7 +217,7 @@ int optimizable_vector_of_basics_test(void) char *buf; int i, sizeofint, sizeoftype, position; - int err, errs = 0; + int /* err, */ errs = 0; MPI_Type_size(MPI_INT, &sizeofint); @@ -228,7 +228,7 @@ int optimizable_vector_of_basics_test(void) } /* set up type */ - err = MPI_Type_vector(10, + /* err = */ MPI_Type_vector(10, 2, 2, MPI_INT, @@ -247,7 +247,7 @@ int optimizable_vector_of_basics_test(void) buf = (char *) malloc(sizeoftype); position = 0; - err = MPI_Pack(array, + /* err = */ MPI_Pack(array, 1, parent_type, buf, @@ -263,7 +263,7 @@ int optimizable_vector_of_basics_test(void) memset(array, 0, 20 * sizeof(int)); position = 0; - err = MPI_Unpack(buf, + /* err = */ MPI_Unpack(buf, sizeoftype, &position, array, diff --git a/teshsuite/smpi/mpich3-test/datatype/transpose-pack.c b/teshsuite/smpi/mpich3-test/datatype/transpose-pack.c index 5bd6a7244e..1cd22028d5 100644 --- a/teshsuite/smpi/mpich3-test/datatype/transpose-pack.c +++ b/teshsuite/smpi/mpich3-test/datatype/transpose-pack.c @@ -25,7 +25,7 @@ int main(int argc, char *argv[]) MPI_Datatype row, xpose; MPI_Aint sizeofint; - int err, errs = 0; + int /* err, */ errs = 0; int bufsize, position = 0; void *buffer; @@ -58,7 +58,7 @@ int main(int argc, char *argv[]) change the error handler to errors return */ MPI_Comm_set_errhandler( MPI_COMM_WORLD, MPI_ERRORS_RETURN ); - err = MPI_Pack(a, + /* err = */ MPI_Pack(a, 1, xpose, buffer, @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) /* Unpack the buffer into b. */ position = 0; - err = MPI_Unpack(buffer, + /* err = */ MPI_Unpack(buffer, bufsize, &position, b, diff --git a/teshsuite/smpi/mpich3-test/pt2pt/large_message.c b/teshsuite/smpi/mpich3-test/pt2pt/large_message.c index db3d2755cb..b8a6d0924c 100644 --- a/teshsuite/smpi/mpich3-test/pt2pt/large_message.c +++ b/teshsuite/smpi/mpich3-test/pt2pt/large_message.c @@ -13,7 +13,7 @@ int main(int argc, char *argv[]) { - int ierr,i,size,rank; + int /* ierr, */ i,size,rank; int cnt = 270000000; MPI_Status status; long long *cols; @@ -29,8 +29,8 @@ int main(int argc, char *argv[]) return 0; } - ierr = MPI_Comm_size(MPI_COMM_WORLD,&size); - ierr = MPI_Comm_rank(MPI_COMM_WORLD,&rank); + /* ierr = */ MPI_Comm_size(MPI_COMM_WORLD,&size); + /* ierr = */ MPI_Comm_rank(MPI_COMM_WORLD,&rank); if (size != 3) { fprintf(stderr,"[%d] usage: mpiexec -n 3 %s\n",rank,argv[0]); MPI_Abort(MPI_COMM_WORLD,1); @@ -48,12 +48,12 @@ int main(int argc, char *argv[]) if (rank == 0) { for (i=0; i