Skip to content

Commit 64b006d

Browse files
committed
Add a JSON translation of the config for NVHPC compilers
might also be good for documentation purposes as JSON is more widely known
1 parent 6d7d773 commit 64b006d

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

examples/13_write_dynamic_configuration.cpp

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ int main()
1717
}
1818

1919
using position_t = double;
20+
21+
#if !__NVCOMPILER // see https://github.com/ToruNiina/toml11/issues/205
2022
/*
2123
* This example demonstrates how to use JSON/TOML-based dynamic
2224
* configuration for openPMD.
@@ -92,6 +94,65 @@ cfg.chunks = [5]
9294
select = "particles/e/.*"
9395
CFG.CHUNKS = [10]
9496
)END";
97+
#else
98+
/*
99+
* This is the same configuration in JSON. We need this in deprecated
100+
* NVHPC-compilers due to problems that those compilers have with the
101+
* toruniina::toml11 library.
102+
*/
103+
std::string const defaults = R"(
104+
{
105+
"backend": "hdf5",
106+
"defer_iteration_parsing": true,
107+
"iteration_encoding": "group_based",
108+
109+
"adios2": {
110+
"engine": {
111+
"type": "bp4"
112+
},
113+
"dataset": {
114+
"operators": [
115+
{
116+
"parameters": {
117+
"clevel": 5
118+
},
119+
"type": "zlib"
120+
}
121+
]
122+
}
123+
},
124+
125+
"hdf5": {
126+
"dataset": [
127+
{
128+
"cfg": {
129+
"chunks": "auto"
130+
}
131+
},
132+
{
133+
"select": [
134+
"/data/1/particles/e/.*",
135+
"/data/2/particles/e/.*"
136+
],
137+
"cfg": {
138+
"chunks": [
139+
5
140+
]
141+
}
142+
},
143+
{
144+
"select": "particles/e/.*",
145+
"CFG": {
146+
"CHUNKS": [
147+
10
148+
]
149+
}
150+
}
151+
]
152+
}
153+
}
154+
)";
155+
#endif
95156

96157
// open file for writing
97158
Series series =

0 commit comments

Comments
 (0)