Optimize 2D rho grid memory use#13425
Open
dafeda wants to merge 1 commit intoequinor:mainfrom
Open
Conversation
Use NumPy broadcasting in `calc_rho_for_2d_grid_layer` instead of flattened mesh arrays. This preserves the result while avoiding large intermediate allocations.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13425 +/- ##
==========================================
- Coverage 90.03% 90.03% -0.01%
==========================================
Files 459 459
Lines 31992 31992
==========================================
- Hits 28804 28803 -1
- Misses 3188 3189 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
xjules
reviewed
Apr 28, 2026
| obs_anisotropy_angle = obs_anisotropy_angle[np.newaxis, np.newaxis, :] | ||
|
|
||
| # Center points of each grid cell in field parameter grid | ||
| x_local = (np.arange(nx) + 0.5) * xinc |
Contributor
There was a problem hiding this comment.
Wondering whether this shift (+0.5) is necessary at all? Since thus we need to reflect this in the observations too (ie. like in heat equation).
I guess the increment can vary and thus it makes sense.....
Collaborator
|
Could you rebase to ensure the snapshot test passes? |
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.
Use NumPy broadcasting in
calc_rho_for_2d_grid_layerinstead offlattened mesh arrays. This preserves the result while avoiding large
intermediate allocations.
git rebase -i main --exec 'just rapid-tests')When applicable