Restore = nullptr defaults to CUDA Rdr2Geo.topo() optional rasters (#265)#270
Open
s-sasaki-earthsea-wizard wants to merge 2 commits into
Conversation
The CUDA pybind binding for isce3::cuda::geometry::Topo::topo() declared all 11 output raster kwargs as required, while the underlying C++ class accepts nullptr per its documented contract and the CPU sibling binding marks the same kwargs `= nullptr`. Calling the CUDA overload from a context that omits a subset of layers (e.g. COMPASS s1_rdr2geo.run) raised TypeError on argument matching. Restore the symmetric `= nullptr` defaults to match the CPU binding and the C++ class signature. Also rename `local_Psi_raster` to `local_psi_raster` to align with the CPU binding's lowercase form. The defaults were originally added symmetrically to both CPU and CUDA bindings in the "Optional topo layers" change. They were silently dropped on the CUDA side when the binding block was rewritten in a different formatting style for the ground-to-sat East/North components extension; the CPU sibling was edited in place and kept its defaults intact. No test exercises the optional path on either side, so CI stayed green.
Add a CUDA-side test that calls topo() with the call shape used by COMPASS s1_rdr2geo.run: kwargs for a subset of output layers as Rasters, others passed as None or omitted entirely. This exercises both the binding-layer kwarg defaults and pybind11's None-to-nullptr conversion for pointer types. Without this test, binding-layer regressions on the optional path go undetected because test_run_raster_layers always passes every kwarg explicitly. Also gate the whole module with `pytestmark = pytest.mark.skipif` on `isce3.cuda` availability so CPU-only builds report a clean skip with reason rather than a fixture collection error.
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 #265.
Summary
The CUDA pybind binding for
isce3::cuda::geometry::Topo::topo()declared all 11 output-raster kwargs as required, while the underlying
C++ class accepts
nullptrper its documented contract and the CPUsibling binding marks the same kwargs
= nullptr. Calling the CUDAoverload with a subset of layers (kwargs only, others omitted) raised
TypeErroron argument matching:The CPU sibling accepts the same call and produces the requested
layers. Full evidence — including pybind11 docstring inspection and a
self-contained repro that imports only
isce3— is in #265.What's in this PR
Two commits:
= nullptrdefaults to CUDARdr2Geo.topo()optional rasters— adds
= nullptrto the 11 output-raster kwargs inpython/extensions/pybind_isce3/cuda/geometry/rdr2geo.cppto mirrorthe CPU sibling and the C++ class signature
(
cxx/isce3/cuda/geometry/Topo.h:43-54). Also renameslocal_Psi_raster→local_psi_rasterfor parity with the CPUbinding (the lowercase form was already used by the CPU sibling and
by the shared docstring; the capital-P was a leftover from the same
rewrite that dropped the defaults).
Rdr2Geo.topo()optional-rasters regression test —test_run_optional_layersintests/python/extensions/pybind/cuda/geometry/rdr2geo.pyexercisesthe kwarg-subset call shape (subset of layers requested, others
passed as
Noneor omitted) so future binding-layer regressions onthe optional path get caught. Also gates the whole module with
pytestmark = pytest.mark.skipifonisce3.cudaavailability soCPU-only builds skip cleanly with a reason rather than failing
fixture collection.
Net diff: ~15 lines of binding code (11
= nullptr+ the rename) plus aregression test. No kernel changes, no C++ class changes — purely a
binding-layer restoration.
Why this is regression-shaped, not a feature
The defaults existed historically. The "Regression history" section in
#265 traces this: commit
a19944c0(2022, "Optional topo layers") added= nullptrto both the CPU and CUDA bindings symmetrically. Thelater commit
362813e7(2023, "ground-to-sat East/North components")rewrote the CUDA binding block in a different formatting style and
silently dropped every
= nullptralong the way, while the CPU siblingwas edited in place and kept its defaults. This PR restores the
pre-
362813e7contract for the CUDA side.Why existing CI didn't catch it
tests/python/extensions/pybind/cuda/geometry/rdr2geo.py::test_run_raster_layersexercises the multi-raster overload but always passes every raster
kwarg explicitly. No test ever exercised the optional path on the CUDA
side, so CI was green through
362813e7. The newtest_run_optional_layerscovers the gap.Internal NISAR callers (
nisar/workflows/{rdr2geo,geocode_corrections}.py)pass all 12 raster args positionally with the unwanted ones as
None.pybind11 converts
None → nullptrforRaster*arguments regardless ofwhether the binding declares a default, so those callers are insensitive
to the missing defaults. Only kwarg-subset callers hit it.
Tests
pytest tests/python/extensions/pybind/cuda/geometry/rdr2geo.py -v—5/5 PASS (existing 4 + the new
test_run_optional_layers) on aCUDA-enabled build. On a CPU-only build the whole module reports a
clean skip via
pytestmark.The standalone
isce3-only repro in #265 ("Reproducing" section) goesfrom
CPU defaults=11/PASS, CUDA defaults=0/TypeError(BEFORE) toCPU defaults=11/PASS, CUDA defaults=11/PASS(AFTER) on this branch.Notes
#868and#1393referenced bya19944c0and362813e7commitmessages are JPL-internal MCR numbers (GitLab), not GitHub PRs.
developHEAD2919e1c97(no conflicts —upstream files touched by intervening commits Expose sensing start/end times and starting/ending ranges in the STATIC runconfig #205, Fix recently-introduced mixed-mode bug #268, Scale RSLC mixed-mode filter by bandwidth ratio #269 are
disjoint from the two files in this PR).