-
Notifications
You must be signed in to change notification settings - Fork 35
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
Remove comm hash and add per-comm caches #724
Merged
Merged
Conversation
This file contains 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
connorjward
reviewed
Aug 12, 2024
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.
procrastinating
JDBetteridge
commented
Sep 4, 2024
Co-authored-by: Connor Ward <[email protected]>
JDBetteridge
force-pushed
the
JDBetteridge/remove_comm_hash
branch
from
September 12, 2024 12:44
922cbf3
to
e8f0859
Compare
connorjward
reviewed
Oct 3, 2024
Co-authored-by: Jack Betteridge <[email protected]>
dham
reviewed
Oct 3, 2024
connorjward
approved these changes
Oct 8, 2024
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.
Looks fine.
This was referenced Oct 22, 2024
Closed
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.
It's broken and it's dangerous!
Now that we actually free our duplicated comms the
hash_comm
function is less than useless as the sameid
can be returned by different comms.This PR also adds per-comm caches, which circumvents the need to hash a communicator in the first place.
Update:
This (necessarily) turned into a much bigger refactor than was intended. The key changes, beyond removing comm hash, are:
Cached
a base class used to create an object that would be cached. However, overriding the__new__
method effectively turned instances into singletons, but the objects didn't necessarily fit this design pattern. Moving forward only functions should be wrapped in a cache.@cached_property
decorator as this is now part of the Python standard library.load
andget_so
incompilation.py
to fit with the new caching framework. This now compiles shared objects to RAM backed storage (/tmp
) and only caches the.so
to non-volatile storage ($PYOP2_CACHE_DIR
).PYOP2_SPMD_STRICT
environment variable, for checking SPMD behaviour by enablingMPI.Comm.Barrier()
on logically collective calls. (Switched off by default)Moving forward (in pyop3???) we should also remove the
ObjectCached
base class as it suffers from the same issues asCached
, but this is another big refactor.