Skip to content

Commit c13aeb1

Browse files
committed
ADIOS2: enable stats by default, starting ADIOS2 v2.12.1 (openPMD#1877)
* ADIOS2: enable stats by default, starting ADIOS2 v2.12.0 This PR ornladios/ADIOS2#4985 changes things a bit performance-wise.
1 parent c21ed88 commit c13aeb1

3 files changed

Lines changed: 23 additions & 4 deletions

File tree

docs/source/backends/adios2.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ environment variable default description
8484
``OPENPMD_ADIOS2_ENGINE`` ``File`` `ADIOS2 engine <https://adios2.readthedocs.io/en/latest/engines/engines.html>`_
8585
``OPENPMD_ADIOS2_PRETEND_ENGINE`` *empty* Pretend that an (unknown) ADIOS2 engine is in fact another one (also see the ``adios2.pretend_engine`` :ref:`parameter <backendconfig-adios2>`).
8686
``OPENPMD2_ADIOS2_USE_GROUP_TABLE`` ``0`` Use group table (see below)
87-
``OPENPMD_ADIOS2_STATS_LEVEL`` ``0`` whether to generate statistics for variables in ADIOS2. (``1``: yes, ``0``: no).
87+
``OPENPMD_ADIOS2_STATS_LEVEL`` see below Whether to generate statistics for variables in ADIOS2. (``1``: yes, ``0``: no)
8888
``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``).
8989
``OPENPMD_ADIOS2_BP5_BufferChunkMB`` ``0`` ADIOS2 BP5 engine: applies when using either EveryoneWrites or EveryoneWritesSerial aggregation
9090
``OPENPMD_ADIOS2_BP5_MaxShmMB`` ``0`` ADIOS2 BP5 engine: applies when using TwoLevelShm aggregation
@@ -98,7 +98,7 @@ Please refer to the `ADIOS2 documentation <https://adios2.readthedocs.io/en/late
9898

9999
Notice that the ADIOS2 backend is alternatively configurable via :ref:`JSON parameters <backendconfig>`.
100100

101-
Due to performance considerations, the ADIOS2 backend configures ADIOS2 not to compute any dataset statistics (Min/Max) by default.
101+
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 <https://github.com/ornladios/ADIOS2/releases/tag/v2.12.1>`_, the performance of statistics computation has been improved, so it is turned on by default.
102102
Statistics may be activated by setting the :ref:`JSON parameter <backendconfig>` ``adios2.engine.parameters.StatsLevel = "1"``.
103103

104104
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.

include/openPMD/IO/ADIOS/macros.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
ADIOS2_VERSION_PATCH >= \
3535
2101)
3636

37+
#define openPMD_HAS_ADIOS_2_12_1 \
38+
(ADIOS2_VERSION_MAJOR * 1000 + ADIOS2_VERSION_MINOR * 10 + \
39+
ADIOS2_VERSION_PATCH >= \
40+
2121)
41+
3742
#if defined(ADIOS2_HAVE_BP5) || openPMD_HAS_ADIOS_2_10
3843
// ADIOS2 v2.10 no longer defines this
3944
#define openPMD_HAVE_ADIOS2_BP5 1

src/IO/ADIOS/ADIOS2File.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,16 +717,30 @@ void ADIOS2File::configure_IO()
717717
std::to_string((uint64_t)MaxShmMB * (uint64_t)1048576));
718718
}
719719
#endif
720+
721+
#if openPMD_HAS_ADIOS_2_12_1
722+
constexpr int default_stats_level = 1;
723+
#else
724+
constexpr int default_stats_level = 0;
725+
#endif
726+
720727
if (notYetConfigured("StatsLevel"))
721728
{
722729
/*
730+
* Up until and including ADIOS2 v2.12.0:
731+
*
723732
* Switch those off by default since they are expensive to compute
724733
* and to enable it, set the JSON option "StatsLevel" or the
725734
* environment variable "OPENPMD_ADIOS2_STATS_LEVEL" be positive.
726735
* The ADIOS2 default was "1" (on).
736+
*
737+
* Beginning ADIOS2 v2.12.1:
738+
*
739+
* Performance for Stats computation has been improved through
740+
* vectorization, so we switch it on by default.
727741
*/
728-
auto stats_level =
729-
auxiliary::getEnvNum("OPENPMD_ADIOS2_STATS_LEVEL", 0);
742+
auto stats_level = auxiliary::getEnvNum(
743+
"OPENPMD_ADIOS2_STATS_LEVEL", default_stats_level);
730744
m_IO.SetParameter("StatsLevel", std::to_string(stats_level));
731745
}
732746
if (m_impl->realEngineType() == "sst" && notYetConfigured("QueueLimit"))

0 commit comments

Comments
 (0)