From 81e216eb183a332b20c2c45840de21476f2a95b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Fri, 24 Apr 2026 18:36:30 +0200 Subject: [PATCH 1/5] ADIOS2: enable stats by default, starting ADIOS2 v2.12.0 This PR https://github.com/ornladios/ADIOS2/issues/4502 changes things a bit performance-wise. --- examples/10_streaming_write.cpp | 2 +- include/openPMD/IO/ADIOS/macros.hpp | 3 +++ src/IO/ADIOS/ADIOS2File.cpp | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/10_streaming_write.cpp b/examples/10_streaming_write.cpp index 01bd2fcb33..403379a655 100644 --- a/examples/10_streaming_write.cpp +++ b/examples/10_streaming_write.cpp @@ -50,7 +50,7 @@ int main() // Iterations can be accessed independently from one another. This more // restricted mode enables performance optimizations in the backends, and // more importantly is compatible with streaming I/O. - Series series = Series("electrons.sst", Access::CREATE_LINEAR, R"( + Series series = Series("electrons.bp5", Access::CREATE_LINEAR, R"( { "adios2": { "engine": { diff --git a/include/openPMD/IO/ADIOS/macros.hpp b/include/openPMD/IO/ADIOS/macros.hpp index 8e57d9191d..907fbf1bc3 100644 --- a/include/openPMD/IO/ADIOS/macros.hpp +++ b/include/openPMD/IO/ADIOS/macros.hpp @@ -34,6 +34,9 @@ ADIOS2_VERSION_PATCH >= \ 2101) +#define openPMD_HAS_ADIOS_2_12 \ + (ADIOS2_VERSION_MAJOR * 100 + ADIOS2_VERSION_MINOR >= 212) + #if defined(ADIOS2_HAVE_BP5) || openPMD_HAS_ADIOS_2_10 // ADIOS2 v2.10 no longer defines this #define openPMD_HAVE_ADIOS2_BP5 1 diff --git a/src/IO/ADIOS/ADIOS2File.cpp b/src/IO/ADIOS/ADIOS2File.cpp index af2d42640c..8e7c690ca1 100644 --- a/src/IO/ADIOS/ADIOS2File.cpp +++ b/src/IO/ADIOS/ADIOS2File.cpp @@ -718,6 +718,7 @@ void ADIOS2File::configure_IO() std::to_string((uint64_t)MaxShmMB * (uint64_t)1048576)); } #endif + constexpr int default_stats_level = openPMD_HAS_ADIOS_2_12; if (notYetConfigured("StatsLevel")) { /* @@ -726,8 +727,8 @@ void ADIOS2File::configure_IO() * environment variable "OPENPMD_ADIOS2_STATS_LEVEL" be positive. * The ADIOS2 default was "1" (on). */ - auto stats_level = - auxiliary::getEnvNum("OPENPMD_ADIOS2_STATS_LEVEL", 0); + auto stats_level = auxiliary::getEnvNum( + "OPENPMD_ADIOS2_STATS_LEVEL", default_stats_level); m_IO.SetParameter("StatsLevel", std::to_string(stats_level)); } if (m_impl->realEngineType() == "sst" && notYetConfigured("QueueLimit")) From 153231d4d63f4a92a7ba2c8dd0a91aa40b6360ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Fri, 24 Apr 2026 21:10:51 +0200 Subject: [PATCH 2/5] revert example --- examples/10_streaming_write.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/10_streaming_write.cpp b/examples/10_streaming_write.cpp index 403379a655..01bd2fcb33 100644 --- a/examples/10_streaming_write.cpp +++ b/examples/10_streaming_write.cpp @@ -50,7 +50,7 @@ int main() // Iterations can be accessed independently from one another. This more // restricted mode enables performance optimizations in the backends, and // more importantly is compatible with streaming I/O. - Series series = Series("electrons.bp5", Access::CREATE_LINEAR, R"( + Series series = Series("electrons.sst", Access::CREATE_LINEAR, R"( { "adios2": { "engine": { From f6465eca11a0cc466d103638ab07210bef89545a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Wed, 29 Apr 2026 10:58:31 +0200 Subject: [PATCH 3/5] Use ADIOS2 v2.12.1 instead of v2.12.0 --- include/openPMD/IO/ADIOS/macros.hpp | 6 ++++-- src/IO/ADIOS/ADIOS2File.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/openPMD/IO/ADIOS/macros.hpp b/include/openPMD/IO/ADIOS/macros.hpp index 907fbf1bc3..8195d36e8a 100644 --- a/include/openPMD/IO/ADIOS/macros.hpp +++ b/include/openPMD/IO/ADIOS/macros.hpp @@ -34,8 +34,10 @@ ADIOS2_VERSION_PATCH >= \ 2101) -#define openPMD_HAS_ADIOS_2_12 \ - (ADIOS2_VERSION_MAJOR * 100 + ADIOS2_VERSION_MINOR >= 212) +#define openPMD_HAS_ADIOS_2_12_1 \ + (ADIOS2_VERSION_MAJOR * 1000 + ADIOS2_VERSION_MINOR * 10 + \ + ADIOS2_VERSION_PATCH >= \ + 2121) #if defined(ADIOS2_HAVE_BP5) || openPMD_HAS_ADIOS_2_10 // ADIOS2 v2.10 no longer defines this diff --git a/src/IO/ADIOS/ADIOS2File.cpp b/src/IO/ADIOS/ADIOS2File.cpp index 8e7c690ca1..fed5f0f48e 100644 --- a/src/IO/ADIOS/ADIOS2File.cpp +++ b/src/IO/ADIOS/ADIOS2File.cpp @@ -718,7 +718,7 @@ void ADIOS2File::configure_IO() std::to_string((uint64_t)MaxShmMB * (uint64_t)1048576)); } #endif - constexpr int default_stats_level = openPMD_HAS_ADIOS_2_12; + constexpr int default_stats_level = openPMD_HAS_ADIOS_2_12_1; if (notYetConfigured("StatsLevel")) { /* From d7e0dc55f59b2500fbf0a2a0b872ffc29e89cb56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Wed, 29 Apr 2026 10:58:46 +0200 Subject: [PATCH 4/5] Documentation --- docs/source/backends/adios2.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/backends/adios2.rst b/docs/source/backends/adios2.rst index 391e7a6543..acc614642e 100644 --- a/docs/source/backends/adios2.rst +++ b/docs/source/backends/adios2.rst @@ -84,7 +84,7 @@ environment variable default description ``OPENPMD_ADIOS2_ENGINE`` ``File`` `ADIOS2 engine `_ ``OPENPMD_ADIOS2_PRETEND_ENGINE`` *empty* Pretend that an (unknown) ADIOS2 engine is in fact another one (also see the ``adios2.pretend_engine`` :ref:`parameter `). ``OPENPMD2_ADIOS2_USE_GROUP_TABLE`` ``0`` Use group table (see below) -``OPENPMD_ADIOS2_STATS_LEVEL`` ``0`` whether to generate statistics for variables in ADIOS2. (``1``: yes, ``0``: no). +``OPENPMD_ADIOS2_STATS_LEVEL`` see below Whether to generate statistics for variables in ADIOS2. (``1``: yes, ``0``: no) ``OPENPMD_ADIOS2_ASYNC_WRITE`` ``0`` ADIOS2 BP5 engine: 1 means setting "AsyncWrite" in ADIOS2 to "on". Flushes will go to the buffer by default (see ``preferred_flush_target``). ``OPENPMD_ADIOS2_BP5_BufferChunkMB`` ``0`` ADIOS2 BP5 engine: applies when using either EveryoneWrites or EveryoneWritesSerial aggregation ``OPENPMD_ADIOS2_BP5_MaxShmMB`` ``0`` ADIOS2 BP5 engine: applies when using TwoLevelShm aggregation @@ -98,7 +98,7 @@ Please refer to the `ADIOS2 documentation `. -Due to performance considerations, the ADIOS2 backend configures ADIOS2 not to compute any dataset statistics (Min/Max) by default. +Due to performance considerations, the ADIOS2 backend configures ADIOS2 not to compute any dataset statistics (Min/Max) by default for ADIOS2 versions up until v2.12.0. Starting with `v2.12.1 `_, the performance of statistics computation has been improved, so it is turned on by default. Statistics may be activated by setting the :ref:`JSON parameter ` ``adios2.engine.parameters.StatsLevel = "1"``. The ADIOS2 backend overrides the default unlimited queueing behavior of the SST engine with a more cautious limit of 2 steps that may be held in the queue at one time. From caae4b22fd73f889d00885dbebba5172345dcee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Thu, 30 Apr 2026 13:02:21 +0200 Subject: [PATCH 5/5] Documentation --- src/IO/ADIOS/ADIOS2File.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/IO/ADIOS/ADIOS2File.cpp b/src/IO/ADIOS/ADIOS2File.cpp index fed5f0f48e..1d181033eb 100644 --- a/src/IO/ADIOS/ADIOS2File.cpp +++ b/src/IO/ADIOS/ADIOS2File.cpp @@ -718,14 +718,27 @@ void ADIOS2File::configure_IO() std::to_string((uint64_t)MaxShmMB * (uint64_t)1048576)); } #endif - constexpr int default_stats_level = openPMD_HAS_ADIOS_2_12_1; + +#if openPMD_HAS_ADIOS_2_12_1 + constexpr int default_stats_level = 1; +#else + constexpr int default_stats_level = 0; +#endif + if (notYetConfigured("StatsLevel")) { /* + * Up until and including ADIOS2 v2.12.0: + * * Switch those off by default since they are expensive to compute * and to enable it, set the JSON option "StatsLevel" or the * environment variable "OPENPMD_ADIOS2_STATS_LEVEL" be positive. * The ADIOS2 default was "1" (on). + * + * Beginning ADIOS2 v2.12.1: + * + * Performance for Stats computation has been improved through + * vectorization, so we switch it on by default. */ auto stats_level = auxiliary::getEnvNum( "OPENPMD_ADIOS2_STATS_LEVEL", default_stats_level);