-
Notifications
You must be signed in to change notification settings - Fork 51
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
Random-access for variable-based encoding (i.e. use SetStepSelection for ADIOS2 steps) #1706
Changes from all commits
1e4976f
559a97e
d561662
9e8a590
eee83f6
5a780a9
d9d1657
a3cabdd
f8a9e19
7353439
926581e
0da9a01
432fe2e
1c230e1
544e765
547546c
313b9a0
30fe9b3
e535762
185d023
02a4fd4
126664c
182da14
c2e2b2b
9c6f4aa
1794b3a
3c95b2c
dce876e
816ae26
29f6403
ffd887d
e15ab8c
b9158a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -26,13 +26,14 @@ | |||||
#include "openPMD/Streaming.hpp" | ||||||
#include "openPMD/auxiliary/Export.hpp" | ||||||
#include "openPMD/auxiliary/Memory.hpp" | ||||||
#include "openPMD/auxiliary/TypeTraits.hpp" | ||||||
#include "openPMD/auxiliary/Variant.hpp" | ||||||
#include "openPMD/backend/Attribute.hpp" | ||||||
#include "openPMD/backend/ParsePreference.hpp" | ||||||
|
||||||
#include <cstddef> | ||||||
#include <map> | ||||||
#include <memory> | ||||||
#include <optional> | ||||||
#include <string> | ||||||
#include <utility> | ||||||
#include <variant> | ||||||
|
@@ -72,6 +73,7 @@ OPENPMDAPI_EXPORT_ENUM_CLASS(Operation){ | |||||
DELETE_ATT, | ||||||
WRITE_ATT, | ||||||
READ_ATT, | ||||||
READ_ATT_ALLSTEPS, | ||||||
LIST_ATTS, | ||||||
|
||||||
ADVANCE, | ||||||
|
@@ -602,6 +604,38 @@ struct OPENPMDAPI_EXPORT Parameter<Operation::READ_ATT> | |||||
std::make_shared<Attribute::resource>(); | ||||||
}; | ||||||
|
||||||
template <> | ||||||
struct OPENPMDAPI_EXPORT Parameter<Operation::READ_ATT_ALLSTEPS> | ||||||
: public AbstractParameter | ||||||
{ | ||||||
Parameter() = default; | ||||||
Parameter(Parameter &&) = default; | ||||||
Parameter(Parameter const &) = default; | ||||||
Parameter &operator=(Parameter &&) = default; | ||||||
Parameter &operator=(Parameter const &) = default; | ||||||
|
||||||
std::unique_ptr<AbstractParameter> to_heap() && override | ||||||
{ | ||||||
return std::unique_ptr<AbstractParameter>( | ||||||
new Parameter<Operation::READ_ATT_ALLSTEPS>(std::move(*this))); | ||||||
} | ||||||
|
||||||
std::string name = ""; | ||||||
std::shared_ptr<Datatype> dtype = std::make_shared<Datatype>(); | ||||||
|
||||||
struct to_vector_type | ||||||
{ | ||||||
template <typename T> | ||||||
using type = std::vector<T>; | ||||||
}; | ||||||
// std::variant<std::vector<T_1>, std::vector<T_2>, ...> | ||||||
// for all T_i in openPMD::Datatype. | ||||||
using result_type = typename auxiliary::detail:: | ||||||
map_variant<to_vector_type, Attribute::resource>::type; | ||||||
|
||||||
std::shared_ptr<result_type> resource = std::make_shared<result_type>(); | ||||||
}; | ||||||
|
||||||
template <> | ||||||
struct OPENPMDAPI_EXPORT Parameter<Operation::LIST_ATTS> | ||||||
: public AbstractParameter | ||||||
|
@@ -638,10 +672,23 @@ struct OPENPMDAPI_EXPORT Parameter<Operation::ADVANCE> | |||||
new Parameter<Operation::ADVANCE>(std::move(*this))); | ||||||
} | ||||||
|
||||||
//! input parameter | ||||||
AdvanceMode mode; | ||||||
struct StepSelection | ||||||
{ | ||||||
std::optional<size_t> step; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please include There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, I've also removed an unused |
||||||
}; | ||||||
|
||||||
// input parameters | ||||||
/** | ||||||
* AdvanceMode: Is one of BeginStep/EndStep. Used during writing and in | ||||||
* linear read mode to step sequentially through steps. | ||||||
* StepSelection: Used in random-access read mode, jump to the specified | ||||||
* step. Can be nullopt in order to reset the backend to read | ||||||
* step-agnostically, e.g. for reading global datasets such as | ||||||
* /rankTable. | ||||||
*/ | ||||||
std::variant<AdvanceMode, StepSelection> mode; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe good to add an inline comment here of the form:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||||||
bool isThisStepMandatory = false; | ||||||
//! output parameter | ||||||
// output parameter | ||||||
std::shared_ptr<AdvanceStatus> status = | ||||||
std::make_shared<AdvanceStatus>(AdvanceStatus::OK); | ||||||
}; | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix:
return m_engineType == "bp5"
, BP4 does not support modifiable attributes, I thinkThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does