-
Notifications
You must be signed in to change notification settings - Fork 3
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
add a cache toggle #13
base: parallel_count
Are you sure you want to change the base?
add a cache toggle #13
Conversation
@matthewturk I can fix that type checking error if you think this would be a useful functionality to expose, but if we want to keep this branch just for testing then I won't bother fixing it :) |
I do think it is worthwhile. |
removed the type hints i added to the new function cause it was triggering a type check for the whole class and I didn't want to get into fixing typing errors in this PR... |
I think I'll add a simple test too... |
glad i added a test -- |
@matthewturk just FYI, I'm not planning on modifying this anymore unless you've got comments. |
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 great!
yt/geometry/grid_geometry_handler.py
Outdated
@@ -106,6 +106,27 @@ def clear_all_data(self): | |||
g.clear_data() | |||
self.io.queue.clear() | |||
|
|||
def set_grid_cache_mask(self, cache_grid_masks, clear_all_data=True): |
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'm slightly unsure about this being a top-level method, rather than having an underscore prefix. Then again, maybe it's good.
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.
Ya, I had the same thought. I think an underscore might be better? It's probably not something 99.9% of people would use. But maybe someone might find themselves in a memory-limited situation and want to disable cacheing easily?
So ya, I was on the fence, but happy to go with an underscore instead.
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.
Let's do underscore, then I can merge and we'll PR upstream
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.
done
This is mostly for testing purposes, but maybe it'd be useful to include in the actual PR?
This PR adds a way to toggle the mask cache behavior for all the grids, the following would turn off/on cacheing:
It includes an optional parameter,
clear_all_data
(default isTrue
) to callsclear_all_data()
if True.