From 7b69fc1500ff45a6b80212358238b50d628a2366 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Fri, 29 Jan 2021 14:00:17 +0000 Subject: [PATCH] Free testcom after finalize. --- src/ior.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/ior.c b/src/ior.c index 79f48d6..7b46298 100755 --- a/src/ior.c +++ b/src/ior.c @@ -80,7 +80,10 @@ static void ior_set_xfer_hints(IOR_param_t * p){ int aiori_warning_as_errors = 0; -static void test_initialize(IOR_test_t * test){ +/* + Returns 1 if the process participates in the test + */ +static int test_initialize(IOR_test_t * test){ int range[3]; IOR_param_t *params = &test->params; MPI_Group orig_group, new_group; @@ -98,6 +101,13 @@ static void test_initialize(IOR_test_t * test){ MPI_CHECK(MPI_Group_free(&orig_group), "MPI_Group_Free() error"); MPI_CHECK(MPI_Group_free(&new_group), "MPI_Group_Free() error"); + + if (params->testComm == MPI_COMM_NULL) { + /* tasks not in the group do not participate in this test */ + MPI_CHECK(MPI_Barrier(params->mpi_comm_world), "barrier error"); + return 0; + } + /* Setup global variables */ testComm = params->testComm; verbose = test->params.verbose; @@ -112,6 +122,7 @@ static void test_initialize(IOR_test_t * test){ if (rank == 0 && verbose >= VERBOSE_0) { ShowTestStart(& test->params); } + return 1; } static void test_finalize(IOR_test_t * test){ @@ -119,6 +130,7 @@ static void test_finalize(IOR_test_t * test){ if(backend->finalize){ backend->finalize(test->params.backend_options); } + MPI_CHECK(MPI_Comm_free(& testComm), "MPI_Comm_free() error"); } @@ -138,7 +150,8 @@ IOR_test_t * ior_run(int argc, char **argv, MPI_Comm world_com, FILE * world_out /* perform each test */ for (tptr = tests_head; tptr != NULL; tptr = tptr->next) { - test_initialize(tptr); + int participate = test_initialize(tptr); + if( ! participate ) continue; totalErrorCount = 0; TestIoSys(tptr); tptr->results->errors = totalErrorCount; @@ -184,7 +197,8 @@ int ior_main(int argc, char **argv) /* perform each test */ for (tptr = tests_head; tptr != NULL; tptr = tptr->next) { - test_initialize(tptr); + int participate = test_initialize(tptr); + if( ! participate ) continue; // This is useful for trapping a running MPI process. While // this is sleeping, run the script 'testing/hdfs/gdb.attach' @@ -1245,11 +1259,6 @@ static void TestIoSys(IOR_test_t *test) void *hog_buf; IOR_io_buffers ioBuffers; - if (params->testComm == MPI_COMM_NULL) { - /* tasks not in the group do not participate in this test */ - MPI_CHECK(MPI_Barrier(params->mpi_comm_world), "barrier error"); - return; - } if (rank == 0 && verbose >= VERBOSE_1) { fprintf(out_logfile, "Participating tasks : %d\n", params->numTasks); fflush(out_logfile); @@ -1529,8 +1538,6 @@ static void TestIoSys(IOR_test_t *test) } PrintRepeatEnd(); - MPI_CHECK(MPI_Comm_free(&testComm), "MPI_Comm_free() error"); - if (params->summary_every_test) { PrintLongSummaryHeader(); PrintLongSummaryOneTest(test); @@ -1542,9 +1549,6 @@ static void TestIoSys(IOR_test_t *test) if (hog_buf != NULL) free(hog_buf); - - /* Sync with the tasks that did not participate in this test */ - MPI_CHECK(MPI_Barrier(params->mpi_comm_world), "barrier error"); } /*