Fix excessive regrid memory use#624
Merged
davidhassell merged 9 commits intoNCAS-CMS:mainfrom Apr 24, 2023
Merged
Conversation
Member
|
FYI I just added one minimal commit to resolve the lone trivial merge conflict (new Changelog entries to combine) so I can review without it being in the way. |
sadielbartholomew
approved these changes
Mar 29, 2023
Member
sadielbartholomew
left a comment
There was a problem hiding this comment.
Clever approach which I agree with as covered in the notes of the opening comment. The implementation is sound and doesn't call for any new testing. The performance improves very significantly in test cases I played around with and did basic profiling on, so passes with flying colours in that respect.
Therefore overall this is all good, though I've raised some minor comments and a question. Please consider those and then merge when ready. Thanks.
Co-authored-by: Sadie L. Bartholomew <[email protected]>
Co-authored-by: Sadie L. Bartholomew <[email protected]>
Co-authored-by: Sadie L. Bartholomew <[email protected]>
Co-authored-by: Sadie L. Bartholomew <[email protected]>
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
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.
Fixes #623
Notes
numpyarray sincescipysparse arrays do not support masks.scipysparse array, but creates a separate boolean mask to applied to the regridded data.cf/regrid/regrid.pypre-creates the sparse matrix representation in a returned regrid operator. This makes sense because the purpose of returning the operator is for efficiency in repeated future uses, so it makes sense not to have to do this every time.coo_arraytocsr_arrayis because the latter is much more efficient at row slicing.