Repository navigation
Fix deferred CUDA checks before Kit GPU filtering - #7669
Conversation
|
run-ci |
There was a problem hiding this comment.
Isaac Lab Review Bot
The PR adds a private pre-Kit CUDA initialization hook when PyTorch is already loaded and a CUDA simulation device is selected, preventing deferred capability checks from retaining stale GPU indices after Kit filtering. The existing post-Kit device-selection path remains intact.
- Design and architecture: The hook is correctly placed after device configuration resolves
_deferred_cuda_device_idand before Kit startup. It avoids importing PyTorch itself, preserving deferred initialization for normal launches and the existing protection against pre-Kit PyTorch/OpenBLAS side effects. - API: No public APIs, CLI arguments, defaults, exports, or return types change. The behavior is confined to a private launcher lifecycle method, and the user-visible fix is documented with a package changelog fragment.
- Implementation: The implementation guards CPU launches, absent PyTorch imports, and already-initialized CUDA runtimes. Focused tests cover both initializing preloaded PyTorch and retaining deferred behavior when PyTorch is absent. A CUDA runtime failure may now surface before Kit startup when PyTorch was preloaded, which is a proportionate consequence of draining the checks before GPU filtering.
No blocking issues. No inline issue met the actionable-evidence threshold; the assessment above records the review feedback.
Automated review; human maintainers own approval decisions.
| launcher = AppLauncher.__new__(AppLauncher) | ||
| launcher._deferred_cuda_device_id = 0 | ||
|
|
||
| launcher._initialize_preloaded_torch_cuda() |
There was a problem hiding this comment.
Constructor Ordering Is Untested
This test calls _initialize_preloaded_torch_cuda() directly, so it would still pass if the constructor later invoked the method after _create_app(). Running CUDA initialization before Kit creates the application is essential to this regression fix. Add a mocked constructor-sequencing test that protects this ordering.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
(cherry picked from commit 9470e1e)
|
Backported to |
## Description Upgrade PyTorch to 2.12.0 and torchvision to 0.27.0. PyTorch 2.12 includes the upstream fix for CUDA lazy initialization when NVML reports more devices than the CUDA runtime exposes, avoiding the deferred `device >= 0 && device < num_gpus` assertion after Kit initializes graphics on a subset of GPUs. PyTorch 2.12 is published for CUDA 13.0, so the supported x86_64 and Windows installs move from the cu128 index to cu130 as well. TorchAudio remains at 2.11.0 because it uses PyTorch stable ABI and officially supports PyTorch 2.11 and later. ## Testing - `uv lock --check` - `uv run isaaclab -f` - `LD_PRELOAD=/lib/aarch64-linux-gnu/libgomp.so.1 OMNI_KIT_ACCEPT_EULA=YES uv run pytest source/isaaclab/test/cli -q` (283 passed) - Imported torch 2.12.0+cu130, torchvision 0.27.0+cu130, and torchaudio 2.11.0+cu130; exercised torchvision NMS and torchaudio resampling - Ran `scripts/demos/arms.py --device=cuda:0 --visualizer kit` through setup and repeated simulation resets on a 2-GPU ARM64 system where Kit exposes one GPU to the CUDA runtime - Ran the SKRL ANYmal-C training flow through environment setup and active PPO rollout Supersedes the application-level initialization workaround in #7669. ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` --------- Co-authored-by: ooctipus <[email protected]>
Upgrade PyTorch to 2.12.0 and torchvision to 0.27.0. PyTorch 2.12 includes the upstream fix for CUDA lazy initialization when NVML reports more devices than the CUDA runtime exposes, avoiding the deferred `device >= 0 && device < num_gpus` assertion after Kit initializes graphics on a subset of GPUs. PyTorch 2.12 is published for CUDA 13.0, so the supported x86_64 and Windows installs move from the cu128 index to cu130 as well. TorchAudio remains at 2.11.0 because it uses PyTorch stable ABI and officially supports PyTorch 2.11 and later. - `uv lock --check` - `uv run isaaclab -f` - `LD_PRELOAD=/lib/aarch64-linux-gnu/libgomp.so.1 OMNI_KIT_ACCEPT_EULA=YES uv run pytest source/isaaclab/test/cli -q` (283 passed) - Imported torch 2.12.0+cu130, torchvision 0.27.0+cu130, and torchaudio 2.11.0+cu130; exercised torchvision NMS and torchaudio resampling - Ran `scripts/demos/arms.py --device=cuda:0 --visualizer kit` through setup and repeated simulation resets on a 2-GPU ARM64 system where Kit exposes one GPU to the CUDA runtime - Ran the SKRL ANYmal-C training flow through environment setup and active PPO rollout Supersedes the application-level initialization workaround in isaac-sim#7669. - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` --------- Co-authored-by: ooctipus <[email protected]> (cherry picked from commit 4269c29)
Description
Initialize CUDA before Kit startup when PyTorch has already been imported and a CUDA simulation device was selected.
Importing PyTorch queues capability checks for every CUDA device visible at import time. On heterogeneous multi-GPU systems, Kit can subsequently filter the CUDA devices to those usable by its Vulkan backend. The queued checks then retain stale indices and fail during the post-Kit
torch.cuda.set_devicecall withdevice >= 0 && device < num_gpus.The launcher does not import PyTorch solely for this workaround. If PyTorch has not already been loaded, CUDA initialization remains deferred until after Kit startup as before.
Reproduction hardware:
Previously failing command:
The command now reaches setup completion and runs the visualized simulation with both GPUs visible. Restricting visibility to GPU 0 also continues to work.
Type of change
Release backport
developScreenshots
Not applicable. The failure was a deferred CUDA initialization traceback; the fixed command was validated interactively through the Kit visualizer.
Validation
3 passed, 47 deselectedfor the focused AppLauncher CUDA tests./isaaclab.sh --formatpre-commit suite passedChecklist
./isaaclab.sh --formatsource/isaaclab/changelog.d/CONTRIBUTORS.md