Skip to content

Accelerate and strengthen asset tests [3/13] - #8138

Closed
AntoineRichard wants to merge 4 commits into
isaac-sim:developfrom
AntoineRichard:antoiner/asset-tests-p05-ov-manager
Closed

AntoineRichard wants to merge 4 commits into
isaac-sim:developfrom
AntoineRichard:antoiner/asset-tests-p05-ov-manager

Conversation

@AntoineRichard

@AntoineRichard AntoineRichard commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Part 3/13 of the asset-test series (tracker: #7282). Scope: OVPhysX manager: CPU and CUDA simulations in one process. No dependencies.

#8139 and #8141 depend on this PR: their OVPhysX asset tests run CPU and CUDA scenes in one process and drop the
device_split marker.

What changed

OvPhysxManager pinned the first simulation device for the whole process, because the backend called
ovphysx.PhysX.set_cpu_mode(True) for CPU scenes. OVPhysX 0.6.3 still documents that mode as sticky: after a CPU
scene, set_cpu_mode(False) raises CPU-only mode is sticky once enabled, so a later CUDA scene cannot start.

  • The backend no longer enters the process-wide CPU-only mode, and the _locked_device check and its error are
    removed.
  • Every UsdPhysics.Scene in the stage selects the simulation device: CPU simulations author
    enableGPUDynamics=false and the MBP broadphase, GPU simulations true and the GPU broadphase. This is the
    per-scene path the OVPhysX developer guide recommends for mixed CPU/GPU processes. The simulation's physics scene
    still receives the full OVPhysX scene configuration. Other scenes, such as one authored by an asset, receive the
    device selection, because OVPhysX simulates them too and the schema default enables GPU dynamics.
  • Deployments that must keep OVPhysX off CUDA can set OVPHYSX_DISABLE_GPU (see the changelog fragment).
  • OVPhysX sensor, event, and view tests that no other PR touches drop their lock-skip fixtures and device_split.
    Each file runs its CPU and CUDA cases in one process and collects the same node IDs as the two-process run. The
    device_split marker description in pyproject.toml states what the marker does instead of the removed lock.

Evidence on OVPhysX 0.6.3:

  • CPU, CUDA, CPU and CUDA, CPU sequences run in one process.
  • CPU trajectories are bit-identical to develop's hard CPU-only mode; GPU trajectories differ.
  • A CPU scene that runs after a CUDA scene reports CPU-native state bindings, so no DirectGPU state leaks across.
  • Without the per-scene attributes, a "cpu" scene silently ran GPU dynamics. The same holds for an extra physics
    scene: with only the simulation's scene configured, a cube resting beside an extra UsdPhysics.Scene gave
    z(5) = 0.25812962651252747 on both CPU and CUDA; with every scene configured, the CPU run gives 0.2582125663757324,
    the value of develop's hard CPU-only mode.

Tests:

  • test_cpu_and_cuda_scenes_run_sequentially_in_one_process[cpu-cuda-cpu, cuda-cpu] (new, child process): device
    placement, binding placement, state I/O, and a reproducible trajectory for each CPU scene.
  • test_scenes_author_device_dynamics_and_broadphase[cpu, gpu] (new): the per-device attributes on the simulation's
    physics scene and on an extra scene authored for the other device.
  • test_manager_supports_pinned_runtime_api asserts the wheel's set_cpu_mode is never called.
  • The lifecycle fixture drops the removed _locked_device state.

Mutations of ovphysx_manager.py, each reverted, turn the tests red: re-adding set_cpu_mode(not is_gpu) (sequence
tests and pinned-runtime test), re-adding a first-device lock (sequence tests), authoring GPU dynamics for CPU scenes,
and skipping the scenes other than the simulation's (scene-attribute test).

No test is deleted. The lock-skip fixtures only skipped the other device's cases, which now run.

Timing

Warm Warp cache, repository orchestrator (./isaaclab.sh -p -m pytest tools, one process per file), second of two runs on one RTX 5090 shared with other jobs, so treat the numbers as indicative. Wall includes process startup. Develop numbers are from the same machine; develop ran device_split files in two processes.

Test file develop wall (s) this PR wall (s) Tests
sensors/test_contact_sensor.py 30.32 18.76 35 node IDs on both devices
sensors/test_frame_transformer.py 24.62 19.62 7
sensors/test_imu.py 21.21 14.98 11 + 2 pre-existing skips
sim/test_views_xform_prim_ovphysx.py 14.00 11.39 38
sensors/test_joint_wrench_sensor.py 13.75 8.23 9
test_randomize_rigid_body_collider_offsets_mdp.py 10.58 6.01 4
sensors/test_pva.py 8.44 6.06 10 + 2 pre-existing skips
test_randomize_rigid_body_material_mdp.py 6.52 3.56 2
physics/test_ovphysx_manager_lifecycle.py 3.11 7.77 27 → 31 (adds two child-process device sequences)
physics/test_ovphysx_scene_data_backend.py 1.80 1.76 31
Total 134.35 98.14

The develop contact-sensor count of 38 includes flaky reruns; both runs collect the same 35 node IDs.

Product bugs pinned

None.

Type of change

  • Bug fix and runtime change (OVPhysX manager)

Release backport

  • Backport this pull request to the active release branch after it merges into develop

Checklist

Docker and GPU tests run on demand. Push the commits you want tested, then
comment run-ci on the pull request.

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with uv run isaaclab --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have validated the changed behavior with focused coverage and applied the test-audit criteria to any test changes
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package (do not edit CHANGELOG.rst or bump package versions — CI handles that)
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

OvPhysxManager pinned the first simulation device for the whole process
because the backend entered the OVPhysX process-wide CPU-only mode, which
OVPhysX 0.6.3 still documents as irreversible. CPU scenes now leave that
mode off and select CPU dynamics per scene through enableGPUDynamics=false
and the MBP broadphase, as the OVPhysX developer guide recommends for mixed
CPU/GPU processes, so the device lock is removed.

A child-process test runs CPU, CUDA, CPU and CUDA, CPU scene sequences and
checks device placement, state I/O, and that each CPU scene reproduces the
same trajectory. A unit test pins the per-device scene attributes.
@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Fixes physics manager device switching within a process.

The PR appears safe to merge; no actionable issue was identified.

Summary

The PR replaces sticky process-wide CPU-only mode with per-scene dynamics selection, removes the first-device restriction, and adds cross-device lifecycle coverage.

  • CPU scenes author CPU dynamics and MBP broadphase; CUDA scenes author GPU dynamics and broadphase.
  • Sequential CPU/CUDA tests check native binding placement and state I/O.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Simulation device] --> B[Author physics-scene attributes]
  B --> C[Serialize and attach stage]
  C --> D[Create device-specific runtime bindings]
  D --> E[Close context before next scene]
Loading

Reviews (1) · Last reviewed commit: "Allow OVPhysX CPU and CUDA simulations i..."

The OVPhysX manager no longer pins the first simulation device, so the
lock-skip fixtures in these test files skipped the other device's cases
for a reason that no longer holds. Remove them and the device_split
marker; each file passes its CPU and CUDA cases in one process. Describe
the device_split marker by what it does rather than by the removed lock.
OVPhysX simulates every UsdPhysics.Scene in the stage, and the PhysX schema
default enables GPU dynamics. The manager configured only the simulation's
physics scene, so an extra scene, such as one authored by an asset, kept
GPU dynamics during a CPU simulation. Author the device's dynamics and
broadphase on every physics scene, and describe the change in the changelog.
@AntoineRichard AntoineRichard changed the title Accelerate and strengthen asset tests [5/24] Accelerate and strengthen asset tests [3/13] Sep 29, 2026
@StafaH

StafaH commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

Closing because the combined PR #7282 has merged. This split PR is superseded by #7282 and is no longer needed.

@StafaH StafaH closed this Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants