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
Generic client #1641
Generic client #1641
Conversation
This PR depends on merging #1640 first. |
Could you please rebase this PR against current master? It is very hard to review it with the changes of #1640 in between. |
{} | ||
explicit client(naming::id_type && gid) | ||
: base_type(lcos::make_ready_future(std::move(gid))) | ||
{} |
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.
would it make sense here to disable the id_type
constructors taking the component id and instead create a forwarding constructor, which takes the locality id and the constructor arguments?
Looks good to me. In addition, this goes into the direction of what I proposed here: We might want to continue the discussion about future directions after this has been merged. |
I'd prefer continuing the discussion before merging. Let's do it right in the first place. |
b906aa5
to
7e2888b
Compare
- renamed all functions `id_type get_gid()` to `get_id` - applied backwards compatibility flag `HPX_HAVE_COMPONENT_GET_GID_COMPATIBILITY` to temporarily still support `get_gid`
- adding generic components::client<> facility - move extract_action to traits - extract launch_policy into separate header - adding overloads for async and async_cb taking clients - cleaning up headers included by async and async_cb - added traits::is_valid_action
dc36649
to
0f46e9b
Compare
- fixing rebase conflicts - flyby make_client --> make_clients for version which returns more than one
- removing obsolete prototype
Fair point. The difference to regular futures is that we need the client to
Depends on how we define it. What we do is implicit unwrapping of the
I absolutely agree, that's the reason why I think it should expose the
... once id_type is removed this problem goes away automatically. We only |
For what? There are no semantic differences between future<id_type> and any client (at least that's the idea). At some point I was even considering to derive |
That error handling wouldn't be different from the error handling proposed by this PR: let the user deal with any exceptions. |
I'm not sure we should let
(even if this currently would compile and work properly). I'd rather have it explicit:
which already compiles and works as well. In the end it's a matter of documentation and converting all code to this scheme. In plain C++ you can always write:
so why shouldn't we allow for
? |
We need the future to be ready to know the target where to invoke the |
This looks correct to me though. You are allocating a component and get a
This IMHO is confusing. You are not creating the client but the component.
To enforce strong typing. If you really want that though I'd rather suggest |
Guess that's just a documentation issue in any case... That is the user |
Thomas, I think we're talking about different things here. We have two different use cases: (1) Use a (2) Use any Could you explain again where you see inconsistencies? |
Ok. I'm almost impartial to this.
That's what we have right now:
and
I'm not opposed to changing this in any way we can reach consensus on, but I believe this is outside the scope of this PR. |
I like this idea. |
Inconsistency might have been too strong. My point is that this adds |
Well, we derailed a bit, but answering those questions might affect further |
Hmmm, do I remember correctly that it was you proposing to implement direct support in async for using clients as targets (including static_asserts ensuring type safety)? What do you suggest now? To remove this again? |
No! This is not an implementation detail. This is part of the API and their semantics.
I'm still not convinced this to be a good idea. As said above, this would make code using them overly complex and would enforce an (implicit) barrier onto any use of clients. |
You remember correctly, I'm still in favor for that. We absolutely agree, I What would a user expect? |
Not if the futurization would happen behind the scene... I understand |
@sithhell I added implicit futurization for using client_base with async. Is that what you had in mind? |
return hpx::detail::async_impl<Action>(launch_policy, c.get_id(), | ||
std::forward<Ts>(ts)...); | ||
// invoke directly if client is ready | ||
if (c.is_ready()) |
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.
Can't this be part of the client_base::then
implementation?
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.
It's an optimization which avoids creating a future<future<>>
for the sole purpose of unwrapping it right away. So yes, we could simply call .then()
unconditionally if we didn't care about this overhead.
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.
What I meant is to have this optimization directly in client_base. I was under the impression we had the same we have for future<T>::then
... the only optimization we in that regard is here: https://github.com/STEllAR-GROUP/hpx/blob/master/hpx/lcos/detail/future_data.hpp#L565
I missed the part that we need to create a new future inside ::then ... sorry for the noise.
@hkaiser yes, this is what I had in mind. Specifically one could hide it behind a trait that looks something like this:
Note, please see the names That being said, I think we mostly agree on all parts and can move on here. |
@sithhell I tried that. Such a trait wouldn't work for distribution policies (for instance |
Why not? What problem did you run into? |
The |
Ok, why do we want to include the distribution policies into this class? |
Well, conceptually those belong into the overload set of such a trait as well. Otherwise you'd have to still dispatch to the trait for 'good' types and have a separate code path for distribution policies. |
[07:22] hkaiser: heller: what about if we go ahead with the PR as is and look at future refactorings separately? |
Cleaning up client object implementation …