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

Refactor future implementation #4270

Merged
merged 18 commits into from Apr 6, 2020
Merged

Conversation

aurianer
Copy link
Contributor

@aurianer aurianer commented Dec 9, 2019

Add the futures files inside the execution module

  • Remove some dependencies
  • Move thread_timed_execution.hpp back in hpx/parallel/executors to avoid a circular dependency between the execution and local_lcos module

Goes on top of #4247

@aurianer aurianer added this to the 1.5.0 milestone Dec 9, 2019
@aurianer aurianer added this to TODO in HPX modularization via automation Dec 9, 2019
@aurianer aurianer force-pushed the module_futures branch 3 times, most recently from b16a8e4 to ed1ac69 Compare December 9, 2019 17:25
@hkaiser
Copy link
Member

hkaiser commented Dec 9, 2019

I'm not sure if this is the right granularity. In comparison with the other modules this one seems to be very large. I think the future type itself belongs into the local_lcos module (with the exception for the future_data<id_type> specialization). This would allow to step by step move things like (local) async into their own modules. For the component related files - I think we first should extract the file related to actions and AGAS, and only afterwards anything related to components. Actions and AGAS are unfortunately inseparable, but components can be built on top of those (I think).

@aurianer
Copy link
Contributor Author

aurianer commented Dec 10, 2019

I'm not sure if this is the right granularity. In comparison with the other modules this one seems to be very large. I think the future type itself belongs into the local_lcos module (with the exception for the future_data<id_type> specialization). This would allow to step by step move things like (local) async into their own modules. For the component related files - I think we first should extract the file related to actions and AGAS, and only afterwards anything related to components. Actions and AGAS are unfortunately inseparable, but components can be built on top of those (I think).

  • The first thing is that the futures and the execution traits are very tight together so they kind of belong together, and putting futures in local_lcos would create a circular dependency between execution and local_lcos
  • Concerning the fact that this module is too big, I totally agree for now but we planned to put the executors in their own module and deprecate the execution/parallel/traits/detail/vc/ files. So at the end I would think the size is fine, what do you think ?
  • Last thing, I'm not sure I understand your reference to the component related files cause I'm not doing anything related to that in this PR ^^

@aurianer aurianer force-pushed the module_futures branch 3 times, most recently from 00e2569 to 334301b Compare December 13, 2019 14:56
@hkaiser
Copy link
Member

hkaiser commented Dec 13, 2019

  • The first thing is that the futures and the execution traits are very tight together so they kind of belong together, and putting futures in local_lcos would create a circular dependency between execution and local_lcos

I believe we can break this circular dependency by moving only the basic future to local_lcos, leaving all things related to executors separated in the executors module. This involves separating the template specialization for executors into a separate file, however.

  • Concerning the fact that this module is too big, I totally agree for now but we planned to put the executors in their own module and deprecate the execution/parallel/traits/detail/vc/ files. So at the end I would think the size is fine, what do you think ?

ok

  • Last thing, I'm not sure I understand your reference to the component related files cause I'm not doing anything related to that in this PR ^^

Please ignore this comment, I did misunderstand what you were doing here.

@msimberg
Copy link
Contributor

I believe we can break this circular dependency by moving only the basic future to local_lcos, leaving all things related to executors separated in the executors module. This involves separating the template specialization for executors into a separate file, however.

Good point. How much of future do you think we can move to local_lcos though? Do you specifically mean future_base (the is_future etc. traits are ok too)? The implementations of future and shared_future eventually need the executor then customization point and launch policies, which are both undoubtedly execution-y. packaged_continuation definitely needs the execution module. Do you see a way to fully define hpx::future in local_lcos without depending on the the execution module? Templating future and shared_future on those implementation details is definitely one possibility but that will show up in the types (don't know if that's a bad thing).

@aurianer aurianer force-pushed the module_futures branch 3 times, most recently from 39e39eb to 028a161 Compare December 19, 2019 10:17
@aurianer aurianer force-pushed the module_futures branch 4 times, most recently from 4d77d68 to c21d84b Compare January 28, 2020 15:34
@msimberg msimberg requested a review from hkaiser January 29, 2020 13:38
@msimberg
Copy link
Contributor

@hkaiser this is still slightly in progress, but I think the general changes required for the future/execution are in place and your feedback on it would be appreciated.

HPX modularization automation moved this from TODO to In Progress Jan 29, 2020
hkaiser
hkaiser previously approved these changes Jan 29, 2020
Copy link
Member

@hkaiser hkaiser left a comment

Choose a reason for hiding this comment

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

Very nice, thanks a lot!

@msimberg
Copy link
Contributor

msimberg commented Apr 1, 2020

It looks like this is working quite well with decltype(auto) now (the GitHub Actions builders are over at @aurianer's fork, but they seem to be building this just fine also on Windows). The pycicle builder just needs to have that one header fixed. @hkaiser are you happy with this solution (assuming the test results end up greenish)?

@msimberg
Copy link
Contributor

msimberg commented Apr 2, 2020

I suggest we go ahead with this as it is. It might still need some cleanup but exactly what to clean up will be more apparent once files get moved to their modules, which would be the next step.

To eliminate a circular dependency between local_lcos and the
execution module. We include now thread_timed_executors inside
the global executor include
The goal is to move the template specialization related to the
executors into the execution module, the first step is to separate
them but keep it in the same file
We move the template specializations related to the executors.
Change the future.hpp include to the future_exec.hpp one when
necessary.
We remove the dependency to executors and launch_policy.
To move the dependency to executors.
In order to avoid an additional call
It uses a future_serialize, that can send exception, we get errors
without this include (the exception cannot be serialized).
@aurianer
Copy link
Contributor Author

aurianer commented Apr 2, 2020

I just rebased this :)

Copy link
Member

@hkaiser hkaiser left a comment

Choose a reason for hiding this comment

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

LGTM, let's go ahead with this. There are still some minor questions whether we can further clean up this code, but we can do it over time. Thanks Auriane!

@msimberg msimberg merged commit 1d221a2 into STEllAR-GROUP:master Apr 6, 2020
HPX modularization automation moved this from In Progress to Done Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants