23 #include "openPMD/IO/ADIOS/ADIOS2Auxiliary.hpp"
24 #include "openPMD/IO/AbstractIOHandler.hpp"
25 #include "openPMD/IO/IOTask.hpp"
26 #include "openPMD/IO/InvalidatableFile.hpp"
27 #include "openPMD/config.hpp"
29 #if openPMD_HAVE_ADIOS2
41 class ADIOS2IOHandlerImpl;
44 #if openPMD_HAVE_ADIOS2
45 namespace openPMD::detail
81 adios2::Engine &engine,
82 std::string
const &fileName);
84 static constexpr
char const *errorMsg =
"ADIOS2: readDataset()";
100 template <
int n,
typename... Params>
101 static void call(Params &&...);
110 Datatype dtype = Datatype::UNDEFINED;
117 virtual void *update() = 0;
121 template <
typename T>
124 adios2::detail::Span<T> span;
128 void *update()
override;
143 using UseGroupTable = adios_defs::UseGroupTable;
144 using FlushTarget = adios_defs::FlushTarget;
176 adios2::ADIOS &m_ADIOS;
182 std::vector<std::unique_ptr<BufferedAction>>
m_buffer;
213 std::set<std::string> uncommittedAttributes;
225 bool optimizeAttributesStreaming =
false;
228 ParsePreference parsePreference = ParsePreference::UpFront;
230 using AttributeMap_t = std::map<std::string, adios2::Params>;
242 UseGroupTable detectGroupTable();
244 adios2::Engine &getEngine();
246 template <
typename BA>
247 void enqueue(BA &&ba)
249 enqueue<BA>(std::forward<BA>(ba),
m_buffer);
252 template <
typename BA>
253 void enqueue(BA &&ba, decltype(
m_buffer) &buffer)
255 using BA_ =
typename std::remove_reference<BA>::type;
257 std::unique_ptr<BufferedAction>(
new BA_(std::forward<BA>(ba))));
260 template <
typename... Args>
261 void flush(Args &&...args);
269 FlushTarget flushTarget = FlushTarget::Disk;
275 : level(level_in), flushTarget(flushTarget_in)
298 std::function<
void(
ADIOS2File &, adios2::Engine &)>
const
301 bool flushUnconditionally);
323 AttributeMap_t
const &availableAttributes();
325 std::vector<std::string>
326 availableAttributesPrefixed(std::string
const &prefix);
331 void invalidateAttributesMap();
333 AttributeMap_t
const &availableVariables();
335 std::vector<std::string>
336 availableVariablesPrefixed(std::string
const &prefix);
341 void invalidateVariablesMap();
411 size_t currentStep();
415 std::optional<adios2::Engine> m_engine;
419 std::string m_engineType;
425 size_t m_currentStep = 0;
439 std::optional<AttributeMap_t> m_availableAttributes;
440 std::optional<AttributeMap_t> m_availableVariables;
442 std::set<Writable *> m_pathsMarkedAsActive;
448 bool initializedDefaults =
false;
452 bool finalized =
false;
454 UseGroupTable useGroupTable()
const;
459 void configure_IO_Read();
460 void configure_IO_Write();
463 template <
typename... Args>
464 void ADIOS2File::flush(Args &&...args)
470 catch (error::ReadError
const &)
Definition: ADIOS2IOHandler.hpp:94
Layer to mirror structure of logical data and persistent data in file.
Definition: Writable.hpp:75
Definition: ADIOS2File.hpp:137
AdvanceStatus advance(AdvanceMode mode)
Begin or end an ADIOS step.
Definition: ADIOS2File.cpp:1095
void finalize()
Implementation of destructor, will only run once.
Definition: ADIOS2File.cpp:198
std::map< unsigned, std::unique_ptr< I_UpdateSpan > > m_updateSpans
The base pointer of an ADIOS2 span might change after reallocations.
Definition: ADIOS2File.hpp:206
std::vector< std::unique_ptr< BufferedAction > > m_buffer
The default queue for deferred actions.
Definition: ADIOS2File.hpp:182
std::vector< std::unique_ptr< BufferedAction > > m_alreadyEnqueued
This contains deferred actions that have already been enqueued into ADIOS2, but not yet performed in ...
Definition: ADIOS2File.hpp:196
std::vector< BufferedUniquePtrPut > m_uniquePtrPuts
When receiving a unique_ptr, we know that the buffer is ours and ours alone.
Definition: ADIOS2File.hpp:189
std::string m_IOName
ADIOS requires giving names to instances of adios2::IO.
Definition: ADIOS2File.hpp:175
void flush_impl(ADIOS2FlushParams flushParams, std::function< void(ADIOS2File &, adios2::Engine &)> const &performPutGets, bool writeLatePuts, bool flushUnconditionally)
Flush deferred IO actions.
Definition: ADIOS2File.cpp:932
std::string m_file
The full path to the file created on disk, including the containing directory and the file extension,...
Definition: ADIOS2File.hpp:156
StreamStatus
Definition: ADIOS2File.hpp:372
@ ReadWithoutStream
File is not written is streaming fashion.
@ StreamOver
Stream has ended.
@ DuringStep
A step is currently active.
@ OutsideOfStep
A stream is active, but no step.
@ Undecided
The stream status of a file-based engine will be decided upon opening the engine if in read mode.
Public definitions of openPMD-api.
Definition: Date.cpp:29
AdvanceMode
In step-based mode (i.e.
Definition: Streaming.hpp:35
AdvanceStatus
In step-based mode (i.e.
Definition: Streaming.hpp:21
FlushLevel
Determine what items should be flushed upon Series::flush()
Definition: AbstractIOHandler.hpp:49
Datatype
Concrete datatype of an object available at runtime.
Definition: Datatype.hpp:51
Wrapper around a shared pointer to:
Definition: InvalidatableFile.hpp:44
Definition: IOTask.hpp:429
Definition: IOTask.hpp:406
Typesafe description of all required arguments for a specified Operation.
Definition: IOTask.hpp:105
Definition: ADIOS2File.hpp:264
Definition: ADIOS2File.hpp:53
Definition: ADIOS2File.hpp:67
Definition: ADIOS2File.hpp:88
Definition: ADIOS2File.hpp:105
Definition: ADIOS2File.hpp:75
Definition: ADIOS2File.hpp:116
Definition: ADIOS2File.cpp:140
Definition: ADIOS2File.hpp:123
Definition: ADIOS2File.hpp:96