-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Select the renderer device by CUDA index #7057
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
Merged
ooctipus
merged 9 commits into
isaac-sim:develop
from
hujc7:jichuanh/fix-renderer-active-gpu-physical-index
Aug 15, 2026
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4ba40a2
Fix renderer device index under non-identity CUDA_VISIBLE_DEVICES
hujc7 77ea288
Select the renderer device by CUDA index
hujc7 a6e17c2
Merge remote-tracking branch 'upstream/develop' into jichuanh/fix-renβ¦
hujc7 33d65ab
Leave activeGpu unset and fold device tests into the argv suite
hujc7 0a4e8aa
Consolidate the device selection tests
hujc7 55b28a9
Emit the renderer device through the existing Kit argument path
hujc7 7bdbc7f
Merge remote-tracking branch 'upstream/develop' into jichuanh/fix-renβ¦
hujc7 6e3e655
Consolidate renderer device tests
ooctipus d954b95
Stop forwarding active_gpu
hujc7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
source/isaaclab/changelog.d/jichuanh-fix-renderer-active-gpu-physical-index.rst
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| Fixed | ||
| ^^^^^ | ||
|
|
||
| * Fixed rendering failing to start when ``CUDA_VISIBLE_DEVICES`` selects GPUs that do not begin at | ||
| zero, such as ``CUDA_VISIBLE_DEVICES=1,2``. Such runs aborted with ``CUDA error 700`` after | ||
| ``omni.gpu_foundation_factory`` reported "Failed to create any GPU devices". The renderer device | ||
| is now selected through ``/renderer/multiGpu/activeCudaGpus``, which takes a CUDA device index, | ||
| instead of ``/renderer/activeGpu``, which indexes the graphics device list that | ||
| ``CUDA_VISIBLE_DEVICES`` does not filter. Runs whose visible devices already begin at zero are | ||
| unaffected. |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,11 +3,11 @@ | |
| # | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| """Tests for filtering command-line arguments before Kit startup.""" | ||
| """Tests for the command-line arguments passed to Kit at startup.""" | ||
|
|
||
| import sys | ||
|
|
||
| from isaaclab.app.app_launcher import _sanitize_sys_argv_for_kit | ||
| from isaaclab.app.app_launcher import AppLauncher, _sanitize_sys_argv_for_kit | ||
|
|
||
|
|
||
| def test_sanitize_sys_argv_removes_trailing_pytest_verbosity(monkeypatch): | ||
|
|
@@ -36,3 +36,57 @@ def test_sanitize_sys_argv_removes_pytest_marker_pair(monkeypatch): | |
| result = _sanitize_sys_argv_for_kit(["test_script.py", "-m", "not isaacsim_ci", "--keep"]) | ||
|
|
||
| assert result == ["test_script.py", "--keep"] | ||
|
|
||
|
|
||
| def _resolve_devices_and_kit_args(launcher_args: dict, monkeypatch) -> tuple[dict, list[str]]: | ||
| """Resolve device settings and Kit arguments without constructing an ``AppLauncher``. | ||
|
|
||
| ``_resolve_kit_args`` extends ``sys.argv``, so the caller's argv is isolated. | ||
| """ | ||
| monkeypatch.setattr(sys, "argv", ["script.py"]) | ||
| launcher = AppLauncher.__new__(AppLauncher) | ||
| launcher.device_id = 0 | ||
| launcher._deferred_cuda_device_id = None | ||
| launcher._xr = False | ||
| AppLauncher._resolve_device_settings(launcher, launcher_args) | ||
| AppLauncher._resolve_kit_args(launcher, launcher_args) | ||
| return launcher_args, launcher._kit_args | ||
|
|
||
|
|
||
| def test_both_devices_selected_by_cuda_index(monkeypatch): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you combine these test all together? some of them seems can be pytest parameters |
||
| """Select both devices by CUDA index, the renderer through the setting that translates it. | ||
|
|
||
| The trailing comma is part of the contract: without it the value is stored as an int and the | ||
| renderer, which reads the setting as a string, sees nothing. | ||
| """ | ||
| args, kit_args = _resolve_devices_and_kit_args({"device": "cuda:1", "multi_gpu": False}, monkeypatch) | ||
|
|
||
| assert "--/renderer/multiGpu/activeCudaGpus=1," in kit_args | ||
| assert args["physics_gpu"] == 1 | ||
|
|
||
|
|
||
| def test_active_gpu_is_left_unset(monkeypatch): | ||
| """Leave ``activeGpu`` unset: the renderer only applies the CUDA translation without it.""" | ||
| args, _ = _resolve_devices_and_kit_args({"device": "cuda:1", "multi_gpu": False}, monkeypatch) | ||
|
|
||
| assert args.get("active_gpu") is None | ||
|
|
||
|
|
||
| def test_user_supplied_device_setting_is_not_overridden(monkeypatch): | ||
| """Leave a caller-specified renderer device alone rather than adding a second setting.""" | ||
| args, kit_args = _resolve_devices_and_kit_args( | ||
| {"device": "cuda:1", "multi_gpu": False, "kit_args": "--/renderer/multiGpu/activeCudaGpus=3,"}, monkeypatch | ||
| ) | ||
|
|
||
| assert [arg for arg in kit_args if "activeCudaGpus" in arg] == ["--/renderer/multiGpu/activeCudaGpus=3,"] | ||
|
|
||
|
|
||
| def test_renderer_device_is_not_pinned_for_multi_gpu_rendering(monkeypatch): | ||
| """Leave the device unset when Kit renders across several GPUs in one process. | ||
|
|
||
| The setting fills the renderer's active-device list, and a one-element list would cap the | ||
| device count at one. | ||
| """ | ||
| _, kit_args = _resolve_devices_and_kit_args({"device": "cuda:1"}, monkeypatch) | ||
|
|
||
| assert not any("activeCudaGpus" in arg for arg in kit_args) | ||
Oops, something went wrong.
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.
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.
can you reduce the comment verbosity?