Skip to content

Commit 15cb968

Browse files
committed
Add failing test from bug report
1 parent ff52a8d commit 15cb968

File tree

4 files changed

+59
-0
lines changed

4 files changed

+59
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,7 @@ if(openPMD_BUILD_TESTING)
791791
list(APPEND ${out_list}
792792
test/Files_ParallelIO/read_variablebased_randomaccess.cpp
793793
test/Files_ParallelIO/iterate_nonstreaming_series.cpp
794+
test/Files_ParallelIO/bug_1655_bp5_writer_hangup.cpp
794795
)
795796
elseif(${test_name} STREQUAL "Core")
796797
list(APPEND ${out_list}

test/Files_ParallelIO/ParallelIOTests.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,9 @@ namespace iterate_nonstreaming_series
7575
auto iterate_nonstreaming_series() -> void;
7676
}
7777

78+
namespace bug_1655_bp5_writer_hangup
79+
{
80+
auto bug_1655_bp5_writer_hangup() -> void;
81+
}
82+
7883
#endif
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#include "ParallelIOTests.hpp"
2+
3+
#include <mpi.h>
4+
#include <openPMD/openPMD.hpp>
5+
6+
namespace bug_1655_bp5_writer_hangup
7+
{
8+
auto worker(std::string const &ext) -> void
9+
{
10+
int mpi_size;
11+
int mpi_rank;
12+
13+
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
14+
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
15+
16+
auto const value = float(mpi_size * 100 + mpi_rank);
17+
std::vector<float> local_data(10 * 300, value);
18+
19+
std::string filename = "../samples/ptl_%T." + ext;
20+
21+
Series series = Series(filename, Access::CREATE, MPI_COMM_WORLD);
22+
23+
Datatype datatype = determineDatatype<float>();
24+
25+
auto myptl = series.writeIterations()[1].particles["ion"];
26+
Extent global_ptl = {10ul * mpi_size * 300};
27+
Dataset dataset_ptl = Dataset(datatype, global_ptl, "{}");
28+
myptl["charge"].resetDataset(dataset_ptl);
29+
30+
series.flush();
31+
32+
if (mpi_rank == 0) // only rank 0 adds data
33+
myptl["charge"].storeChunk(local_data, {0}, {3000});
34+
35+
series.flush(); // hangs here
36+
series.close();
37+
}
38+
39+
auto bug_1655_bp5_writer_hangup() -> void
40+
{
41+
for (auto const &ext : testedFileExtensions())
42+
{
43+
worker(ext);
44+
}
45+
}
46+
} // namespace bug_1655_bp5_writer_hangup

test/ParallelIOTest.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,3 +2183,10 @@ TEST_CASE("iterate_nonstreaming_series", "[serial][adios2]")
21832183
}
21842184

21852185
#endif // openPMD_HAVE_ADIOS2 && openPMD_HAVE_MPI
2186+
2187+
#if openPMD_HAVE_MPI
2188+
TEST_CASE("bug_1655_bp5_writer_hangup", "[parallel]")
2189+
{
2190+
bug_1655_bp5_writer_hangup::bug_1655_bp5_writer_hangup();
2191+
}
2192+
#endif

0 commit comments

Comments
 (0)