Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
6a72cd4
Add memory selection task to backend
franzpoeschel Aug 7, 2025
e33010e
Add future helper
franzpoeschel Aug 7, 2025
72b773d
Fixes for UniquePtr.hpp
franzpoeschel Aug 7, 2025
f5e0178
Main implementation of LoadStoreChunk.hpp
franzpoeschel Aug 7, 2025
be9f775
Adapt RecordComponent implementation based on new API
franzpoeschel Aug 7, 2025
4464e35
Testing
franzpoeschel Aug 7, 2025
a3e260c
Enable support for const unique pointers?
franzpoeschel Aug 7, 2025
2535b5d
Use a better trick to cheat clang-tidy
franzpoeschel Aug 7, 2025
0c96740
clang-tidy fixes
franzpoeschel Aug 8, 2025
c137177
Fix linker error
franzpoeschel Jan 8, 2026
f0e2ec1
Reimplement unique_ptr-based span API
franzpoeschel Jan 8, 2026
30bb210
Fix parallel tests
franzpoeschel Jan 8, 2026
9235490
Type signature fix
franzpoeschel Jan 8, 2026
baccfcd
Destructor for ~DeferredComputation
franzpoeschel Jan 9, 2026
2807a82
CI fixes
franzpoeschel Feb 3, 2026
54be79b
wip: runtime-erase pointer type
franzpoeschel Feb 9, 2026
d4c13ea
Continue
franzpoeschel Feb 9, 2026
d1aa6f8
Mostly working again
franzpoeschel Feb 9, 2026
78f4e60
bad fix, remove the bool from python bindings
franzpoeschel Feb 9, 2026
5429181
Remove bool dataset operations from python API
franzpoeschel Feb 9, 2026
8399524
Fix Coretest
franzpoeschel Feb 9, 2026
e7de648
instantiate some more methods
franzpoeschel Feb 10, 2026
d4375bf
wip: unify common code into compiled functions
franzpoeschel Feb 10, 2026
5ef17a3
clang-tidy fixes
franzpoeschel Feb 10, 2026
665d674
CI fixes
franzpoeschel Feb 11, 2026
ec970f8
Remove CRT pattern and core namespace
franzpoeschel Feb 12, 2026
8a37f2a
Move wrappers to header code
franzpoeschel Feb 12, 2026
f930f2b
Interface cleanup
franzpoeschel Feb 13, 2026
c27b4cf
Fix after rebase
franzpoeschel Mar 12, 2026
a2b5449
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 12, 2026
f03390b
Suffix ..Raw for internal legacy store/load operations
franzpoeschel Apr 7, 2026
b394aae
Remove enqueue prefixes, these are now default
franzpoeschel Apr 7, 2026
d1aaae6
Add future task with caching option
franzpoeschel Apr 7, 2026
7e55941
Add unsafeNoAutomaticFlush
franzpoeschel Apr 7, 2026
6504b49
add missing constructor
franzpoeschel Apr 7, 2026
5de8d15
remove internal use of raw methods
franzpoeschel Apr 7, 2026
9a46d84
Remove raw methods
franzpoeschel Apr 7, 2026
202ba93
Avoid if constexpr, msvc doesnt get it
franzpoeschel Apr 8, 2026
9d403cc
Add Doxygen documentation to new functions and types
Apr 8, 2026
66632ad
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 8, 2026
0975a00
CI fixes
franzpoeschel Apr 8, 2026
a7b1111
Documentation fixes
franzpoeschel Apr 14, 2026
be4aff7
AI code review
franzpoeschel Apr 20, 2026
2ff6181
Rename forget() -> invalidate()
franzpoeschel Apr 20, 2026
d2c7a2c
Fix MSVC compilation
franzpoeschel Apr 21, 2026
eb27c1f
Fix move constructor / assignment operator
franzpoeschel Apr 22, 2026
3dc8f61
Add a small test for DeferredComputation
franzpoeschel Apr 22, 2026
609168c
Remove core namespace leftover
franzpoeschel Jun 10, 2026
e72eaaa
Extract GlobalParameters struct
franzpoeschel Jan 9, 2026
7a2d367
Better initialization of global params
franzpoeschel Jan 9, 2026
ba559fa
First attempt at immediate flushing
franzpoeschel Jan 12, 2026
c9e2a30
Fix coretests
franzpoeschel Jan 14, 2026
75e890a
wip: try splitting m_work in two
franzpoeschel Jan 14, 2026
1ce9eb1
push_chunk: distinguish immediate from deferred flushes
franzpoeschel Jan 14, 2026
ad4e29c
Avoid flush_immediately for Span operations
franzpoeschel Jan 14, 2026
e23f755
Fix dirty handling
franzpoeschel Jan 14, 2026
7c1ff64
Bug fix in RecordComponent::flush
franzpoeschel Feb 2, 2026
3e836c5
tmp: deactivate some tests
franzpoeschel Feb 2, 2026
abb9a35
Properly distinguish flush modi in tests
franzpoeschel Feb 2, 2026
0cc95e1
CI fixes
franzpoeschel Feb 2, 2026
e811e27
CI fixes
franzpoeschel Feb 3, 2026
2c060cb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 20, 2026
c0475c4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 10, 2026
4bb9a95
uhhm lol
franzpoeschel Jul 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ set(CORE_SOURCE
src/Format.cpp
src/Iteration.cpp
src/IterationEncoding.cpp
src/LoadStoreChunk.cpp
src/Mesh.cpp
src/ParticlePatches.cpp
src/ParticleSpecies.cpp
Expand All @@ -419,6 +420,7 @@ set(CORE_SOURCE
src/version.cpp
src/auxiliary/Date.cpp
src/auxiliary/Filesystem.cpp
src/auxiliary/Future.cpp
src/auxiliary/JSON.cpp
src/auxiliary/JSONMatcher.cpp
src/auxiliary/Memory.cpp
Expand Down
12 changes: 12 additions & 0 deletions include/openPMD/Dataset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ namespace openPMD
using Extent = std::vector<std::uint64_t>;
using Offset = std::vector<std::uint64_t>;

/** Selection of a region of memory for storing chunks.
*
* Used to specify a non-contiguous memory region when storing
* data chunks. This allows writing data that is not contiguous
* in memory.
*/
struct MemorySelection
{
Offset offset;
Extent extent;
};

class Dataset
{
friend class RecordComponent;
Expand Down
62 changes: 59 additions & 3 deletions include/openPMD/Datatype.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,11 @@ inline size_t toBits(Datatype d)
return toBytes(d) * CHAR_BIT;
}

/** Check if a Datatype is a signed type
*
* @param d Datatype to test
* @return true if signed type (integer, floating point, complex), else false
*/
constexpr bool isSigned(Datatype d);

/** Compare if a Datatype is a vector type
Expand Down Expand Up @@ -602,6 +607,13 @@ inline bool isSameFloatingPoint(Datatype d)
return isSameFloatingPoint(d, determineDatatype<T_FP>());
}

/** Compare if two Datatypes are equivalent floating point types
*
* @param d1 First Datatype to compare
* @param d2 Second Datatype to compare
* @return true if both types are floating point and have same bitness, else
* false
*/
inline bool isSameFloatingPoint(Datatype d1, Datatype d2)
{
// template
Expand Down Expand Up @@ -629,6 +641,13 @@ inline bool isSameComplexFloatingPoint(Datatype d)
return isSameComplexFloatingPoint(d, determineDatatype<T_CFP>());
}

/** Compare if two Datatypes are equivalent complex floating point types
*
* @param d1 First Datatype to compare
* @param d2 Second Datatype to compare
* @return true if both types are complex floating point and have same bitness,
* else false
*/
inline bool isSameComplexFloatingPoint(Datatype d1, Datatype d2)
{
// template
Expand Down Expand Up @@ -656,6 +675,13 @@ inline bool isSameInteger(Datatype d)
return isSameInteger(d, determineDatatype<T_Int>());
}

/** Compare if two Datatypes are equivalent integer types
*
* @param d1 First Datatype to compare
* @param d2 Second Datatype to compare
* @return true if both types are integers, same signedness and same bitness,
* else false
*/
inline bool isSameInteger(Datatype d1, Datatype d2)
{
// template
Expand Down Expand Up @@ -708,13 +734,24 @@ constexpr bool isChar(Datatype d)
template <typename T_Char>
constexpr bool isSameChar(Datatype d);

/** Compare if two Datatypes are equivalent char types
*
* @param d1 First Datatype to compare
* @param d2 Second Datatype to compare
* @return true if both types are chars with same signedness and size, else
* false
*/
constexpr bool isSameChar(Datatype d1, Datatype d2);

/** Comparison for two Datatypes
*
* Besides returning true for the same types, identical implementations on
* some platforms, e.g. if long and long long are the same or double and
* long double will also return true.
*
* @param d First Datatype to compare
* @param e Second Datatype to compare
* @return true if the datatypes are equivalent
*/
constexpr bool isSame(openPMD::Datatype d, openPMD::Datatype e);

Expand All @@ -726,15 +763,34 @@ constexpr bool isSame(openPMD::Datatype d, openPMD::Datatype e);
*/
Datatype basicDatatype(Datatype dt);

/** Convert a scalar Datatype to its vector variant
*
* @param dt Scalar Datatype to convert
* @return Vector Datatype (e.g., INT becomes VEC_INT)
*/
Datatype toVectorType(Datatype dt);

/** Convert a Datatype to its string representation
*
* @param dt Datatype to convert
* @return String representation of the Datatype
*/
std::string datatypeToString(Datatype dt);

/** Convert a string to a Datatype
*
* @param s String representation of a Datatype
* @return The corresponding Datatype
*/
Datatype stringToDatatype(const std::string &s);

void warnWrongDtype(std::string const &key, Datatype store, Datatype request);

std::ostream &operator<<(std::ostream &, openPMD::Datatype const &);
/** Stream operator for Datatype
*
* @param os Output stream
* @param dt Datatype to output
* @return Reference to the stream
*/
std::ostream &operator<<(std::ostream &os, openPMD::Datatype const &dt);

template <typename T>
constexpr auto datatypeIndex() -> size_t
Expand Down
55 changes: 33 additions & 22 deletions include/openPMD/Datatype.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,36 +223,52 @@ namespace detail
template <typename T>
constexpr bool is_char_v = is_char<T>::value;

template <typename T_Char1, typename T_Char2>
inline bool isSameChar()
struct IsChar
{
return
// both must be char types
is_char_v<T_Char1> && is_char_v<T_Char2> &&
// both must have equivalent sign
std::is_signed_v<T_Char1> == std::is_signed_v<T_Char2> &&
// both must have equivalent size
sizeof(T_Char1) == sizeof(T_Char2);
template <typename T>
static constexpr bool call()
{
return is_char_v<T>;
}
template <size_t N>
static constexpr bool call()
{
return false;
}
};

constexpr inline bool isChar(Datatype dtype)
{
return switchType<IsChar>(dtype);
}

template <typename T1>
struct IsSameChar
struct DtypeSize
{
template <typename T2>
static bool call()
template <typename T>
static constexpr size_t call()
{
return isSameChar<T1, T2>();
return sizeof(T);
}

static constexpr char const *errorMsg = "IsSameChar";
static constexpr char const *errorMsg = "DtypeSize";
};

constexpr inline size_t dtypeSize(Datatype dtype)
{
return switchType<DtypeSize>(dtype);
}
} // namespace detail

template <typename T_Char>
constexpr inline bool isSameChar(Datatype d)
{
return switchType<detail::IsSameChar<T_Char>>(d);
return isSameChar(d, determineDatatype<T_Char>());
}

constexpr bool isSameChar(Datatype d1, Datatype d2)
{
return detail::isChar(d1) && detail::isChar(d2) &&
isSigned(d1) == isSigned(d2) &&
detail::dtypeSize(d1) == detail::dtypeSize(d2);
}

namespace detail
Expand Down Expand Up @@ -285,11 +301,6 @@ constexpr inline bool isSigned(Datatype d)
return switchType<detail::IsSigned>(d);
}

constexpr inline bool isSameChar(Datatype d, Datatype e)
{
return isChar(d) && isChar(e) && isSigned(d) == isSigned(e);
}

constexpr bool isSame(openPMD::Datatype const d, openPMD::Datatype const e)
{
return
Expand Down
4 changes: 4 additions & 0 deletions include/openPMD/IO/ADIOS/ADIOS2File.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/
#pragma once

#include "openPMD/Dataset.hpp"
#include "openPMD/IO/ADIOS/ADIOS2Auxiliary.hpp"
#include "openPMD/IO/ADIOS/ADIOS2PreloadAttributes.hpp"
#include "openPMD/IO/ADIOS/ADIOS2PreloadVariables.hpp"
Expand Down Expand Up @@ -107,11 +108,14 @@ struct WriteDataset
static void call(Params &&...);
};

/** Buffered put operation with unique pointer */
struct BufferedUniquePtrPut
{
std::string name;
Offset offset;
Extent extent;
/** Optional memory selection for non-contiguous memory regions */
std::optional<MemorySelection> memorySelection;
UniquePtrWithLambda<void> data;
Datatype dtype = Datatype::UNDEFINED;

Expand Down
28 changes: 20 additions & 8 deletions include/openPMD/IO/ADIOS/ADIOS2IOHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
#pragma once

#include "openPMD/Dataset.hpp"
#include "openPMD/Error.hpp"
#include "openPMD/IO/ADIOS/ADIOS2Auxiliary.hpp"
#include "openPMD/IO/ADIOS/ADIOS2FilePosition.hpp"
Expand All @@ -30,6 +31,7 @@
#include "openPMD/IO/AbstractIOHandler.hpp"
#include "openPMD/IO/AbstractIOHandlerImpl.hpp"
#include "openPMD/IO/AbstractIOHandlerImplCommon.hpp"
#include "openPMD/IO/AbstractIOHandler_internal.hpp"
#include "openPMD/IO/FlushParametersInternal.hpp"
#include "openPMD/IO/IOTask.hpp"
#include "openPMD/IO/InvalidatableFile.hpp"
Expand Down Expand Up @@ -509,6 +511,7 @@ class ADIOS2IOHandlerImpl
adios2::Variable<T> verifyDataset(
Offset const &offset,
Extent const &extent,
std::optional<MemorySelection> const &memorySelection,
adios2::IO &IO,
adios2::Engine &engine,
std::string const &varName,
Expand Down Expand Up @@ -622,13 +625,26 @@ class ADIOS2IOHandlerImpl
var.SetSelection(
{adios2::Dims(offset.begin(), offset.end()),
adios2::Dims(extent.begin(), extent.end())});

if (memorySelection.has_value())
{
var.SetMemorySelection(
{adios2::Dims(
memorySelection->offset.begin(),
memorySelection->offset.end()),
adios2::Dims(
memorySelection->extent.begin(),
memorySelection->extent.end())});
}

return var;
}

struct
{
bool noGroupBased = false;
bool blosc2bp5 = false;
bool memorySelection = false;
} printedWarningsAlready;
}; // ADIOS2IOHandlerImpl

Expand Down Expand Up @@ -942,7 +958,7 @@ class ADIOS2IOHandler : public AbstractIOHandler
try
{
auto params = internal::defaultParsedFlushParams;
this->flush(params);
this->flush_impl(params);
}
catch (std::exception const &ex)
{
Expand All @@ -962,9 +978,7 @@ class ADIOS2IOHandler : public AbstractIOHandler
#if openPMD_HAVE_MPI

ADIOS2IOHandler(
std::optional<std::unique_ptr<AbstractIOHandler>> initialize_from,
std::string path,
Access,
internal::AbstractIOHandlerInitFrom &&initialize_from,
MPI_Comm,
json::TracingJSON options,
std::string engineType,
Expand All @@ -973,9 +987,7 @@ class ADIOS2IOHandler : public AbstractIOHandler
#endif

ADIOS2IOHandler(
std::optional<std::unique_ptr<AbstractIOHandler>> initialize_from,
std::string path,
Access,
internal::AbstractIOHandlerInitFrom &&initialize_from,
json::TracingJSON options,
std::string engineType,
std::string specifiedExtension);
Expand All @@ -990,6 +1002,6 @@ class ADIOS2IOHandler : public AbstractIOHandler
return true;
}

std::future<void> flush(internal::ParsedFlushParams &) override;
std::future<void> flush_impl(internal::ParsedFlushParams &) override;
}; // ADIOS2IOHandler
} // namespace openPMD
28 changes: 28 additions & 0 deletions include/openPMD/IO/ADIOS/macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,34 @@
#define openPMD_HAVE_ADIOS2_BP5 0
#endif

namespace openPMD
{
namespace detail
{
/** Trait to check if a variable supports SetMemorySelection
*
* @tparam Variable ADIOS2 variable type
*/
template <typename Variable, typename SFINAE = void>
struct CanTheMemorySelectionBeReset
{
static constexpr bool value = false;
};

template <typename Variable>
struct CanTheMemorySelectionBeReset<
Variable,
decltype(std::declval<Variable>().SetMemorySelection())>
{
static constexpr bool value = true;
};
} // namespace detail

/** Whether ADIOS2 Variable supports SetMemorySelection */
constexpr bool CanTheMemorySelectionBeReset =
detail::CanTheMemorySelectionBeReset<adios2::Variable<int>>::value;
} // namespace openPMD

#else

#define openPMD_HAS_ADIOS_2_8 0
Expand Down
Loading
Loading