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

1983 Runtime optimizations 2 -- objgroup dispatch/locman/contexts #1984

Merged
merged 8 commits into from
Jan 31, 2023

Conversation

lifflander
Copy link
Collaborator

Fixes #1983

@lifflander lifflander linked an issue Sep 28, 2022 that may be closed by this pull request
3 tasks
@github-actions
Copy link

github-actions bot commented Sep 28, 2022

Pipelines results

PR tests (gcc-12, ubuntu, mpich)

Build for 5b48207 (2022-11-16 20:54:24 UTC)

Compilation - successful

Testing - passed

Build log


PR tests (gcc-5, ubuntu, mpich)

Build for 5b48207 (2022-11-16 20:54:24 UTC)

Compilation - successful

Testing - passed

Build log


PR tests (gcc-6, ubuntu, mpich)

Build for 5b48207 (2022-11-16 20:54:24 UTC)

Compilation - successful

Testing - passed

Build log


PR tests (clang-3.9, ubuntu, mpich)

Build for 5b48207 (2022-11-16 20:54:24 UTC)

Compilation - successful

Testing - passed

Build log


PR tests (gcc-9, ubuntu, mpich, zoltan)

Build for 5b48207 (2022-11-16 20:54:24 UTC)

Compilation - successful

Testing - passed

Build log


PR tests (clang-10, ubuntu, mpich)

Build for a501e7d (2023-01-30 20:12:35 UTC)

Compilation - successful

Testing - passed

Build log


PR tests (clang-9, ubuntu, mpich)

Build for 5b48207 (2022-11-16 20:54:24 UTC)

Compilation - successful

Testing - passed

Build log


PR tests (gcc-7, ubuntu, mpich, trace runtime, LB)

Build for 5b48207 (2022-11-16 20:54:24 UTC)

Compilation - successful

Testing - passed

Build log


PR tests (clang-5.0, ubuntu, mpich)

Build for 5b48207 (2022-11-16 20:54:24 UTC)

Compilation - successful

Testing - passed

Build log


PR tests (gcc-10, ubuntu, openmpi, no LB)

Build for 5b48207 (2022-11-16 20:54:24 UTC)

Compilation - successful

Testing - passed

Build log


PR tests (clang-13, alpine, mpich)

Build for 5b48207 (2022-11-16 20:54:24 UTC)

Compilation - successful

Testing - passed

Build log


PR tests (gcc-8, ubuntu, mpich, address sanitizer)

Build for 5b48207 (2022-11-16 20:54:24 UTC)

Compilation - successful

Testing - passed

Build log


PR tests (nvidia cuda 11.0, ubuntu, mpich)

Build for 5b48207 (2022-11-16 20:54:24 UTC)

Compilation - successful

Testing - passed

Build log


PR tests (clang-12, ubuntu, mpich)

Build for 5b48207 (2022-11-16 20:54:24 UTC)

Compilation - successful

Testing - passed

Build log


PR tests (clang-11, ubuntu, mpich)

Build for 5b48207 (2022-11-16 20:54:24 UTC)

Compilation - successful

Testing - passed

Build log


PR tests (nvidia cuda 10.1, ubuntu, mpich)

Build for 5b48207 (2022-11-16 20:54:24 UTC)

Compilation - successful

Testing - passed

Build log


PR tests (intel icpx, ubuntu, mpich)

Build for 5b48207 (2022-11-16 20:54:24 UTC)

Compilation - successful

Testing - passed

Build log


PR tests (clang-13, ubuntu, mpich)

Build for 5b48207 (2022-11-16 20:54:24 UTC)

Compilation - successful

Testing - passed

Build log


PR tests (clang-14, ubuntu, mpich)

Build for 5b48207 (2022-11-16 20:54:24 UTC)

Compilation - successful

Testing - passed

Build log


PR tests (gcc-11, ubuntu, mpich, json schema test)

Build for 5b48207 (2022-11-16 20:54:24 UTC)

Compilation - successful

Testing - passed

Build log


PR tests (intel icpc, ubuntu, mpich)

Build for 5b48207 (2022-11-16 20:54:24 UTC)

Compilation - successful

Testing - passed

Build log


@lifflander lifflander force-pushed the 1983-make-location-manager-more-efficient branch from d22a1c4 to f8d4a00 Compare September 28, 2022 15:27
) {
runnable::makeRunnable(msg, true, msg->getHandler(), theContext()->getNode())
.withTDEpochFromMsg()
.run();
Copy link
Member

Choose a reason for hiding this comment

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

Should this be .run() or .enqueue()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a difficult one. .run() is correct for all the use cases that currently exist. It runs a system handler on the collection manager that generates the next runnable that is enqueued.

Copy link
Member

Choose a reason for hiding this comment

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

That seems kinda wasteful. Could we add a method in the collection manager to do that more directly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's what the next PR will do. It's already implemented on my other branch.

if (local_registered_.find(id) == local_registered_.end()) {
return routeMsg<MessageT>(id,home_node,msg);
} else {
return routeMsgHandlerLocal(msg);
Copy link
Member

Choose a reason for hiding this comment

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

Can we somehow take advantage of having already done the lookup in local_registered_ in this case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We know it's local so we create the runnable directly for it to execute. local_registered_ does not hold the pointer to the actual object (it does not manage objects), just an entry that corresponds to its existence.

@lifflander lifflander marked this pull request as ready for review September 28, 2022 18:46
@lifflander lifflander force-pushed the 1983-make-location-manager-more-efficient branch from 305d00b to f8d4a00 Compare September 28, 2022 18:51
@codecov
Copy link

codecov bot commented Sep 28, 2022

Codecov Report

Merging #1984 (a501e7d) into develop (e2665f5) will decrease coverage by 0.01%.
The diff coverage is 84.66%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1984      +/-   ##
===========================================
- Coverage    84.87%   84.86%   -0.01%     
===========================================
  Files          723      720       -3     
  Lines        25549    25632      +83     
===========================================
+ Hits         21685    21753      +68     
- Misses        3864     3879      +15     
Impacted Files Coverage Δ
src/vt/context/runnable_context/collection.h 100.00% <ø> (ø)
src/vt/objgroup/manager.h 100.00% <ø> (ø)
src/vt/objgroup/manager.impl.h 97.87% <0.00%> (+5.27%) ⬆️
src/vt/registry/auto/auto_registry_common.h 93.93% <ø> (-0.18%) ⬇️
src/vt/runnable/runnable.h 100.00% <ø> (ø)
src/vt/objgroup/manager.cc 90.90% <50.00%> (+1.62%) ⬆️
src/vt/objgroup/manager.static.h 76.00% <67.56%> (-24.00%) ⬇️
src/vt/runnable/runnable.cc 88.57% <87.09%> (+9.55%) ⬆️
src/vt/topos/location/location.impl.h 89.13% <88.23%> (-0.84%) ⬇️
...erialization/messaging/serialized_messenger.impl.h 99.27% <95.23%> (-0.73%) ⬇️
... and 16 more

@stmcgovern stmcgovern force-pushed the 1983-make-location-manager-more-efficient branch from 8d9f1e3 to 69221fb Compare October 18, 2022 16:11
@lifflander lifflander force-pushed the 1983-make-location-manager-more-efficient branch from 69221fb to 6e0814e Compare October 24, 2022 23:01
@lifflander lifflander force-pushed the 1983-make-location-manager-more-efficient branch from 17ab108 to 425c4de Compare November 16, 2022 20:46
@lifflander lifflander force-pushed the 1983-make-location-manager-more-efficient branch from 5b48207 to 79fd8d5 Compare December 1, 2022 01:33
@PhilMiller
Copy link
Member

Could you squash down the small patch-up commits that correct mistakes in earlier commits in the PR into those earlier commits?

@lifflander lifflander force-pushed the 1983-make-location-manager-more-efficient branch from 79fd8d5 to 5c9ad2b Compare December 7, 2022 02:17
@lifflander lifflander force-pushed the 1983-make-location-manager-more-efficient branch 2 times, most recently from 87a52cc to 9fbe4b6 Compare January 24, 2023 00:22
@lifflander lifflander changed the title 1983 make location manager more efficient 1983 Runtime optimizations 2 -- objgroup dispatch/locman/contexts Jan 24, 2023
@lifflander lifflander requested a review from PhilMiller January 24, 2023 00:24
Copy link
Member

@PhilMiller PhilMiller left a comment

Choose a reason for hiding this comment

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

Would be good to get at least one other review on this, since it's pretty big

@lifflander lifflander requested a review from nmm0 January 24, 2023 19:52
@nmm0
Copy link
Collaborator

nmm0 commented Jan 25, 2023

Any chance this could be split up into separate optimizations/PRs with maybe a short description of what's going on in it? It's a bit difficult to follow what all of the changes are doing or how they are more efficient.

For example there are a few changes (the std:function optimization) that I could easily approve already but the changes to objGroup dispatches I'm still trying to understand.

@lifflander
Copy link
Collaborator Author

lifflander commented Jan 25, 2023

Any chance this could be split up into separate optimizations/PRs with maybe a short description of what's going on in it? It's a bit difficult to follow what all of the changes are doing or how they are more efficient.

For example there are a few changes (the std:function optimization) that I could easily approve already but the changes to objGroup dispatches I'm still trying to understand.

Basically, the objgroup dispatch wasn't going through RunnableNew the same way a collection goes through it causing extra overhead. The old dispatch was creating a runnable that didn't actually know about the object it was dispatching to, so the Runnable had to call back into the objgroup manager to get the object and actually run the member function. The new code gets the object and associates it with the RunnableNew like the collection manager does.


if (not is_void) {
if (is_obj) {
task_ = [=] { objgroup::dispatchObjGroup(msg_, handler); };
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the old code, where we had to create a std::function that calls back into the objgroup manager code (because the object isn't known here).

Copy link
Collaborator

@nmm0 nmm0 left a comment

Choose a reason for hiding this comment

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

Just some minor suggestions -- about the auto thing it's more up to personal preference. Just one thing to flag is Phil's comment, you mentioned it changed but it didn't look like the diff changed.

src/vt/objgroup/manager.cc Show resolved Hide resolved
src/vt/objgroup/manager.cc Show resolved Hide resolved
src/vt/runnable/make_runnable.h Outdated Show resolved Hide resolved
@@ -334,7 +339,12 @@ struct RunnableNew {
private:
detail::Contexts contexts_; /**< The contexts */
MsgSharedPtr<BaseMsgType> msg_ = nullptr; /**< The associated message */
ActionType task_ = nullptr; /**< The runnable's task */
void* obj_ = nullptr; /**< Object pointer */
union {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we should hold this up because of it, since C++17 is still WIP, but this would be much more elegant with C++17 variant and std::visit

@lifflander lifflander force-pushed the 1983-make-location-manager-more-efficient branch from 60b7c95 to 0701e75 Compare January 30, 2023 20:09
@lifflander lifflander force-pushed the 1983-make-location-manager-more-efficient branch from 0701e75 to a501e7d Compare January 30, 2023 20:12
@lifflander lifflander merged commit b0894cf into develop Jan 31, 2023
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.

Make location manager more efficient
4 participants