Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tensor_runtime_workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
"name": "unisim-core",
"repository": "https://github.com/unilabsim/unisim.git",
"ref": "develop/tensor-runtime",
"commit": "09d5caed9b604abf7a528560725d692e9d2562a9",
"commit": "5e835923e892e9f79213eac64565beb90b7bb074",
"path": "../unisim",
"sentinel_env": "UNILAB_LOCAL_UNISIM"
},
{
"name": "unilab-rl",
"repository": "https://github.com/unilabsim/unilab_rl.git",
"ref": "develop/tensor-runtime",
"commit": "75680c23f9bb750fdbaf6c0dee53d57e0c6a89e8",
"commit": "036fcba6a7c3c0f0b409ab0b19185f2931067632",
"path": "../unilab_rl"
},
{
Expand Down
16 changes: 16 additions & 0 deletions tests/base/test_genesis_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,26 @@
ResetRandomizationPayload,
)

import unilab.base.backend_factory as backend_factory
from unilab.base.backend_factory import create_backend, env_backend_kwargs
from unilab.base.base import EnvCfg
from unilab.base.scene import SceneCfg


@pytest.fixture(autouse=True)
def _bypass_cuda_only_platform_gate(monkeypatch: pytest.MonkeyPatch):
"""Exercise the adapter below the factory's CUDA-only platform gate.

The fail-closed gate (issue #1811 platform matrix) has dedicated coverage
in ``tests/base/test_cuda_backend_platform_preflight.py``. These
fake-runtime suites intentionally run on CUDA-less hosts, so the gate is
bypassed here to keep the adapter behavior under test reachable.
"""
monkeypatch.setattr(
backend_factory, "_validate_cuda_only_backend_platform", lambda *args, **kwargs: None
)


from .genesis_fake_runtime import ACTUATED_DOFS, N_LINKS, NQ, NV, make_fake_genesis

# Must stay in sync with the model spec in genesis_fake_runtime.py.
Expand Down
16 changes: 16 additions & 0 deletions tests/base/test_isaacgym_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,25 @@
from unisim.backend.isaacgym.sensors import scan_scene_metadata
from unisim.dr.types import IntervalTermOp

import unilab.base.backend_factory as backend_factory
from unilab.base.backend_factory import create_backend
from unilab.base.scene import SceneCfg


@pytest.fixture(autouse=True)
def _bypass_cuda_only_platform_gate(monkeypatch: pytest.MonkeyPatch):
"""Exercise the adapter below the factory's CUDA-only platform gate.

The fail-closed gate (issue #1811 platform matrix) has dedicated coverage
in ``tests/base/test_cuda_backend_platform_preflight.py``. These
mock-worker suites intentionally run on CUDA-less hosts, so the gate is
bypassed here to keep the adapter behavior under test reachable.
"""
monkeypatch.setattr(
backend_factory, "_validate_cuda_only_backend_platform", lambda *args, **kwargs: None
)


_MOCK_WORKER = str(Path(__file__).resolve().parent / "isaacgym_mock_worker.py")

SIM_DT = 0.005
Expand Down
16 changes: 16 additions & 0 deletions tests/base/test_isaacgym_fixed_variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,25 @@
from unisim.backend.isaacgym.backend import IsaacGymBackend
from unisim.dr.types import FixedVariantPlan, ModelSourceDescriptor

import unilab.base.backend_factory as backend_factory
from unilab.base.backend_factory import create_backend
from unilab.base.scene import SceneCfg


@pytest.fixture(autouse=True)
def _bypass_cuda_only_platform_gate(monkeypatch: pytest.MonkeyPatch):
"""Exercise the adapter below the factory's CUDA-only platform gate.

The fail-closed gate (issue #1811 platform matrix) has dedicated coverage
in ``tests/base/test_cuda_backend_platform_preflight.py``. These
mock-worker suites intentionally run on CUDA-less hosts, so the gate is
bypassed here to keep the adapter behavior under test reachable.
"""
monkeypatch.setattr(
backend_factory, "_validate_cuda_only_backend_platform", lambda *args, **kwargs: None
)


_MOCK_WORKER = Path(__file__).resolve().parent / "isaacgym_mock_worker.py"
_SIM_DT = 0.005
_DOF_NAMES = ("j0", "j1", "j2")
Expand Down
16 changes: 16 additions & 0 deletions tests/base/test_isaacsim_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,29 @@
from unisim.backend.isaacsim.scene_worker import _rotate
from unisim.backend.isaacsim.worker import _resolve_articulation_root_prim_path

import unilab.base.backend_factory as backend_factory
from unilab.base.backend_factory import (
_validate_isaacsim_tensor_cuda_ipc_runtime,
create_backend,
)
from unilab.base.base import EnvCfg
from unilab.base.scene import SceneCfg


@pytest.fixture(autouse=True)
def _bypass_cuda_only_platform_gate(monkeypatch: pytest.MonkeyPatch):
"""Exercise the adapter below the factory's CUDA-only platform gate.

The fail-closed gate (issue #1811 platform matrix) has dedicated coverage
in ``tests/base/test_cuda_backend_platform_preflight.py``. These
mock-worker suites intentionally run on CUDA-less hosts, so the gate is
bypassed here to keep the adapter behavior under test reachable.
"""
monkeypatch.setattr(
backend_factory, "_validate_cuda_only_backend_platform", lambda *args, **kwargs: None
)


_MOCK_WORKER = str(Path(__file__).resolve().parent / "isaacgym_mock_worker.py")
SIM_DT = 0.005
NUM_ENVS = 2
Expand Down
2 changes: 2 additions & 0 deletions tests/envs/locomotion/g1/test_g1_owner_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ def test_g1_walk_registries_are_manager_only() -> None:
98,
101,
id="sac-newton",
marks=pytest.mark.skipif(not torch.cuda.is_available(), reason="CUDA is unavailable"),
),
),
)
Expand Down Expand Up @@ -538,6 +539,7 @@ def test_g1_registry_executes_real_manager_runtime(
env.close()


@pytest.mark.skipif(not torch.cuda.is_available(), reason="CUDA is unavailable")
def test_g1_walk_newton_selected_reset_preserves_rows_and_rng() -> None:
"""The canonical Newton walk owner keeps selected reset row-scoped."""
registry.ensure_registries()
Expand Down
1 change: 1 addition & 0 deletions tests/envs/mdp/test_observations.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ def test_named_sensor_terms_bind_once_and_only_read_cached_views() -> None:
assert isinstance(gravity_term, mdp.projected_gravity_from_sensor)


@pytest.mark.skipif(not torch.cuda.is_available(), reason="CUDA is unavailable")
def test_cuda_manager_names_every_non_tensor_observation_term() -> None:
env, _ = _env()
cast(Any, env).device = torch.device("cuda", index=torch.cuda.current_device())
Expand Down
14 changes: 14 additions & 0 deletions tests/envs/test_env_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,20 @@ def test_flashsac_g1_motion_mujoco_tensor_command_roll_out() -> None:
state = env.step(torch.zeros((2, 29), dtype=torch.float32))
assert state.obs["obs"].shape == (2, 160)
assert torch.isfinite(state.obs["obs"]).all()
# Selected-row autoreset drives the tensor motion command through
# the packed host-bridge commit; it must not raise or step physics.
original_step = env.backend.step_tensor
step_calls = []

def count_step(*args, **kwargs):
step_calls.append(1)
return original_step(*args, **kwargs)

env.backend.step_tensor = count_step
env.reset(env_indices=torch.tensor([1], dtype=torch.int64))
assert not step_calls
state = env.step(torch.zeros((2, 29), dtype=torch.float32))
assert torch.isfinite(state.obs["obs"]).all()
finally:
env.close()
print("[mujoco tensor motion rollout] OK")
Expand Down
1 change: 0 additions & 1 deletion tests/scripts/test_benchmark_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
MARKER = "HISTORICAL SHELVED-BACKEND BENCHMARK (#1811)"
HISTORICAL_BENCHMARKS = (
"benchmark_drake_performance.py",
"outputs/velb_compare/micro_velb.py",
"physics/benchmark_isaacgym_fixed_variants.py",
"physics/benchmark_motrix_body_state_ab.py",
"physics/benchmark_motrix_set_state_ab.py",
Expand Down
8 changes: 8 additions & 0 deletions tests/training/test_soak.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ def _run_with_summary(tmp_path: Path, summary: object) -> dict[str, object]:


def test_g1_flashsac_soak_command_uses_owner_route(tmp_path: Path) -> None:
from importlib.util import find_spec

if find_spec("mujoco_warp") is None or find_spec("warp") is None:
pytest.skip("mjwarp extra is not installed")
command = build_g1_flashsac_mjwarp_command(
num_envs=16,
iterations=3,
Expand All @@ -123,6 +127,10 @@ def test_g1_flashsac_soak_command_rejects_owned_override(tmp_path: Path) -> None
)


@pytest.mark.skipif(
sys.platform != "linux",
reason="soak resource sampling reads the Linux /proc process tree",
)
def test_soak_monitor_accepts_completed_run(tmp_path: Path) -> None:
summary = _completed_summary()

Expand Down