|
DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
|
MPI-parallel HDF5 serializer; all ranks collectively read/write a single .h5 file. More...
#include <SerializerH5.hpp>
Public Member Functions | |
| SerializerH5 (const MPIInfo &_mpi) | |
| void | SetChunkAndDeflate (int64_t n_chunksize, int n_deflateLevel) |
| void | SetCollectiveRW (bool metadata, bool data) |
| void | OpenFile (const std::string &fName, bool read) override |
| Open a backing file (H5 file or JSON file depending on subclass). | |
| void | CloseFile () override |
| Close the backing file, flushing buffers. | |
| void | CloseFileNonVirtual () |
| void | CreatePath (const std::string &p) override |
| Create a sub-path (H5 group / JSON object) at the current location. | |
| void | GoToPath (const std::string &p) override |
Navigate to an existing path. Supports / -separated segments. | |
| bool | IsPerRank () override |
| Whether this serializer is per-rank (JSON-file-per-rank) or collective (shared H5 file). Controls which API entry points are used. | |
| std::string | GetCurrentPath () override |
| String form of the current path. | |
| std::set< std::string > | ListCurrentPath () override |
| Names of direct children of the current path. | |
| int | GetMPIRank () override |
| Rank index cached by the serializer (relevant for collective I/O). | |
| int | GetMPISize () override |
| Rank count cached by the serializer. | |
| const MPIInfo & | getMPI () override |
| MPI context the serializer was opened with. | |
| void | WriteInt (const std::string &name, int v) override |
Write a scalar int under name at the current path. | |
| void | WriteIndex (const std::string &name, index v) override |
Write a scalar index under name. | |
| void | WriteReal (const std::string &name, real v) override |
Write a scalar real under name. | |
| void | WriteString (const std::string &name, const std::string &v) override |
Write a UTF-8 string under name. | |
| void | WriteIndexVector (const std::string &name, const std::vector< index > &v, ArrayGlobalOffset offset) override |
Write an index vector (collective for H5). offset carries the distribution mode (ArrayGlobalOffset_Parts, explicit offset, etc.). | |
| void | WriteRowsizeVector (const std::string &name, const std::vector< rowsize > &v, ArrayGlobalOffset offset) override |
| Write a rowsize vector (collective for H5). | |
| void | WriteRealVector (const std::string &name, const std::vector< real > &v, ArrayGlobalOffset offset) override |
| Write a real vector (collective for H5). | |
| void | WriteSharedIndexVector (const std::string &name, const ssp< host_device_vector< index > > &v, ArrayGlobalOffset offset) override |
Write a shared index vector; deduplicated across multiple writes that share the same shared_ptr. | |
| void | WriteSharedRowsizeVector (const std::string &name, const ssp< host_device_vector< rowsize > > &v, ArrayGlobalOffset offset) override |
| Write a shared rowsize vector; deduplicated across multiple writes. | |
| void | WriteUint8Array (const std::string &name, const uint8_t *data, index size, ArrayGlobalOffset offset) override |
Write a raw byte buffer under name. offset.isDist() = true means the caller provides the exact per-rank slab; otherwise the buffer is treated according to the offset's sentinel. | |
| void | WriteIndexVectorPerRank (const std::string &name, const std::vector< index > &v) override |
| Write a per-rank index vector (replicated name, independent values). | |
| void | ReadInt (const std::string &name, int &v) override |
Read a scalar int into v. | |
| void | ReadIndex (const std::string &name, index &v) override |
Read a scalar index into v. | |
| void | ReadReal (const std::string &name, real &v) override |
Read a scalar real into v. | |
| void | ReadString (const std::string &name, std::string &v) override |
Read a UTF-8 string into v. | |
| void | ReadIndexVector (const std::string &name, std::vector< index > &v, ArrayGlobalOffset &offset) override |
| void | ReadRowsizeVector (const std::string &name, std::vector< rowsize > &v, ArrayGlobalOffset &offset) override |
| void | ReadRealVector (const std::string &name, std::vector< real > &v, ArrayGlobalOffset &offset) override |
| void | ReadSharedIndexVector (const std::string &name, ssp< host_device_vector< index > > &v, ArrayGlobalOffset &offset) override |
| void | ReadSharedRowsizeVector (const std::string &name, ssp< host_device_vector< rowsize > > &v, ArrayGlobalOffset &offset) override |
| void | ReadUint8Array (const std::string &name, uint8_t *data, index &size, ArrayGlobalOffset &offset) override |
| Two-pass byte array read. | |
| ~SerializerH5 () override | |
Public Member Functions inherited from DNDS::Serializer::SerializerBase | |
| virtual | ~SerializerBase () |
Additional Inherited Members | |
Protected Member Functions inherited from DNDS::Serializer::SerializerBase | |
| template<class T > | |
| bool | dedupLookup (const ssp< T > &v, std::string &outPath) |
| Check if a shared pointer was already written; if so return its path. | |
| template<class T > | |
| void | dedupRegister (const ssp< T > &v, const std::string &path) |
| Register a shared pointer after writing its data. | |
| void | dedupClear () |
| Clear all dedup state (call on CloseFile). | |
Protected Attributes inherited from DNDS::Serializer::SerializerBase | |
| std::map< void *, std::pair< std::shared_ptr< void >, std::string > > | ptr_2_pth |
| std::map< std::string, void * > | pth_2_ssp |
| Reverse map for read-side dedup: path -> raw pointer to the ssp local variable. | |
MPI-parallel HDF5 serializer; all ranks collectively read/write a single .h5 file.
Definition at line 52 of file SerializerH5.hpp.
|
inline |
Definition at line 70 of file SerializerH5.hpp.
|
inlineoverride |
|
overridevirtual |
Close the backing file, flushing buffers.
Implements DNDS::Serializer::SerializerBase.
Definition at line 125 of file SerializerH5.cpp.
| void DNDS::Serializer::SerializerH5::CloseFileNonVirtual | ( | ) |
Definition at line 129 of file SerializerH5.cpp.
|
overridevirtual |
Create a sub-path (H5 group / JSON object) at the current location.
Implements DNDS::Serializer::SerializerBase.
Definition at line 138 of file SerializerH5.cpp.
|
overridevirtual |
String form of the current path.
Implements DNDS::Serializer::SerializerBase.
Definition at line 165 of file SerializerH5.cpp.
|
inlineoverridevirtual |
MPI context the serializer was opened with.
Implements DNDS::Serializer::SerializerBase.
Definition at line 99 of file SerializerH5.hpp.
|
inlineoverridevirtual |
Rank index cached by the serializer (relevant for collective I/O).
Implements DNDS::Serializer::SerializerBase.
Definition at line 97 of file SerializerH5.hpp.
|
inlineoverridevirtual |
Rank count cached by the serializer.
Implements DNDS::Serializer::SerializerBase.
Definition at line 98 of file SerializerH5.hpp.
|
overridevirtual |
Navigate to an existing path. Supports / -separated segments.
Implements DNDS::Serializer::SerializerBase.
Definition at line 153 of file SerializerH5.cpp.
|
inlineoverridevirtual |
Whether this serializer is per-rank (JSON-file-per-rank) or collective (shared H5 file). Controls which API entry points are used.
Implements DNDS::Serializer::SerializerBase.
Definition at line 94 of file SerializerH5.hpp.
|
overridevirtual |
Names of direct children of the current path.
Implements DNDS::Serializer::SerializerBase.
Definition at line 261 of file SerializerH5.cpp.
|
overridevirtual |
Open a backing file (H5 file or JSON file depending on subclass).
| read | true for reading, false for writing. |
Implements DNDS::Serializer::SerializerBase.
Definition at line 109 of file SerializerH5.cpp.
|
overridevirtual |
Read a scalar index into v.
Implements DNDS::Serializer::SerializerBase.
Definition at line 598 of file SerializerH5.cpp.
|
overridevirtual |
Read methods resize the output container and populate it. Internally these use a two-pass HDF5 pattern (size query, then data read). Both passes are collective. When the local size is 0, a dummy non-null pointer is passed to the second pass so the rank participates in H5Dread.
Implements DNDS::Serializer::SerializerBase.
Definition at line 828 of file SerializerH5.cpp.
|
overridevirtual |
Read a scalar int into v.
Implements DNDS::Serializer::SerializerBase.
Definition at line 594 of file SerializerH5.cpp.
|
overridevirtual |
Read a scalar real into v.
Implements DNDS::Serializer::SerializerBase.
Definition at line 602 of file SerializerH5.cpp.
|
overridevirtual |
Implements DNDS::Serializer::SerializerBase.
Definition at line 846 of file SerializerH5.cpp.
|
overridevirtual |
Implements DNDS::Serializer::SerializerBase.
Definition at line 837 of file SerializerH5.cpp.
|
overridevirtual |
Implements DNDS::Serializer::SerializerBase.
Definition at line 859 of file SerializerH5.cpp.
|
overridevirtual |
Implements DNDS::Serializer::SerializerBase.
Definition at line 893 of file SerializerH5.cpp.
|
overridevirtual |
Read a UTF-8 string into v.
Implements DNDS::Serializer::SerializerBase.
Definition at line 855 of file SerializerH5.cpp.
|
overridevirtual |
Two-pass byte array read.
Pass 1 (data == nullptr): queries the local element count into size and resolves offset. Pass 2 (data != nullptr): reads size bytes into data.
size is 0 after pass 1, the caller must still pass a non-null data pointer on pass 2 so the rank participates in the collective HDF5 read. Use a stack dummy (uint8_t dummy; ... &dummy). Implements DNDS::Serializer::SerializerBase.
Definition at line 931 of file SerializerH5.cpp.
|
inline |
Definition at line 75 of file SerializerH5.hpp.
|
inline |
Definition at line 83 of file SerializerH5.hpp.
|
overridevirtual |
Write a scalar index under name.
Implements DNDS::Serializer::SerializerBase.
Definition at line 345 of file SerializerH5.cpp.
|
overridevirtual |
Write an index vector (collective for H5). offset carries the distribution mode (ArrayGlobalOffset_Parts, explicit offset, etc.).
Implements DNDS::Serializer::SerializerBase.
Definition at line 466 of file SerializerH5.cpp.
|
inlineoverridevirtual |
Write a per-rank index vector (replicated name, independent values).
Every rank writes its own vector under name; in the H5 case each rank's slab is placed in a separate dataset.
| name | Dataset name (identical on every rank). |
| v | Rank-local vector; size may differ between ranks. |
Implements DNDS::Serializer::SerializerBase.
Definition at line 114 of file SerializerH5.hpp.
|
overridevirtual |
Write a scalar int under name at the current path.
Implements DNDS::Serializer::SerializerBase.
Definition at line 341 of file SerializerH5.cpp.
|
overridevirtual |
Write a scalar real under name.
Implements DNDS::Serializer::SerializerBase.
Definition at line 349 of file SerializerH5.cpp.
|
overridevirtual |
Write a real vector (collective for H5).
Implements DNDS::Serializer::SerializerBase.
Definition at line 474 of file SerializerH5.cpp.
|
overridevirtual |
Write a rowsize vector (collective for H5).
Implements DNDS::Serializer::SerializerBase.
Definition at line 470 of file SerializerH5.cpp.
|
overridevirtual |
Write a shared index vector; deduplicated across multiple writes that share the same shared_ptr.
Implements DNDS::Serializer::SerializerBase.
Definition at line 482 of file SerializerH5.cpp.
|
overridevirtual |
Write a shared rowsize vector; deduplicated across multiple writes.
Implements DNDS::Serializer::SerializerBase.
Definition at line 495 of file SerializerH5.cpp.
|
overridevirtual |
Write a UTF-8 string under name.
Implements DNDS::Serializer::SerializerBase.
Definition at line 478 of file SerializerH5.cpp.
|
overridevirtual |
Write a raw byte buffer under name. offset.isDist() = true means the caller provides the exact per-rank slab; otherwise the buffer is treated according to the offset's sentinel.
Implements DNDS::Serializer::SerializerBase.
Definition at line 927 of file SerializerH5.cpp.