Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata optimization: Only write ADIOS2 attributes from rank 0 in openPMD-api >= 0.16 #5223

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions include/picongpu/plugins/openPMD/Json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,37 @@ The key 'select' must point to either a single string or an array of strings.)EN
* careful memory configuration is necessary anyway, so the
* defaults don't matter.
*/
# if OPENPMDAPI_VERSION_GE(0, 16, 0)
/*
* In openPMD >= 0.16, additionally ignore all attribute metadata
* that comes from a rank other than rank 0.
* The openPMD plugin of PIConGPU writes attributes synchronously
* (since this is required in common configurations of HDF5).
* For ADIOS2 however, it's better to write attributes from single
* ranks only and avoid metadata duplication across ranks.
* This option tells the ADIOS2 backend of openPMD that it can
* safely ignore any attribute write if the current MPI rank is
* not 0.
*/
std::string const& defaultValues = R"(
{
"hdf5": {
"dataset": {
"chunks": "none"
}
},
"adios2": {
"attribute_writing_ranks": 0,
"engine": {
"preferred_flush_target": "buffer",
"parameters": {
"BufferChunkSize": 2147381248
}
}
}
}
)";
# else
std::string const& defaultValues = R"(
{
"hdf5": {
Expand All @@ -356,6 +387,7 @@ The key 'select' must point to either a single string or an array of strings.)EN
}
}
)";
# endif
std::stringstream json_to_string;
json_to_string << config;
auto merged = openPMD::json::merge(defaultValues, json_to_string.str());
Expand Down