-
Notifications
You must be signed in to change notification settings - Fork 41
Communicator refactor #496
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
Open
bknueven
wants to merge
39
commits into
Pyomo:main
Choose a base branch
from
bknueven:communicator_refactor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d512137
to
ad1f6b9
Compare
7a33788
to
d89676c
Compare
dbcd3f1
to
4d3b668
Compare
9bccfe6
to
f2ff331
Compare
2d250ac
to
a94c2dd
Compare
6c6fd66
to
1a0ceb8
Compare
64901fb
to
252166c
Compare
bknueven
commented
Apr 4, 2025
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.
Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR finishes the work started in #476 by utilizing the new API introduced for communication in #476 at a higher level. This refactoring has a few major outcomes:
Spoke.got_kill_signal
only updates theSHUTDOWN
field. This mirrors how things are currently done in the hub and removes from spooky action at a distance from the code.Hub
andSpoke
classes and is now inSPCommunicator
FieldLengths
, which centrally stores the length of each field. Validation is done automatically and generically inSPCommunicator.register_recv_field
SPCommunicator
classes now register as a class attribute what they send and receive. This isn't necessary, but makes it possible to write the methodSPCommunicator.register_receive_fields
in a generic way. But maybe we should just be doing calls tosuper()
with traditional inheritance instead?Spoke.got_kill_signal
only checks the shutdown field. Further, instead of all cylinder ranks agreeing on shutting down by checkingis_new
, we now terminate when the first one gets the shutdown indicator through anSPCommunicator.allreduce_or
call to synchronize the action. This results in (a) faster termination and (b) more flexibility:Spoke.got_kill_signal
can be called multiple times to jump out of expensive function executions.