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

(O2-1203) [CTF] use merging/splitting iterators during CTF ecoding/decoding for TPC #5199

Merged
merged 5 commits into from Jan 15, 2021

Conversation

MichaelLettrich
Copy link
Collaborator

  • Refactor o2::tpc::CTFCoder to use merging/splitting iterators from o2::rans::utils. This avoids storing intermediate vectors and removes two copy operations per merged/ splitted element and should visibly improve performance in CTF creation.
  • Refactor EncodedBlocks to remove artificial restriction to pointers and use iterators instead
  • Refactor CombinedInputIterator and CombinedOutputIterator to make it usable in real world applications
  • Small bugfixes and improvements wherever appropriate

@shahor02
Copy link
Collaborator

@MichaelLettrich thanks, I've tested it on 200 pbpb events TF, works fine with the same output size as before. It is marked as WIP, do you have other stuff to commit?

@MichaelLettrich
Copy link
Collaborator Author

@shahor02 thanks for testing. Feature complete but needs some cleanups in the git history. Opened it as WIP to see if formatting was OK. Will remove WIP and ask for review once git cleanup is done.

* `CombinedInputIterator` has to be bidirectional since rANS encoder reads backwards.
* `CombinedInputIterator` has to be default constructable. Dereferencing it is undefined behaviour though.
* Adjust Encoders to work with bidirectional iterators
* `tpc::CTFCoder` uses `CombinedInputIterator` to avoid a temporary
vector and elides 2 copies
* `tpc::CTFCoder` uses lambdas and type_traits instead of macros to
avoid incomprehensible compiler errors
* `ctf::EncodedBlocks` remove deref of past-the-end-iterator which is
undefined behaviour
* Unit tests use merged columns

add iterator

TPC makeInputIterators

replace makecoder macro

replace ENCODETPC macro with lambda

fix undefined behaviour
* `CombinedOutputIterator` needs to set `value_type` correctly to work with `iterator_traits`. This needs to be passed upon instantiation as a template parameter and cannot be auto-deduced.
* `ComninedOutputIterator` fix bug with std::tie caused by returning `ComninedOutputIterator::Proxy` by value when dereferencing the iterator.
* `CombinedOutputIteratorFactory` simplifies construction of `CombinedOutputIterator` instances.
* `EncodedBlocks` allow more general iterators in decoder methods
* `CTFCoder` use `CombinedOutpurIterator` when decoding merged columns
to elide a temporary vector and two copies per element.
* `CTFCoder` use functions instead of preprocessor macros for decoding
for better compiler error messages
* Use `std::enable_if` type trait for compile-time type checks if
iterator holds correct value type
@MichaelLettrich MichaelLettrich changed the title [WIP] (O2-1203) [CTF] use merging/splitting iterators during CTF ecoding/decoding for TPC (O2-1203) [CTF] use merging/splitting iterators during CTF ecoding/decoding for TPC Jan 15, 2021
@MichaelLettrich
Copy link
Collaborator Author

@shahor02. Should be good for review now. Can you have a look?

Copy link
Collaborator

@shahor02 shahor02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MichaelLettrich already did and tested, thanks. Will merge once tests are passed

@shahor02 shahor02 merged commit 886a351 into AliceO2Group:dev Jan 15, 2021
@MichaelLettrich
Copy link
Collaborator Author

@shahor02 thanks a lot 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants