-
Notifications
You must be signed in to change notification settings - Fork 45
Parallelize Dual Grid Construction #1274
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
Conversation
ASV BenchmarkingBenchmark Comparison ResultsBenchmarks that have improved:
Benchmarks that have stayed the same:
|
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.
Pull Request Overview
This PR adds parallelization to dual mesh construction and bilinear weight calculation functions to improve performance. The changes implement Numba's prange for parallel execution in computationally intensive loops.
- Enables parallel processing in dual mesh face construction using
prange - Adds parallelization to bilinear weight calculation functions
- Improves numerical stability with bounds checking and error handling
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| uxarray/remap/bilinear.py | Adds parallel execution to weight calculation loop and improves array indexing |
| uxarray/grid/dual.py | Implements parallel dual mesh construction with enhanced numerical stability checks |
| test/test_grid.py | Adds comprehensive tests for parallel dual mesh construction and validation |
Comments suppressed due to low confidence (1)
test/test_grid.py:877
- [nitpick] The 30-second timeout threshold for performance testing may be too lenient and could vary significantly across different hardware configurations. Consider using a more relative performance metric or making this configurable.
assert avg_time < 30.0, f"Dual construction too slow: {avg_time:.2f}s"
philipc2
left a comment
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.
…ion call entirely in the Numba-compiled loop
updates: - [github.com/astral-sh/ruff-pre-commit: v0.12.3 → v0.12.4](astral-sh/ruff-pre-commit@v0.12.3...v0.12.4) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
updates: - [github.com/astral-sh/ruff-pre-commit: v0.12.4 → v0.12.5](astral-sh/ruff-pre-commit@v0.12.4...v0.12.5) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…t reliable solution since it's simple, fast, and fully supported by Numba. Numba doesn't fully support np.clip in nopython mode.

Closes #1277
Overview
This adds parallelization to numba functions within the dual function and within the bilinear weights calculation.
PR Checklist
General
Testing
Documentation