From e3adaa1cceaf4e565f6b9c1f0990f9b671b73350 Mon Sep 17 00:00:00 2001 From: Clemens Volk Date: Wed, 18 Nov 2026 10:07:59 +0100 Subject: [PATCH] Deprecate multi-GPU evaluation with torchrun (#1459) Deprecate multi-GPU evaluation with `torchrun` and `policy_runner.py --distributed`, and remove it from the evaluation tutorials. To use several GPUs, run an Experiment on OSMO, which runs each Run on its own GPU and combines the results; `policy_runner.py --distributed` still works but prints a `FutureWarning` until `policy_runner.py` is removed. `torchrun` evaluation is one of the reasons the docs still send users to `policy_runner.py`, which we plan to deprecate in favor of `experiment_runner.py`. We decided to drop it rather than port it, because its results were never combined into one evaluation. Running in parallel itself works: `torchrun` starts one `policy_runner.py` process per GPU, and each process runs the full step or episode budget with `--seed` plus its rank, so more GPUs evaluate more episodes in the same time. What doesn't work is everything after the rollouts: - **There is no combined result.** Each process prints its own `Metrics:` line, and nothing adds them up into one success rate. - **The report can miss results.** Only the process with local rank 0 calls `build_report`, right after its own `env.close()`, without waiting for the others. It reads only its own output directory, and each process picks a timestamped directory (`timestamped_run_dir`) after Isaac Sim starts, so processes that get there in different seconds write to different directories. - **Videos can overwrite each other.** Video file names don't include the rank, so processes that share a directory write over each other's videos. - **Seeds repeat across machines.** The seed offset is the rank within one machine (`LOCAL_RANK`), so with more than one machine every machine runs the same episodes. The tutorials only use one machine. No test or CI job covers it. It was added in #411 for multi-GPU benchmarking of Arena environments. Each process ran its own simulation and its own local GR00T policy (`Gr00tClosedloopPolicy`). #662 removed `Gr00tClosedloopPolicy`. - `policy_runner.py` emits a `FutureWarning` when it gets `--distributed`. The warning also says that ranks do not merge their metrics and that the report from local rank 0 can miss results from other ranks. The shared `--distributed` flag itself stays unchanged, because `environment_registration_callback` reads it when it starts the app for RL training. - The "Distribute Multi-GPU Evaluation" tabs are removed from `step_5_evaluation.rst` in `sequential_static_manipulation` and `locomanipulation`. The single-GPU commands remain. The parallel command on the `sequential_static_manipulation` page also gets the `--viz kit` it was missing. - The "Choosing a runner" note in `docs/pages/concepts/concept_arena_experiments.rst` and the "Hand off other workflows" list in `skills/user/run-experiment/SKILL.md` no longer mention `torchrun`. **Using several GPUs instead:** - **On one machine:** evaluate in one process with more environments (`environment_builder.num_envs` in an Experiment). - **On several GPUs:** submit the Experiment to OSMO with `osmo/submit_arena_experiment.py` (see the Multi-Node Evaluation page). `ArenaExperimentWorkflow` runs each Run in its own OSMO group, starts its policy server next to it if needed, and collects all Runs into one Experiment result and report. A single Run uses one GPU, so spreading one configuration over several GPUs means splitting it into several Runs, for example with different seeds. - **Limitation:** `Gr00tServerTask` on OSMO only serves the GR00T DROID checkpoint, so the GR1 and G1 GR00T tutorials that lose their multi-GPU tab cannot move to OSMO as they are. The RL training page `reinforcement_learning/step_2_policy_training.rst` still passes `--distributed` to `train.py`. There, Isaac Lab's training CLI and Arena's `environment_registration_callback` both read it, and multi-GPU training is not deprecated. The release notes are written when a release is cut, so the deprecation should be listed in the next release's notes. - Rebased onto `main` at `9b9e5b8350`. Before the rebase, CI passed: Run tests, Run tests with subprocess, GR00T closed-loop E2E, the docs build, and pre-commit. - Locally, in an Arena Docker image built from `main`: `test_distributed_evaluation_warns_about_deprecation` passes, `make SPHINXOPTS=-W html` in `docs/` passes, and `pre-commit` passes. - Not run locally: tests that start Isaac Sim. The image built from `main` uses PyTorch built for CUDA 13.0, which needs a newer NVIDIA driver than the test machine has. --------- Signed-off-by: Clemens Volk (cherry picked from commit 02a9b1e4130e50ae220798f38c997203315ce134) Signed-off-by: Clemens Volk --- .../concepts/concept_arena_experiments.rst | 5 +- .../locomanipulation/step_5_evaluation.rst | 61 +++------- .../step_5_evaluation.rst | 104 +++++------------- isaaclab_arena/evaluation/policy_runner.py | 12 +- isaaclab_arena/tests/test_policy_runner.py | 18 +++ skills/user/run-experiment/SKILL.md | 4 +- 6 files changed, 81 insertions(+), 123 deletions(-) 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.