ENH: Allow user configuration of pocketfft's plan caches #12512
Closed
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.
Reference issue
Closes gh-12297
What does this implement/fix?
This allows the user to interface with
scipy.fft
's plan caches using 3 utility functions:set_plan_cache_size(new_size)
get_plan_cache_size()
clear_plan_cache()
Limitations:
Only controls the number of plans, not amount of memory.Additional information
The C++ implementation introduces two new classes,
PlanCache
andCacheManager
. A plan cache handles LRU caching for a single plan type, similar to whatget_plan
did before.PlanCache
instances are constructed within theCacheManager
which keeps an internal reference to every cache. This way I can query and manipulate the caches uniformly by iterating over theCacheManager
's internal list of caches.Note that inside of any given transform,
get_plan()
interacts directly with thePlanCache
and doesn't need to go through theCacheManager
. So it exists only for configuration purposes.TODO:
cc @mreineck, @larsoner