Skip to content

Commit

Permalink
mover barrier into write_mesh -- to avoid fs races out of the box
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrush committed Sep 16, 2020
1 parent 043da54 commit 03a8956
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 9 additions & 0 deletions src/libs/relay/conduit_relay_io_blueprint.cpp
Expand Up @@ -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
}

//-----------------------------------------------------------------------------
Expand Down
8 changes: 0 additions & 8 deletions src/tests/blueprint/t_blueprint_mpi_mesh_relay.cpp
Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 03a8956

Please sign in to comment.