-
-
Notifications
You must be signed in to change notification settings - Fork 428
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
Change existing symbol_namespace::iterate to return all data instead of invoking a callback #3072
Conversation
…th AGAS - this depends on STEllAR-GROUP/hpx#3072
…th AGAS - this depends on STEllAR-GROUP/hpx#3072
// Reuse functionaliy from perf-counters | ||
namespace hpx { namespace performance_counters { namespace detail | ||
{ | ||
HPX_EXPORT std::string regex_from_pattern(std::string const& pattern, |
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.
Wouldn't it make sense to move this into hpx::util
?
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.
Yah, may make sense to do that - but that's unrelated to the current PR.
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.
Someone once told me that nothing is more permanent than a temporary solution ;)
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.
I have not added any temporary solutions. I used what was there for years already.
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 the temporary solution of pulling in the performance counters here for a utility function that is in itself unrelated to both performance counters and symbol namespace.
return ids; | ||
} | ||
} | ||
|
||
/// Invoke the supplied hpx::function for every registered global name |
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.
This comment should be fixed. There is no function involved there anymore.
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.
Good catch, will fix.
0ea2ea3
to
5219aff
Compare
…th AGAS - this depends on STEllAR-GROUP/hpx#3072 - add an example demonstrating adding and accessing debug information to primitive instances
@sithhell could we go ahead with this, please? |
…of invoking a callback
5219aff
to
c38c6dc
Compare
…th AGAS - this depends on STEllAR-GROUP/hpx#3072 - add an example demonstrating adding and accessing debug information to primitive instances
…th AGAS - this depends on STEllAR-GROUP/hpx#3072 - add an example demonstrating adding and accessing debug information to primitive instances
…th AGAS - this depends on STEllAR-GROUP/hpx#3072 - add an example demonstrating adding and accessing debug information to primitive instances
…th AGAS - this depends on STEllAR-GROUP/hpx#3072 - add an example demonstrating adding and accessing debug information to primitive instances
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.
In principle the code is ok. After thinking a while about it, I'm sceptical about scalability since all symbols are now collected into a single place. This sounds like quite some overhead for just iterating the registered names.
When looking at the use case in phylanx, I think this might be solved more efficiently by calculating the symbolic names from the ast, and use those to resolve the gids. This has the additional advantage that the number of localities to broadcast to is reduced.
if (!boost::regex_match(it->first, rx)) | ||
continue; | ||
found[it->first] = | ||
naming::detail::split_gid_if_needed(*(it->second)).get(); |
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.
The lock needs to be unlocked here due to a potential remote operation.
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.
Good point.
if (!pattern.empty() && pattern != it->first) | ||
continue; | ||
found[it->first] = | ||
naming::detail::split_gid_if_needed(*(it->second)).get(); |
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.
Same here
Well, if you need all symbols in one place you should collect them there, no?
Could you elaborate? I don't think I understand what you're after. |
Sure, what I am questioning though is if you really need all in one place.
The parser is creating the AST nodes with specific names which are then registered in the symbolic namespace. Giving that you have the AST, it should be trivial to extract the names of the different nodes by a simple tree traversal. Once you have a list of the names, you can calculate which service instance is responsible for the each name and send out bulk requests to only those instances of the symbolic namespace server to resolve the GID. That is, you shouldn't need the symbolic namespace service to get all names associated with the AST. |
|
||
namespace hpx { namespace util | ||
{ | ||
HPX_EXPORT std::string regex_from_pattern(std::string const& pattern, |
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! Much appreciated!
// now, split gids, if needed | ||
for (auto& e : found) | ||
{ | ||
e.second = naming::detail::split_gid_if_needed(e.second).get(); |
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.
I am not sure if that is correct. The above lines (394 and 405) copy the gid_type. This means that we also copy the credit, that means that we always split from the same initial credit count, without asking for more credit in the primary namespace. This will lead to a negative credit count when all credits are returned back to AGAS.
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.
Fair point, not sure what I was thinking :/
a9e0248
to
fc4482b
Compare
f(key, gid); | ||
|
||
found[it->first] = | ||
naming::detail::split_gid_if_needed(*current_gid).get(); |
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.
Yeah, this will work. While going through the PR I was really wondering why we don't reuse hpx::naming::id_type
here instead of std::shared_ptr<gid_type>
. But that's unrelated to that PR.
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.
AGAS stores gid_type
instances only by design. For all intents and purposes this is sufficient and avoids problems with reference counting etc. The symbol namespace is special in that regard that it actually has to maintain reference counts (for some of its functionality). I'm impartial to changing this - it wouldn't make the code so much more readable, however.
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.
LGTM now.
I'm still skeptical though if this is really a better approach than the callback based solution.
I'd be happy to add back the old callback-based solution as an alternate API. For my use case it would be much more expensive at runtime to use the old API, however. |
…th AGAS - this depends on STEllAR-GROUP/hpx#3072 - add an example demonstrating adding and accessing debug information to primitive instances
…th AGAS - this depends on STEllAR-GROUP/hpx#3072 - add an example demonstrating adding and accessing debug information to primitive instances
…th AGAS - this depends on STEllAR-GROUP/hpx#3072 - add an example demonstrating adding and accessing debug information to primitive instances
This API was never used anywhere and required some face-lifting after being half-way abandoned. It is now needed on one of our projects.