Skip to content

Commit

Permalink
WIP: Implement attribute_writing_ranks in HDF5
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Dec 22, 2023
1 parent 80e20fd commit 5086434
Show file tree
Hide file tree
Showing 2 changed files with 254 additions and 211 deletions.
19 changes: 18 additions & 1 deletion examples/5_write_parallel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@
*/
#include <openPMD/openPMD.hpp>

#include <openPMD/auxiliary/Environment.hpp>

#include <mpi.h>

#include <iostream>
#include <memory>
#include <sstream>
#include <vector> // std::vector

using std::cout;
Expand All @@ -49,7 +52,21 @@ int main(int argc, char *argv[])

// open file for writing
Series series = Series(
"../samples/5_parallel_write.h5", Access::CREATE, MPI_COMM_WORLD);
"../samples/5_parallel_write.h5",
Access::CREATE,
MPI_COMM_WORLD
#if 1
,
[]() {
std::stringstream res;
res << "attribute_writing_ranks = ["
<< auxiliary::getEnvString("RANKS", "0") << "]";
auto res_str = res.str();
std::cout << "RETURNING: '" << res_str << "'" << std::endl;
return res_str;
}()
#endif
);
if (0 == mpi_rank)
cout << "Created an empty series in parallel with " << mpi_size
<< " MPI ranks\n";
Expand Down
Loading

0 comments on commit 5086434

Please sign in to comment.