forked from openPMD/openPMD-api
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbug_1655_bp5_writer_hangup.cpp
More file actions
46 lines (34 loc) · 1.14 KB
/
bug_1655_bp5_writer_hangup.cpp
File metadata and controls
46 lines (34 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "ParallelIOTests.hpp"
#include <mpi.h>
#include <openPMD/openPMD.hpp>
namespace bug_1655_bp5_writer_hangup
{
auto worker(std::string const &ext) -> void
{
int mpi_size;
int mpi_rank;
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
auto const value = float(mpi_size * 100 + mpi_rank);
std::vector<float> local_data(10 * 300, value);
std::string filename = "../samples/ptl_%T." + ext;
Series series = Series(filename, Access::CREATE, MPI_COMM_WORLD);
Datatype datatype = determineDatatype<float>();
auto myptl = series.writeIterations()[1].particles["ion"];
Extent global_ptl = {10ul * mpi_size * 300};
Dataset dataset_ptl = Dataset(datatype, global_ptl, "{}");
myptl["charge"].resetDataset(dataset_ptl);
series.flush();
if (mpi_rank == 0) // only rank 0 adds data
myptl["charge"].storeChunk(local_data, {0}, {3000});
series.flush(); // hangs here
series.close();
}
auto bug_1655_bp5_writer_hangup() -> void
{
for (auto const &ext : testedFileExtensions())
{
worker(ext);
}
}
} // namespace bug_1655_bp5_writer_hangup