gpu: introduce mintpy.gpu subpackage and migrate ifgram_inversion_gpu#18
Merged
Merged
Conversation
Move src/mintpy/ifgram_inversion_gpu.py to src/mintpy/gpu/ifgram_inversion.py and rename tests/test_ifgram_inversion_gpu.py to tests/test_gpu_ifgram_inversion.py. Update the three import sites (dispatch caller, docstring self-reference, test import) and the CUDA-skip reason message. CPU and GPU paths stay byte-for-byte identical; this is a pure relocation. Rationale: src/mintpy/ holds 66 flat modules. As GPU acceleration extends to further steps (next: correct_topography), keeping new *_gpu.py modules flat would noise up the namespace. MintPy already uses cli/, objects/, defaults/, legacy/, utils/ subpackage conventions, so adding gpu/ is consistent. Helper extraction into src/mintpy/gpu/_common.py is intentionally deferred until the next GPU module surfaces concrete duplication (avoid premature DRY). Closes #16 Assisted-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 12, 2026
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.
Summary
Pure refactor: relocate
src/mintpy/ifgram_inversion_gpu.pyinto a newsrc/mintpy/gpu/subpackage. No behaviour change.src/mintpy/ifgram_inversion_gpu.py→src/mintpy/gpu/ifgram_inversion.pytests/test_ifgram_inversion_gpu.py→tests/test_gpu_ifgram_inversion.pysrc/mintpy/gpu/__init__.pyifgram_inversion.py:819, docstring self-reference, test import) + CUDA-skip reason messageWhy
src/mintpy/currently holds 66 flat modules. As GPU acceleration extends to further steps (next target:correct_topography, tracked in #17), keeping new*_gpu.pymodules flat would noise up the namespace. MintPy already uses subpackage conventions (cli/,objects/,defaults/,legacy/,utils/), so addinggpu/is consistent.docs/gpu.mdaligns with the directory name.Out of scope
Extracting reusable helpers (
_get_torch_device,_auto_chunk_size, etc.) intosrc/mintpy/gpu/_common.py. Deferred until the next GPU module surfaces concrete duplication (avoid premature DRY).Validation
pytest tests/test_gpu_ifgram_inversion.py: 6 passed on RTX 5080 / torch 2.11+cu128CUDA_VISIBLE_DEVICES="" pytest tests/test_gpu_ifgram_inversion.py: 6 skipped with updated reasonCUDA-capable GPU required for mintpy.gpu.ifgram_inversion testsmintpy.ifgram_inversion_gpuno longer resolves (ModuleNotFoundError)pre-commithooks pass (13 hooks ran via commit gate, 3 skipped for no matching files)pyproject.tomlunchanged:[tool.setuptools.packages.find]auto-discovery picks upsrc/mintpy/gpu/End-to-end
smallbaselineApp.pyon FernandinaSenDT128 was intentionally out of scope per session agreement (unit-test parity is sufficient for a pure file-move + import rewrite).Upstream PR insarlab#1490 interaction
This branch does not touch
gpu_torch_solver(the upstream PR branch). PR insarlab#1490 stays with the current flat layout. When/if insarlab#1490 merges, we will decide separately whether to surface the subpackage refactor upstream as (a) a standalone refactor PR, or (b) bundled with the next GPU step PR.Closes #16
Test plan
pytest tests/test_gpu_ifgram_inversion.pypasses on CUDA boxpytest tests/test_gpu_ifgram_inversion.pyskips cleanly with no CUDApre-commithooks pass on commitmain🤖 Generated with Claude Code