Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce more flexible storeChunk() syntax, use to add ADIOS2 memory selection #1620

Open
wants to merge 39 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
26de1a4
Remove explicit T[] loadChunk and storeChunk overload
franzpoeschel May 17, 2024
445bde7
Add class structure for LoadChunk
franzpoeschel May 17, 2024
79d60c3
use std::conditional_t
franzpoeschel May 17, 2024
1d29837
Implement storeChunkSpan()
franzpoeschel May 17, 2024
9549078
Remove accidentally compiled bool dataset store from Python APIs
franzpoeschel May 17, 2024
433f7a9
Implement for normal storeChunk()
franzpoeschel May 17, 2024
037eb70
StoreChunk completely moved over to new syntax
franzpoeschel May 17, 2024
5053444
Rename TypedConfigureStoreChunk -> ConfigureStoreChunkFromBuffer
franzpoeschel May 21, 2024
de83ec5
Implement memory selection in ADIOS2
franzpoeschel May 21, 2024
ae0ec91
Throw errors in JSON/HDF5 when supplying memory selection
franzpoeschel May 21, 2024
1d7cffd
Test memory selection
franzpoeschel May 21, 2024
4d1091d
Directly reset memory selection after applying
franzpoeschel May 22, 2024
2055bce
Rename in preparation for storeChunk adaptations
franzpoeschel May 22, 2024
a5531af
Prepare class structure for load_chunk
franzpoeschel May 22, 2024
96da02c
WIP loadChunk
franzpoeschel May 22, 2024
fa1ddba
Implement this for loadChunk
franzpoeschel May 22, 2024
0a21ab0
Test new loadChunk syntax
franzpoeschel May 22, 2024
181a253
Fix CI issues
franzpoeschel May 22, 2024
095ecdd
Add variant-based loadChunk
franzpoeschel May 24, 2024
e9319ed
Renaming
franzpoeschel May 24, 2024
0cdae96
Use another workaround for fixing the wrong lint
franzpoeschel Jun 24, 2024
7a6196c
Guard against memory selections in reading
franzpoeschel Jun 24, 2024
2e1a600
Some documentation and cleanup
franzpoeschel Jun 24, 2024
6a2a886
Frontend support for unique pointers with const value types
franzpoeschel Jun 24, 2024
ab64648
Workaround for annoying compilers that dont move
franzpoeschel Jun 25, 2024
ef1c443
Transform load calls to use std::future
franzpoeschel Jul 19, 2024
a61325f
Extract non-template members to ConfigureStoreChunkCore
franzpoeschel Jul 19, 2024
0cb6c8d
Some cleanup needed, but change class structure
franzpoeschel Jul 19, 2024
999e5be
WIP: Cleanup
franzpoeschel Jul 22, 2024
2269f3e
Same for store API
franzpoeschel Jul 22, 2024
c824501
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 22, 2024
eec6aed
Use own wrapper class DeferredFuture
franzpoeschel Jul 22, 2024
f0c8652
Avoid wrong warnings
franzpoeschel Jul 22, 2024
a1382f4
Type hints for old compilers' benefit
franzpoeschel Jul 22, 2024
e0f7285
Fixes
franzpoeschel Jul 22, 2024
1fe4534
Fix rebasing error
franzpoeschel Jul 23, 2024
bd7b378
Don't use std::packaged_task
franzpoeschel Aug 1, 2024
e5e06e5
Add a bit more verbose output
franzpoeschel Sep 4, 2024
208c381
Add missing future return type
franzpoeschel Sep 4, 2024
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 @@ -456,6 +456,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 @@ -467,6 +468,7 @@ set(CORE_SOURCE
src/WriteIterations.cpp
src/auxiliary/Date.cpp
src/auxiliary/Filesystem.cpp
src/auxiliary/Future.cpp
src/auxiliary/JSON.cpp
src/auxiliary/Mpi.cpp
src/backend/Attributable.cpp
Expand Down
6 changes: 6 additions & 0 deletions include/openPMD/Dataset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ namespace openPMD
using Extent = std::vector<std::uint64_t>;
using Offset = std::vector<std::uint64_t>;

struct MemorySelection
{
Offset offset;
Extent extent;
};

class Dataset
{
friend class RecordComponent;
Expand Down
3 changes: 2 additions & 1 deletion include/openPMD/Datatype.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ template <typename T>
inline constexpr Datatype determineDatatype(T &&val)
{
(void)val; // don't need this, it only has a name for Doxygen
using T_stripped = std::remove_cv_t<std::remove_reference_t<T>>;
using T_stripped =
std::remove_extent_t<std::remove_cv_t<std::remove_reference_t<T>>>;
if constexpr (auxiliary::IsPointer_v<T_stripped>)
{
return determineDatatype<auxiliary::IsPointer_t<T_stripped>>();
Expand Down
3 changes: 3 additions & 0 deletions include/openPMD/IO/ADIOS/ADIOS2File.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
*/
#pragma once

#include "openPMD/Dataset.hpp"
#include "openPMD/IO/ADIOS/ADIOS2Auxiliary.hpp"
#include "openPMD/IO/AbstractIOHandler.hpp"
#include "openPMD/IO/IOTask.hpp"
#include "openPMD/IO/InvalidatableFile.hpp"
#include "openPMD/config.hpp"
#include <optional>

#if openPMD_HAVE_ADIOS2
#include <adios2.h>
Expand Down Expand Up @@ -106,6 +108,7 @@ struct BufferedUniquePtrPut
std::string name;
Offset offset;
Extent extent;
std::optional<MemorySelection> memorySelection;
UniquePtrWithLambda<void> data;
Datatype dtype = Datatype::UNDEFINED;

Expand Down
16 changes: 16 additions & 0 deletions include/openPMD/IO/ADIOS/ADIOS2IOHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
*/
#pragma once

#include "openPMD/Dataset.hpp"
#include "openPMD/Error.hpp"
#include "openPMD/IO/ADIOS/ADIOS2Auxiliary.hpp"
#include "openPMD/IO/ADIOS/ADIOS2FilePosition.hpp"
#include "openPMD/IO/ADIOS/macros.hpp"
#include "openPMD/IO/AbstractIOHandler.hpp"
#include "openPMD/IO/AbstractIOHandlerImpl.hpp"
#include "openPMD/IO/AbstractIOHandlerImplCommon.hpp"
Expand Down Expand Up @@ -426,6 +428,7 @@ class ADIOS2IOHandlerImpl
adios2::Variable<T> verifyDataset(
Offset const &offset,
Extent const &extent,
std::optional<MemorySelection> const &memorySelection,
adios2::IO &IO,
std::string const &varName)
{
Expand Down Expand Up @@ -507,13 +510,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
20 changes: 20 additions & 0 deletions include/openPMD/IO/ADIOS/macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,26 @@
#define openPMD_HAVE_ADIOS2_BP5 0
#endif

namespace detail
{
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

constexpr bool CanTheMemorySelectionBeReset =
detail::CanTheMemorySelectionBeReset<adios2::Variable<int>>::value;

#else

#define openPMD_HAS_ADIOS_2_8 0
Expand Down
2 changes: 2 additions & 0 deletions include/openPMD/IO/IOTask.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <cstddef>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <variant>
Expand Down Expand Up @@ -436,6 +437,7 @@ struct OPENPMDAPI_EXPORT Parameter<Operation::WRITE_DATASET>

Extent extent = {};
Offset offset = {};
std::optional<MemorySelection> memorySelection = std::nullopt;
Datatype dtype = Datatype::UNDEFINED;
auxiliary::WriteBuffer data;
};
Expand Down
Loading
Loading