diff --git a/docs/pages/concepts/concept_arena_experiments.rst b/docs/pages/concepts/concept_arena_experiments.rst index 7fa3ca08177..67ad2aca473 100644 --- a/docs/pages/concepts/concept_arena_experiments.rst +++ b/docs/pages/concepts/concept_arena_experiments.rst @@ -233,9 +233,8 @@ Choosing a runner Use the **Experiment Runner** for policy evaluations defined in YAML. Use the **Environment Runner** (``isaaclab_arena/scripts/environment_runner.py``) to inspect and physically manipulate - an environment without a policy. The **Policy Runner** is currently needed only for ``torchrun`` - multi-GPU execution or policy evaluation of an external environment loaded with - ``--external_environment_class_path``. + an environment without a policy. The **Policy Runner** is currently needed only for policy + evaluation of an external environment loaded with ``--external_environment_class_path``. Related concepts diff --git a/docs/pages/example_workflows/locomanipulation/step_5_evaluation.rst b/docs/pages/example_workflows/locomanipulation/step_5_evaluation.rst index 82e8726a068..bd4bf3c802d 100644 --- a/docs/pages/example_workflows/locomanipulation/step_5_evaluation.rst +++ b/docs/pages/example_workflows/locomanipulation/step_5_evaluation.rst @@ -121,49 +121,24 @@ Step 2: Run Parallel Environments Evaluation Parallel evaluation of the policy in multiple parallel environments is also supported by the policy runner. -.. tab-set:: - - .. tab-item:: Single GPU Evaluation - - Test the policy in 5 parallel environments with visualization via the GUI run: - - .. code-block:: bash - - python isaaclab_arena/evaluation/policy_runner.py \ - --viz kit \ - --policy_type isaaclab_arena_gr00t.policy.gr00t_remote_closedloop_policy.Gr00tRemoteClosedloopPolicy \ - --policy_config_yaml_path isaaclab_arena_gr00t/policy/config/g1_locomanip_gr00t_closedloop_config.yaml \ - --remote_host 127.0.0.1 \ - --remote_port 5555 \ - --num_steps 1200 \ - --num_envs 5 \ - --enable_cameras \ - --device cuda \ - --policy_device cuda \ - galileo_g1_locomanip_pick_and_place \ - --object brown_box \ - --embodiment g1_wbc_joint - - .. tab-item:: Distribute Multi-GPU Evaluation - - Test the policy in 5 parallel environments on each GPU with 2 GPUs total run: - - .. code-block:: bash - - python -m torch.distributed.run --nnode=1 --nproc_per_node=2 isaaclab_arena/evaluation/policy_runner.py \ - --policy_type isaaclab_arena_gr00t.policy.gr00t_remote_closedloop_policy.Gr00tRemoteClosedloopPolicy \ - --policy_config_yaml_path isaaclab_arena_gr00t/policy/config/g1_locomanip_gr00t_closedloop_config.yaml \ - --remote_host 127.0.0.1 \ - --remote_port 5555 \ - --num_steps 1200 \ - --num_envs 5 \ - --enable_cameras \ - --device cuda \ - --policy_device cuda \ - --distributed \ - galileo_g1_locomanip_pick_and_place \ - --object brown_box \ - --embodiment g1_wbc_joint +Test the policy in 5 parallel environments with visualization via the GUI run: + +.. code-block:: bash + + python isaaclab_arena/evaluation/policy_runner.py \ + --viz kit \ + --policy_type isaaclab_arena_gr00t.policy.gr00t_remote_closedloop_policy.Gr00tRemoteClosedloopPolicy \ + --policy_config_yaml_path isaaclab_arena_gr00t/policy/config/g1_locomanip_gr00t_closedloop_config.yaml \ + --remote_host 127.0.0.1 \ + --remote_port 5555 \ + --num_steps 1200 \ + --num_envs 5 \ + --enable_cameras \ + --device cuda \ + --policy_device cuda \ + galileo_g1_locomanip_pick_and_place \ + --object brown_box \ + --embodiment g1_wbc_joint And during the evaluation, you should see the following output on the console at the end of the evaluation diff --git a/docs/pages/example_workflows/sequential_static_manipulation/step_5_evaluation.rst b/docs/pages/example_workflows/sequential_static_manipulation/step_5_evaluation.rst index ae4729c40b0..767d67ce70a 100644 --- a/docs/pages/example_workflows/sequential_static_manipulation/step_5_evaluation.rst +++ b/docs/pages/example_workflows/sequential_static_manipulation/step_5_evaluation.rst @@ -138,44 +138,22 @@ Step 2: Run Parallel environments Evaluation Parallel evaluation of the policy in multiple parallel environments is also supported by the policy runner. -.. tab-set:: - - .. tab-item:: Single GPU Evaluation - - Test the policy in 10 parallel environments with visualization via the GUI run: - - .. code-block:: bash - - python isaaclab_arena/evaluation/policy_runner.py \ - --policy_type isaaclab_arena_gr00t.policy.gr00t_remote_closedloop_policy.Gr00tRemoteClosedloopPolicy \ - --policy_config_yaml_path isaaclab_arena_gr00t/policy/config/gr1_manip_ranch_bottle_gr00t_closedloop_config.yaml \ - --remote_host 127.0.0.1 \ - --remote_port 5555 \ - --num_steps 2000 \ - --num_envs 10 \ - --enable_cameras \ - put_item_in_fridge_and_close_door \ - --embodiment gr1_joint \ - --object ranch_dressing_hope_robolab - - .. tab-item:: Distribute Multi-GPU Evaluation +Test the policy in 10 parallel environments with visualization via the GUI run: - Test the policy in 10 parallel environments on each GPU with 2 GPUs total run: - - .. code-block:: bash +.. code-block:: bash - python -m torch.distributed.run --nnode=1 --nproc_per_node=2 isaaclab_arena/evaluation/policy_runner.py \ - --policy_type isaaclab_arena_gr00t.policy.gr00t_remote_closedloop_policy.Gr00tRemoteClosedloopPolicy \ - --policy_config_yaml_path isaaclab_arena_gr00t/policy/config/gr1_manip_ranch_bottle_gr00t_closedloop_config.yaml \ - --remote_host 127.0.0.1 \ - --remote_port 5555 \ - --num_steps 2000 \ - --num_envs 10 \ - --enable_cameras \ - --distributed \ - put_item_in_fridge_and_close_door \ - --embodiment gr1_joint \ - --object ranch_dressing_hope_robolab + python isaaclab_arena/evaluation/policy_runner.py \ + --viz kit \ + --policy_type isaaclab_arena_gr00t.policy.gr00t_remote_closedloop_policy.Gr00tRemoteClosedloopPolicy \ + --policy_config_yaml_path isaaclab_arena_gr00t/policy/config/gr1_manip_ranch_bottle_gr00t_closedloop_config.yaml \ + --remote_host 127.0.0.1 \ + --remote_port 5555 \ + --num_steps 2000 \ + --num_envs 10 \ + --enable_cameras \ + put_item_in_fridge_and_close_door \ + --embodiment gr1_joint \ + --object ranch_dressing_hope_robolab And during the evaluation, you should see the following output on the console at the end of the evaluation @@ -211,45 +189,23 @@ Step 3: Multi-object Heterogeneous Evaluation This step demonstrates evaluation of the policy in heterogeneous environments with multiple objects. -.. tab-set:: +Test the policy in 10 parallel environments with visualization via the GUI run: + +.. code-block:: bash + + python isaaclab_arena/evaluation/policy_runner.py \ + --viz kit \ + --policy_type isaaclab_arena_gr00t.policy.gr00t_remote_closedloop_policy.Gr00tRemoteClosedloopPolicy \ + --policy_config_yaml_path isaaclab_arena_gr00t/policy/config/gr1_manip_ranch_bottle_gr00t_closedloop_config.yaml \ + --remote_host 127.0.0.1 \ + --remote_port 5555 \ + --num_steps 2000 \ + --num_envs 10 \ + --enable_cameras \ + put_item_in_fridge_and_close_door \ + --embodiment gr1_joint \ + --object_set ketchup_bottle_hope_robolab ranch_dressing_hope_robolab bbq_sauce_bottle_hope_robolab mayonnaise_bottle_hope_robolab - .. tab-item:: Single GPU Evaluation - - Test the policy in 10 parallel environments with visualization via the GUI run: - - .. code-block:: bash - - python isaaclab_arena/evaluation/policy_runner.py \ - --viz kit \ - --policy_type isaaclab_arena_gr00t.policy.gr00t_remote_closedloop_policy.Gr00tRemoteClosedloopPolicy \ - --policy_config_yaml_path isaaclab_arena_gr00t/policy/config/gr1_manip_ranch_bottle_gr00t_closedloop_config.yaml \ - --remote_host 127.0.0.1 \ - --remote_port 5555 \ - --num_steps 2000 \ - --num_envs 10 \ - --enable_cameras \ - put_item_in_fridge_and_close_door \ - --embodiment gr1_joint \ - --object_set ketchup_bottle_hope_robolab ranch_dressing_hope_robolab bbq_sauce_bottle_hope_robolab mayonnaise_bottle_hope_robolab - - .. tab-item:: Distribute Multi-GPU Evaluation - - Test the policy in 10 parallel environments on each GPU with 2 GPUs total run: - - .. code-block:: bash - - python -m torch.distributed.run --nnode=1 --nproc_per_node=2 isaaclab_arena/evaluation/policy_runner.py \ - --policy_type isaaclab_arena_gr00t.policy.gr00t_remote_closedloop_policy.Gr00tRemoteClosedloopPolicy \ - --policy_config_yaml_path isaaclab_arena_gr00t/policy/config/gr1_manip_ranch_bottle_gr00t_closedloop_config.yaml \ - --remote_host 127.0.0.1 \ - --remote_port 5555 \ - --num_steps 2000 \ - --num_envs 10 \ - --enable_cameras \ - --distributed \ - put_item_in_fridge_and_close_door \ - --embodiment gr1_joint \ - --object_set ketchup_bottle_hope_robolab ranch_dressing_hope_robolab bbq_sauce_bottle_hope_robolab mayonnaise_bottle_hope_robolab Each environment has a different object spawned from the object set. The same policy is used for all those environments. At then end of the evaluation, you should see the following output on the console indicating the metrics. diff --git a/isaaclab_arena/evaluation/policy_runner.py b/isaaclab_arena/evaluation/policy_runner.py index 20d2b1744ab..b9a0efcc4e9 100644 --- a/isaaclab_arena/evaluation/policy_runner.py +++ b/isaaclab_arena/evaluation/policy_runner.py @@ -8,6 +8,7 @@ import argparse import os import tqdm +import warnings from importlib import import_module from typing import TYPE_CHECKING @@ -154,12 +155,21 @@ def list_variations(args_parser: argparse.ArgumentParser) -> None: def main(): """Run an IsaacLab Arena environment with a policy. - Use --distributed with torchrun command for one process per GPU on multi-GPU machines. AppLauncher uses LOCAL_RANK for device. + Multi-GPU evaluation with --distributed and torchrun is deprecated. """ args_parser = get_isaaclab_arena_cli_parser() # We do this as the parser is shared between the example environment and policy runner args_cli, unknown = args_parser.parse_known_args() + if args_cli.distributed: + warnings.warn( + "Multi-GPU evaluation with --distributed and torchrun is deprecated and will be removed together with" + " policy_runner.py. Ranks do not merge their metrics, and the report from local rank 0 can miss results" + " from other ranks. Evaluate in one process with more environments (--num_envs), or run Experiment Runs" + " in parallel on OSMO.", + FutureWarning, + ) + local_rank = get_local_rank() world_size = get_world_size() # Setting device to local rank before SimulationAppContext diff --git a/isaaclab_arena/tests/test_policy_runner.py b/isaaclab_arena/tests/test_policy_runner.py index 3ef31458a88..fd52af316c7 100644 --- a/isaaclab_arena/tests/test_policy_runner.py +++ b/isaaclab_arena/tests/test_policy_runner.py @@ -162,3 +162,21 @@ def fail_when_simulation_starts(_args_cli): with pytest.raises(AssertionError, match="--viz none disables all visualizers"): policy_runner.main() + + +def test_distributed_evaluation_warns_about_deprecation(monkeypatch): + """Warn before startup that multi-GPU evaluation with --distributed is deprecated.""" + from isaaclab_arena.evaluation import policy_runner + + class StopBeforeSimulationStarts(Exception): + pass + + def stop_before_simulation_starts(_args_cli): + raise StopBeforeSimulationStarts + + monkeypatch.setattr(policy_runner, "SimulationAppContext", stop_before_simulation_starts) + monkeypatch.setattr("sys.argv", ["policy_runner.py", "--distributed"]) + + with pytest.warns(FutureWarning, match="--distributed and torchrun is deprecated"): + with pytest.raises(StopBeforeSimulationStarts): + policy_runner.main() diff --git a/skills/user/run-experiment/SKILL.md b/skills/user/run-experiment/SKILL.md index 29982105554..0467a30e860 100644 --- a/skills/user/run-experiment/SKILL.md +++ b/skills/user/run-experiment/SKILL.md @@ -145,8 +145,8 @@ preserved partial artifacts or failures. - Use `setup-arena` for installation, container creation, mounts, or readiness repair. - Use `run-tests` for pytest and regression checks. - Use the Environment Runner for interactive inspection without a policy. -- Use the Policy Runner for `torchrun`, external environments, or an explicitly requested direct - rollout outside an Experiment Definition. +- Use the Policy Runner for external environments or an explicitly requested direct rollout + outside an Experiment Definition. - Use a separate OSMO submission skill for previews, cluster resources, submission, monitoring, or remote result download. An unqualified request to "run" an Experiment means local execution. - Use `serve-openpi-policy` automatically when a local OpenPI Experiment needs a compatible server.