Skip to content

Commit

Permalink
Add a JSON translation of the config for NVHPC compilers
Browse files Browse the repository at this point in the history
might also be good for documentation purposes as JSON is more widely
known
  • Loading branch information
franzpoeschel committed Aug 5, 2024
1 parent ad16705 commit 5f77a13
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions examples/13_write_dynamic_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ int main()
}

using position_t = double;

#if !__NVCOMPILER // see https://github.com/ToruNiina/toml11/issues/205
/*
* This example demonstrates how to use JSON/TOML-based dynamic
* configuration for openPMD.
Expand Down Expand Up @@ -92,6 +94,65 @@ cfg.chunks = [5]
select = "particles/e/.*"
CFG.CHUNKS = [10]
)END";
#else
/*
* This is the same configuration in JSON. We need this in deprecated
* NVHPC-compilers due to problems that those compilers have with the
* toruniina::toml11 library.
*/
std::string const defaults = R"(
{
"backend": "hdf5",
"defer_iteration_parsing": true,
"iteration_encoding": "group_based",
"adios2": {
"engine": {
"type": "bp4"
},
"dataset": {
"operators": [
{
"parameters": {
"clevel": 5
},
"type": "zlib"
}
]
}
},
"hdf5": {
"dataset": [
{
"cfg": {
"chunks": "auto"
}
},
{
"select": [
"/data/1/particles/e/.*",
"/data/2/particles/e/.*"
],
"cfg": {
"chunks": [
5
]
}
},
{
"select": "particles/e/.*",
"CFG": {
"CHUNKS": [
10
]
}
}
]
}
}
)";
#endif

// open file for writing
Series series =
Expand Down

0 comments on commit 5f77a13

Please sign in to comment.