diff --git a/src/libs/relay/conduit_relay_io_blueprint.cpp b/src/libs/relay/conduit_relay_io_blueprint.cpp index d9f89bbaa..13311fec3 100644 --- a/src/libs/relay/conduit_relay_io_blueprint.cpp +++ b/src/libs/relay/conduit_relay_io_blueprint.cpp @@ -1223,6 +1223,15 @@ void write_mesh(const Node &mesh, hnd.write(root); hnd.close(); } + + // barrier at end of work to avoid file system race + // (non root task could write the root file in write_mesh, + // but root task is always the one to read the root file + // in read_mesh. + + #ifdef CONDUIT_RELAY_IO_MPI_ENABLED + MPI_Barrier(mpi_comm); + #endif } //----------------------------------------------------------------------------- diff --git a/src/tests/blueprint/t_blueprint_mpi_mesh_relay.cpp b/src/tests/blueprint/t_blueprint_mpi_mesh_relay.cpp index 0f88de1aa..d20734971 100644 --- a/src/tests/blueprint/t_blueprint_mpi_mesh_relay.cpp +++ b/src/tests/blueprint/t_blueprint_mpi_mesh_relay.cpp @@ -117,7 +117,6 @@ TEST(blueprint_mpi_relay, basic_use) output_base, "hdf5", comm); - MPI_Barrier(MPI_COMM_WORLD); // read this back using read_mesh, should diff clean string output_root = output_base + ".cycle_000000.root"; @@ -168,7 +167,6 @@ TEST(blueprint_mpi_relay, mpi_mesh_examples_braid) output_base, "hdf5", comm); - MPI_Barrier(comm); // read this back using read_mesh, should diff clean string output_root = output_base + ".cycle_000000.root"; @@ -243,7 +241,6 @@ TEST(blueprint_mpi_relay, mpi_mesh_examples_spiral_5doms) output_base, "hdf5", comm); - MPI_Barrier(comm); // read this back using read_mesh, should diff clean string output_root = output_base + ".cycle_000000.root"; @@ -336,7 +333,6 @@ TEST(blueprint_mpi_relay, mpi_mesh_examples_spiral_1dom) "hdf5", opts, comm); - MPI_Barrier(comm); // read this back using read_mesh, should diff clean string output_root = output_base + ".cycle_000000.root"; @@ -467,8 +463,6 @@ TEST(blueprint_mpi_relay, spiral_multi_file) opts, comm); - MPI_Barrier(comm); - // count the files // file_%06llu.{protocol}:/domain_%06llu/... int nfiles_to_check = nfiles; @@ -500,8 +494,6 @@ TEST(blueprint_mpi_relay, spiral_multi_file) std::cout << " checking: " << fcheck << std::endl; EXPECT_TRUE(conduit::utils::is_file(fcheck)); } - - MPI_Barrier(comm); } // read this back using read_mesh