From 351fd4dfb93c8533ba0ce0b05bffcc54b1cf2167 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Fri, 29 Jan 2021 09:08:54 +0000 Subject: [PATCH 1/2] Move initialization of TestComm before aiori->initialize() --- src/ior.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/ior.c b/src/ior.c index 4f28c19..79f48d6 100755 --- a/src/ior.c +++ b/src/ior.c @@ -81,8 +81,28 @@ static void ior_set_xfer_hints(IOR_param_t * p){ int aiori_warning_as_errors = 0; static void test_initialize(IOR_test_t * test){ + int range[3]; + IOR_param_t *params = &test->params; + MPI_Group orig_group, new_group; + + /* set up communicator for test */ + MPI_CHECK(MPI_Comm_group(params->mpi_comm_world, &orig_group), + "MPI_Comm_group() error"); + range[0] = 0; /* first rank */ + range[1] = params->numTasks - 1; /* last rank */ + range[2] = 1; /* stride */ + MPI_CHECK(MPI_Group_range_incl(orig_group, 1, &range, &new_group), + "MPI_Group_range_incl() error"); + MPI_CHECK(MPI_Comm_create(params->mpi_comm_world, new_group, & params->testComm), + "MPI_Comm_create() error"); + MPI_CHECK(MPI_Group_free(&orig_group), "MPI_Group_Free() error"); + MPI_CHECK(MPI_Group_free(&new_group), "MPI_Group_Free() error"); + + /* Setup global variables */ + testComm = params->testComm; verbose = test->params.verbose; backend = test->params.backend; + if(backend->initialize){ backend->initialize(test->params.backend_options); } @@ -1221,26 +1241,11 @@ static void TestIoSys(IOR_test_t *test) int pretendRank; int rep; aiori_fd_t *fd; - MPI_Group orig_group, new_group; - int range[3]; IOR_offset_t dataMoved; /* for data rate calculation */ void *hog_buf; IOR_io_buffers ioBuffers; - /* set up communicator for test */ - MPI_CHECK(MPI_Comm_group(params->mpi_comm_world, &orig_group), - "MPI_Comm_group() error"); - range[0] = 0; /* first rank */ - range[1] = params->numTasks - 1; /* last rank */ - range[2] = 1; /* stride */ - MPI_CHECK(MPI_Group_range_incl(orig_group, 1, &range, &new_group), - "MPI_Group_range_incl() error"); - MPI_CHECK(MPI_Comm_create(params->mpi_comm_world, new_group, &testComm), - "MPI_Comm_create() error"); - MPI_CHECK(MPI_Group_free(&orig_group), "MPI_Group_Free() error"); - MPI_CHECK(MPI_Group_free(&new_group), "MPI_Group_Free() error"); - params->testComm = testComm; - if (testComm == MPI_COMM_NULL) { + 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; From 7b69fc1500ff45a6b80212358238b50d628a2366 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Fri, 29 Jan 2021 14:00:17 +0000 Subject: [PATCH 2/2] 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"); } /*