From 5ca17dc381bb7fba4f2689143e2080f7549ee0ab Mon Sep 17 00:00:00 2001 From: degomme Date: Mon, 20 Mar 2017 19:08:45 +0100 Subject: [PATCH] change some tests to avoid useless global variables --- .../smpi/mpich3-test/rma/contention_put.c | 21 ++++++++++--------- .../smpi/mpich3-test/rma/contention_putget.c | 6 +++++- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/teshsuite/smpi/mpich3-test/rma/contention_put.c b/teshsuite/smpi/mpich3-test/rma/contention_put.c index b549c9b315..28b99524a7 100644 --- a/teshsuite/smpi/mpich3-test/rma/contention_put.c +++ b/teshsuite/smpi/mpich3-test/rma/contention_put.c @@ -19,13 +19,23 @@ #define MAXELEMS 6400 #define COUNT 1000 -static int me, nproc; static const int verbose = 0; int test_put(void); int test_put(void) { + int me, nproc; + MPI_Comm_size(MPI_COMM_WORLD, &nproc); + MPI_Comm_rank(MPI_COMM_WORLD, &me); + + assert(COUNT <= MAXELEMS); + + if (me == 0 && verbose) { + printf("Test starting on %d processes\n", nproc); + fflush(stdout); + } + MPI_Win dst_win; double *dst_buf; double src_buf[MAXELEMS]; @@ -87,15 +97,6 @@ int main(int argc, char *argv[]) int errs = 0; MTest_Init(&argc, &argv); - MPI_Comm_size(MPI_COMM_WORLD, &nproc); - MPI_Comm_rank(MPI_COMM_WORLD, &me); - - assert(COUNT <= MAXELEMS); - - if (me == 0 && verbose) { - printf("Test starting on %d processes\n", nproc); - fflush(stdout); - } errs = test_put(); diff --git a/teshsuite/smpi/mpich3-test/rma/contention_putget.c b/teshsuite/smpi/mpich3-test/rma/contention_putget.c index 312cf31ee5..abfdb2bbe5 100644 --- a/teshsuite/smpi/mpich3-test/rma/contention_putget.c +++ b/teshsuite/smpi/mpich3-test/rma/contention_putget.c @@ -18,12 +18,15 @@ #define MAXELEMS 6400 #define COUNT 1000 -static int me, nproc; + static const int verbose = 0; void test_put(void); void test_put(void) { + int me, nproc; + MPI_Comm_size(MPI_COMM_WORLD, &nproc); + MPI_Comm_rank(MPI_COMM_WORLD, &me); MPI_Win dst_win; double *dst_buf; double src_buf[MAXELEMS]; @@ -77,6 +80,7 @@ void test_put(void) int main(int argc, char *argv[]) { MPI_Init(&argc, &argv); + int me, nproc; MPI_Comm_size(MPI_COMM_WORLD, &nproc); MPI_Comm_rank(MPI_COMM_WORLD, &me); -- 2.20.1