Repository navigation
Support differentiable regridding on CPU and CUDA - #209
Open
cuteNBD (bingdongni) wants to merge 1 commit into
Open
cuteNBD (bingdongni) wants to merge 1 commit into
cuteNBD (bingdongni) wants to merge 1 commit into
Conversation
Author
|
@microsoft-github-policy-service agree |
This branch has not been deployed
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.
Batch.regrid()converts every field to NumPy for SciPy interpolation. That makes a GPU forecast take a round trip through host memory and breaks the gradient when a loss is evaluated on another grid.Compute the latitude and longitude neighbors once per batch and apply their weights with PyTorch on each field's device. This preserves the existing target coordinates, longitude wrap, latitude extrapolation and float32 return type. The regression test checks irregular coordinates, missing values, pressure levels and the gradient with respect to the source field against the SciPy interpolator.
On an RTX 4060 Laptop GPU, all eleven fields from Microsoft's published 0.4° air-pollution static file matched the SciPy result at 0.25° (
rtol=2e-6,atol=1e-7; 721 × 1440 values per field). With inputs and outputs on CUDA, the median for that batch was 13.5 ms, versus 1269 ms through SciPy on CPU. A randomly initialized small Aurora 1.5 forecast also backpropagated a regridded surface objective to its input. GPU tests and benchmark · Linux batch and forecast tests