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

[FEATURE] Forward call of indexed sequence pairs to alignment algorithm. #1358

Conversation

rrahn
Copy link
Contributor

@rrahn rrahn commented Nov 5, 2019

fixes #1357

@rrahn rrahn requested a review from eseiler November 5, 2019 15:09
@codecov
Copy link

codecov bot commented Nov 5, 2019

Codecov Report

Merging #1358 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1358      +/-   ##
==========================================
+ Coverage   97.48%   97.49%   +<.01%     
==========================================
  Files         218      218              
  Lines        8680     8689       +9     
==========================================
+ Hits         8462     8471       +9     
  Misses        218      218
Impacted Files Coverage Δ
...airwise/execution/execution_handler_sequential.hpp 100% <100%> (ø) ⬆️
.../pairwise/execution/execution_handler_parallel.hpp 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e83bfef...25d9152. Read the comment docs.

Copy link
Member

@eseiler eseiler left a comment

Choose a reason for hiding this comment

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

LGTM

Is the parallel handler's execute tested somewhere?

@rrahn rrahn requested a review from smehringer November 5, 2019 20:27
@rrahn
Copy link
Contributor Author

rrahn commented Nov 5, 2019

@eseiler the parallel handler is tested. But you are right I did not add a concrete test for this, but I should I guess within the tasks we said not to test yet. But I guess here I can.

@rrahn rrahn force-pushed the feature/range_interface_for_parallel_execution_handler branch from 04f7143 to df7729b Compare November 5, 2019 22:49
@rrahn
Copy link
Contributor Author

rrahn commented Nov 5, 2019

@eseiler now it is tested 😉

Copy link
Member

@smehringer smehringer left a comment

Choose a reason for hiding this comment

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

mostly questions

* \param[in] delegate A callable which will be invoked on each result of the computed alignments.
*/
template <typename algorithm_t, indexed_sequence_pair_range indexed_sequence_pairs_t, typename delegate_type>
void execute(algorithm_t && algorithm,
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this always a specialisation of seqan3::alignment_algorithm? Or is this a policy?
Sorry for always picking on your types, but I always stumble about this when trying to understand what's happening.

I also do not understand what a delegate is (for).. 🙈

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the algorithm that is supposed to be called by the execution handler. That can be basically anything that is invocable, so it was called fn_t for function before. Since it is only used in the context of executing alignment algorithms it is now refined to be a more specific in the name.

Copy link
Member

Choose a reason for hiding this comment

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

Then maybe add the comment, that it must model callable ?

Copy link
Member

Choose a reason for hiding this comment

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

And what is the delegate thing ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then maybe add the comment, that it must model callable ?

I will have another invocable concept for this after all the open PRs with these changes are mereged. Then I can make sure that this works. Is that ok?

Ah and a delegate is another callable that is called on the result of the alignment algorithm. The term is a standard term for something that should be called on the result of something without jumping out of the process (as opposed to coroutines). https://stackoverflow.com/questions/9568150/what-is-a-c-delegate

Copy link
Member

Choose a reason for hiding this comment

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

I will have another invocable concept for this after all the open PRs with these changes are mereged. Then I can make sure that this works. Is that ok?

Sure.

Ah and a delegate is another callable that is called on the result of the alignment algorithm. The term is a standard term for something that should be called on the result of something without jumping out of the process (as opposed to coroutines). https://stackoverflow.com/questions/9568150/what-is-a-c-delegate

Ok, and what is the purpose of this here/what is the use case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have two interfaces for dealing with alignment results. The first one results a alignment result range and the second calls a user defined delegate on the result. Accordingly, there are two executors. The two way which we already know and the one way which will not implement the buffering. So both of them reuse the execution handlers which just get a delegate to call the alignment result on. The two way just passes a lambda that moves the result into the correct buffer location.

* \tparam delegate_type The type of the callable invoked on the std::invoke_result of `algorithm_t`.
*
* \param[in] algorithm The alignment algorithm to invoke.
* \param[in] indexed_sequence_pairs The range of underlying annotated sequence pairs to be aligned.
Copy link
Member

Choose a reason for hiding this comment

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

You say range here but copy. Do you assume that this copy is cheap? Is it a view?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, so it expects always a range.
It never uses the range as a lvalue reference because it executes the alignments asynchronously and want's to make sure that another thread is not modifying this reference. And in the implementation we actually pass in a rvalue view so that nothing is expensive in this context.

Copy link
Member

@smehringer smehringer Nov 7, 2019

Choose a reason for hiding this comment

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

Ok. If you always pass a view in our context we might want to constrain this?
But no strong feelings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, the interface does not care really. It just takes a copy of whatever comes in. Just we use it by passing in a view which is lightweight. The only constraint I might add here is that the type is move constructible since afterwards we move it around.


TYPED_TEST_CASE_P(execution_handler);

TYPED_TEST_P(execution_handler, execute_w_lvalue)
Copy link
Member

Choose a reason for hiding this comment

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

what is a w_lvalue?

EDIT: Do you mean with? 😆 please be expressive in the tests 😇

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes it is supposed to read with.

@rrahn rrahn force-pushed the feature/range_interface_for_parallel_execution_handler branch from df7729b to 25d9152 Compare November 7, 2019 15:20
@rrahn rrahn requested a review from smehringer November 7, 2019 15:20
@rrahn rrahn requested a review from smehringer November 8, 2019 09:38
@smehringer smehringer merged commit ca6dd02 into seqan:master Nov 12, 2019
@rrahn rrahn deleted the feature/range_interface_for_parallel_execution_handler branch January 16, 2020 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

### Range awareness - level2
3 participants