-
Notifications
You must be signed in to change notification settings - Fork 152
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
Reduce preempt stop time in stages #598
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #598 +/- ##
==========================================
- Coverage 58.82% 55.70% -3.12%
==========================================
Files 91 132 +41
Lines 8623 10796 +2173
Branches 0 901 +901
==========================================
+ Hits 5072 6013 +941
- Misses 3551 4736 +1185
- Partials 0 47 +47 ☔ View full report in Codecov by Sentry. |
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.
A std::function object is somewhat costly. What about using a direct pointer to the tasks's preempt_requested_
flag? Initially, that pointer will be NULL and the task's init function sets it.
4845f2d
to
ba841a9
Compare
I merged #597. Please rebase. |
ba841a9
to
d83d189
Compare
d83d189
to
e1febe7
Compare
Checked at the start of the StagePrivate::runCompute(). A callback must be issued, otherwise the stage/s cannot be preempted.
Forward Task::isPreempted() to all stages.
e1febe7
to
b8a0d2d
Compare
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.
Thanks for incorporating my suggestions. I have a few more.
Second wave of suggestions done. I think we should add a meaningful error message when throwing the PreemptStageException (if it throws somewhere e.g. in test units). Because I got something like this and did not know what it was at first glance: [ RUN ] CostTerm.SolutionConnected
unknown file: Failure
C++ exception with description "" thrown in the test body.
[ FAILED ] CostTerm.SolutionConnected (0 ms)
[ RUN ] CostTerm.SetLambdaCostTerm
unknown file: Failure
C++ exception with description "" thrown in the test body. |
Isn't the exception always caught in |
Yes when using the Task API. But when running some tests with only containers/mockups it may throw and no message is displayed. [ RUN ] GeneratorMockup.delayed
unknown file: Failure
C++ exception with description "std::exception" thrown in the test body.
[ FAILED ] GeneratorMockup.delayed (0 ms)
[ FAILED ] 1 test, listed below:
[ FAILED ] GeneratorMockup.delayed
...
[ FAILED ] 9 tests, listed below:
[ FAILED ] CostTerm.SolutionConnected
[ FAILED ] CostTerm.SetLambdaCostTerm
[ FAILED ] CostTerm.CostOverwrite
[ FAILED ] CostTerm.StageTypes
[ FAILED ] CostTerm.PassThroughUsesCost
[ FAILED ] CostTerm.PassThroughOverwritesCost
[ FAILED ] CostTerm.PassThroughCanModifyCost
[ FAILED ] CostTerm.CompositeSolutions
[ FAILED ] CostTerm.CompositeSolutionsContainerCost |
I cannot reproduce these results. As far as I can see, those tests don't call |
Yup. It happened to me because the preempted() function had bad logic initially. bool preempted() const { return !preempt_requested_ || *preempt_requested_); } |
This is a follow up to #597. To reduce time when preempting a task for each stages.
Stages now checks if there has been a preempt request before doing the
compute()
method. Let me know if there would be a cleaner way to achieve this.This does not preempt a stage that has already began the compute() method.