Skip to content

Commit 6a32ffc

Browse files
committed
Backport test
1 parent c6ed621 commit 6a32ffc

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

test/ParallelIOTest.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2202,3 +2202,44 @@ TEST_CASE("adios2_flush_via_step")
22022202
#endif
22032203

22042204
#endif // openPMD_HAVE_ADIOS2 && openPMD_HAVE_MPI
2205+
2206+
auto bug_1655_bp5_writer_hangup(std::string const &ext) -> void
2207+
{
2208+
int mpi_size;
2209+
int mpi_rank;
2210+
2211+
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
2212+
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
2213+
2214+
auto const value = float(mpi_size * 100 + mpi_rank);
2215+
std::vector<float> local_data(10 * 300, value);
2216+
2217+
std::string filename = "../samples/ptl_%T." + ext;
2218+
2219+
Series series = Series(filename, Access::CREATE, MPI_COMM_WORLD);
2220+
2221+
Datatype datatype = determineDatatype<float>();
2222+
2223+
auto myptl = series.writeIterations()[1].particles["ion"];
2224+
Extent global_ptl = {10ul * mpi_size * 300};
2225+
Dataset dataset_ptl = Dataset(datatype, global_ptl, "{}");
2226+
myptl["charge"].resetDataset(dataset_ptl);
2227+
2228+
series.flush();
2229+
2230+
if (mpi_rank == 0) // only rank 0 adds data
2231+
myptl["charge"].storeChunk(local_data, {0}, {3000});
2232+
2233+
series.flush(); // hangs here
2234+
series.close();
2235+
}
2236+
2237+
#if openPMD_HAVE_MPI
2238+
TEST_CASE("bug_1655_bp5_writer_hangup", "[parallel]")
2239+
{
2240+
for (auto const &ext : testedFileExtensions())
2241+
{
2242+
bug_1655_bp5_writer_hangup(ext);
2243+
}
2244+
}
2245+
#endif

0 commit comments

Comments
 (0)