|
DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
|
Per-rank JSON file serializer; each MPI rank writes its own .json file. More...
#include <SerializerJSON.hpp>
Public Member Functions | |
| void | SetUseCodecOnUint8 (bool v) |
| void | SetDeflateLevel (int v) |
| 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. | |
| ~SerializerJSON () 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. | |
Per-rank JSON file serializer; each MPI rank writes its own .json file.
Definition at line 25 of file SerializerJSON.hpp.
|
inlineoverride |
|
overridevirtual |
Close the backing file, flushing buffers.
Implements DNDS::Serializer::SerializerBase.
Definition at line 48 of file SerializerJSON.cpp.
| void DNDS::Serializer::SerializerJSON::CloseFileNonVirtual | ( | ) |
Definition at line 52 of file SerializerJSON.cpp.
|
overridevirtual |
Create a sub-path (H5 group / JSON object) at the current location.
Implements DNDS::Serializer::SerializerBase.
Definition at line 62 of file SerializerJSON.cpp.
|
overridevirtual |
String form of the current path.
Implements DNDS::Serializer::SerializerBase.
Definition at line 85 of file SerializerJSON.cpp.
|
inlineoverridevirtual |
MPI context the serializer was opened with.
Implements DNDS::Serializer::SerializerBase.
Definition at line 53 of file SerializerJSON.hpp.
|
inlineoverridevirtual |
Rank index cached by the serializer (relevant for collective I/O).
Implements DNDS::Serializer::SerializerBase.
Definition at line 51 of file SerializerJSON.hpp.
|
inlineoverridevirtual |
Rank count cached by the serializer.
Implements DNDS::Serializer::SerializerBase.
Definition at line 52 of file SerializerJSON.hpp.
|
overridevirtual |
Navigate to an existing path. Supports / -separated segments.
Implements DNDS::Serializer::SerializerBase.
Definition at line 73 of file SerializerJSON.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 48 of file SerializerJSON.hpp.
|
overridevirtual |
Names of direct children of the current path.
Implements DNDS::Serializer::SerializerBase.
Definition at line 90 of file SerializerJSON.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 34 of file SerializerJSON.cpp.
|
overridevirtual |
Read a scalar index into v.
Implements DNDS::Serializer::SerializerBase.
Definition at line 167 of file SerializerJSON.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 179 of file SerializerJSON.cpp.
|
overridevirtual |
Read a scalar int into v.
Implements DNDS::Serializer::SerializerBase.
Definition at line 161 of file SerializerJSON.cpp.
|
overridevirtual |
Read a scalar real into v.
Implements DNDS::Serializer::SerializerBase.
Definition at line 173 of file SerializerJSON.cpp.
|
overridevirtual |
Implements DNDS::Serializer::SerializerBase.
Definition at line 193 of file SerializerJSON.cpp.
|
overridevirtual |
Implements DNDS::Serializer::SerializerBase.
Definition at line 186 of file SerializerJSON.cpp.
|
overridevirtual |
Implements DNDS::Serializer::SerializerBase.
Definition at line 206 of file SerializerJSON.cpp.
|
overridevirtual |
Implements DNDS::Serializer::SerializerBase.
Definition at line 235 of file SerializerJSON.cpp.
|
overridevirtual |
Read a UTF-8 string into v.
Implements DNDS::Serializer::SerializerBase.
Definition at line 200 of file SerializerJSON.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 292 of file SerializerJSON.cpp.
|
inline |
|
inline |
|
overridevirtual |
Write a scalar index under name.
Implements DNDS::Serializer::SerializerBase.
Definition at line 106 of file SerializerJSON.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 116 of file SerializerJSON.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 68 of file SerializerJSON.hpp.
|
overridevirtual |
Write a scalar int under name at the current path.
Implements DNDS::Serializer::SerializerBase.
Definition at line 101 of file SerializerJSON.cpp.
|
overridevirtual |
Write a scalar real under name.
Implements DNDS::Serializer::SerializerBase.
Definition at line 111 of file SerializerJSON.cpp.
|
overridevirtual |
Write a real vector (collective for H5).
Implements DNDS::Serializer::SerializerBase.
Definition at line 126 of file SerializerJSON.cpp.
|
overridevirtual |
Write a rowsize vector (collective for H5).
Implements DNDS::Serializer::SerializerBase.
Definition at line 121 of file SerializerJSON.cpp.
|
overridevirtual |
Write a shared index vector; deduplicated across multiple writes that share the same shared_ptr.
Implements DNDS::Serializer::SerializerBase.
Definition at line 136 of file SerializerJSON.cpp.
|
overridevirtual |
Write a shared rowsize vector; deduplicated across multiple writes.
Implements DNDS::Serializer::SerializerBase.
Definition at line 148 of file SerializerJSON.cpp.
|
overridevirtual |
Write a UTF-8 string under name.
Implements DNDS::Serializer::SerializerBase.
Definition at line 131 of file SerializerJSON.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 264 of file SerializerJSON.cpp.