Clean up and vectorize the face_areas API (#1571)#1577
Open
rajeeja wants to merge 1 commit into
Open
Conversation
Un-deprecate compute_face_areas() as the public quadrature-capable entry point (areas by default, return_jacobian and as_dataarray flags), rename the internal worker to _compute_face_areas_and_jacobian, privatize the low-level area.py helpers, and document the quadrature options. Vectorize get_all_face_area_from_coords with prange and hoist the per-face quadrature setup out of the loop for a 6.3x speedup with identical areas. Closes #1571.
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Collaborator
|
Thank you for these changes! I added run-benchmarks label but then realized I'm not sure if there are any benchmarks which actually rely on face_areas. If there's no visible impact, then would you be able to add at least one face_areas benchmark? If the impact is visible already, I don't feel strongly about needing a face_areas specific benchmark. I'll come back to this soon (probably tomorrow), and if the benchmark impact is visible then I will review the rest! |
ASV BenchmarkingBenchmark Comparison ResultsBenchmarks that have improved:
Benchmarks that have stayed the same:
|
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.
Closes #1571.
compute_face_areas()as the public quadrature-capable entry point — returns areas by default, withreturn_jacobianandas_dataarrayflags._compute_face_areas_and_jacobianand privatize the low-levelarea.pyhelpers.quadrature_rule/order/latitude_adjusted_areaoptions; notecalculate_total_face_areais equivalent tocompute_face_areas().sum().get_all_face_area_from_coordswithprangeand hoist the per-face quadrature setup out of the loop — 6.3x faster with identical areas.