-
Notifications
You must be signed in to change notification settings - Fork 444
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
DPL I/O API: Supporting spectator vector as return for InputRecord::get<std::vector<T>> #2697
DPL I/O API: Supporting spectator vector as return for InputRecord::get<std::vector<T>> #2697
Conversation
Once the worker code is changed to use spans, there is of course also an option to use |
@@ -516,6 +523,7 @@ class InputRecord | |||
private: | |||
std::vector<InputRoute> const& mInputsSchema; | |||
InputSpan mSpan; | |||
std::vector<std::unique_ptr<boost::container::pmr::memory_resource>> mSpectatorResources; |
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.
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.
Nevermind the FairMQ message does not know the type...
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.
We have been playing with some ideas at FairMQLevel (see e.g. FairRootGroup/FairMQ#110). btw, the resource does not need to know the type, it is meant to allocate bytes only.
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.
i mean not only, but bytes is enough :)
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.
Ah, I missed resourcebuffer was just "char".
For the record, this PR is fine for me, but I really think we should use |
or even the ranges_v3 api... |
86a3732
to
ae5e312
Compare
ae5e312
to
a17fe64
Compare
4885c38
to
5612d23
Compare
A quick update: meanwhile many of the workflows have been adjusted to use spans for the read-only arrays of messageable objects. The span is either retrieved directly from the The second approach can handle both unserialized data and serialized data, while retrieving The only remaining code to adjust is the TPC CA Tracker now. There the buffering functionality needs to be adjusted. |
Is this still needed? |
This PR did not have any update in the last 30 days. Is it still needed? Unless further action in will be closed in 5 days. |
5612d23
to
f6f0937
Compare
f6f0937
to
7346e28
Compare
finally only requiring #3819 to be merged |
Changing API for InputRecord::get<std::vector<T>> Return type changed to vector<T const, o2::pmr::SpectatorAllocator<T const>> A spectator vector for unserialized messages of messageable type is created using the raw input memory without copy. Depending on the serialization method of the incoming message, the spectator vector is created with raw memory of the message or the deserialized object as underlying resource A unique instance of the spectator memory resource is kept in the InputRecord and valid for the lifetime of the record.
7346e28
to
8a56867
Compare
I'm opening a new PR in order to discuss this topic even though it depends on the commit in #2617
When querying vectors, a spectator vactor is returned which is directly using
the raw memory without copy using polymorphic allocator and spectator memory
resource. A unique instance of the spectator memory resource is kept in the
InputRecord and valid for the lifetime of teh record.
This changes the return type to
vector<T const, o2::pmr::SpectatorAllocator<T const>>
and thus breaks compilation in code where the vector with standard allocator is used.
This is not problematic in cases where the returned instance is only used in the
function itself and not passed onto workers (unless in a templatized function call).
Ways out of this problem:
change access to the read-only input data objects in the worker classes
function use iterators
Pros and cons:
option 1) (+) can implement flexible code
(-) many of the classes use member variables to hold the
data which are set in advance, implementation must be in the header
this is more an option for small algorithms
option 2) (+) we introduce a data object which can be used system wide
(-) while suitable for the workflow implementations and everything which
is related to messaging in DPL, the worker classes should be kept more
general in order to be used standalone with little overhead
option 3) (+) generic solution
(-) no cons