Skip to content

Distributed policy_runner on multi-gpu - #411

Merged
xyao-nv merged 13 commits into
mainfrom
xyao/feat/distributed_policy_runner
Feb 14, 2026
Merged

xyao-nv merged 13 commits into
mainfrom
xyao/feat/distributed_policy_runner

Conversation

@xyao-nv

@xyao-nv xyao-nv commented Feb 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Product/PerfLab requires multi-gpu supports for benchmarking ILA envs. The ask is kinda urgent -- 'by early Feb'. It also introduces a great potential to support running large-scale eval, e.g. on cloud.

Detailed description

  • Following how Lab handles multi-gpu , each gpu runs one process, each process has its own simulation instance and policy
  • Process group management is handled by SimApp, policy_runner just needs to assign the right device_id.
  • GR00T takes device_id to bring up its own copy on each gpu.
  • Metrics are recorded & computed per gpu to avoid multi-process write.

Results

  • Tested on 2xRTX 6000 Ada
  • Num_episodes in total = $\sum_{i=1}^{NumGpu}$ num_episodes_i
  • Empirically I see the process from one gpu could occupy some VRAM (~200Mib) to the other gpu. Unclear why.

TODO

  • Expand to RL & eval_runner
  • Add tests once mgpu CI runner is up

Notes for discussion

Arch

  • This setup may not be ideal, as policy may occupy a lot of RAM, and may be more efficient to run on one GPU. But the overhead from syncing between policy-gpu vs sim-gpu and tensor D2D copy are unknown.
  • Lab does not have other ways to support distributed. So Im sticking to it for now and revisit once we have client-server merged.

CI

  • There is no runner with >1 gpu on our CI now. It will be really helpful to have >1 GPU CI runners and then I can push a test to catch any breaking changes.

Heterogeneous env

  • Since each GPU spawns its own instance, it's feasible to load a different env_cfg on each rank. Like as a process launcher for multi-gpu.
  • That means each gpu could run diff task/robot/obj etc.
  • I wonder what the cost is. Is it free lunch?

@xyao-nv
xyao-nv marked this pull request as ready for review February 12, 2026 06:59

@alexmillane alexmillane left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this capability. This is really awesome. I had a couple of small comments.

Comment on lines +130 to +143
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_closedloop_policy.Gr00tClosedloopPolicy \
--policy_config_yaml_path isaaclab_arena_gr00t/policy/config/gr1_manip_gr00t_closedloop_config.yaml \
--num_steps 2000 \
--num_envs 10 \
--enable_cameras \
--headless \
--distributed \
gr1_open_microwave \
--embodiment gr1_joint

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coool!

isaac_lab_group.add_argument(
"--seed", type=int, default=None, help="Optional seed for the random number generator."
)
isaac_lab_group.add_argument("--seed", type=int, default=42, help="Optional seed for the random number generator.")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a behaviour change, we've moved to always having a seed? Is the intention here that we get the same results (ish) every time we run?

I'm thinking that this is probably a good change. It will make our results more deterministic.

What was your thinking here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think it's important that locking the seed to make the run more deterministic from eval perspective.

world_size = int(os.environ.get("WORLD_SIZE", "1"))
# Setting device to local rank before SimulationAppContext
if is_distributed(args_cli):
args_cli.distributed = True

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why set this True? It's checked in is_distributed, I'm wondering if there's some specific reason to set it here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great catch. forgot to remove, done.

Comment on lines +182 to +186
if seed is not None:
env.seed(seed)
torch.manual_seed(seed)
np.random.seed(seed)
random.seed(seed)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not from this MR, but shall we move this to isaaclab_arena/utils/random.py with a function called set_seeds()

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree. done

Comment on lines +138 to +140
local_rank = int(os.environ.get("LOCAL_RANK", "0"))
# world size is the number of processes running the script, set by torchrun command
world_size = int(os.environ.get("WORLD_SIZE", "1"))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion to wrap these in isaaclab_arena/utils/multiprocess.py with functions like get_local_rank and get_world_size

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +109 to +111
world_size = int(os.environ.get("WORLD_SIZE", "1"))
if world_size > 1 and "cuda" in config.policy_device:
local_rank = int(os.environ.get("LOCAL_RANK", "0"))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion to use functions (suggested above) for these

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +173 to +175
if is_distributed(args_cli) and hasattr(cfg, "recorders") and cfg.recorders is not None:
base = getattr(cfg.recorders, "dataset_filename", "dataset")
cfg.recorders.dataset_filename = f"{base}_rank{local_rank}"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about moving this into the ArenaEnvBuilder. The arena env builder could take an optional argument distributed=False. If True, we can update the file name where the recorder manager where it is composed.

Solving it in the ArenaEnvBuilder, rather than this script, means that the fix works where ever arena environments are built.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great suggestion. done

Comment on lines +117 to +135
.. tab:: 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_closedloop_policy.Gr00tClosedloopPolicy \
--policy_config_yaml_path isaaclab_arena_gr00t/policy/config/g1_locomanip_gr00t_closedloop_config.yaml \
--num_steps 1200 \
--num_envs 5 \
--enable_cameras \
--device cuda \
--policy_device cuda \
--distributed \
--headless \
galileo_g1_locomanip_pick_and_place \
--object brown_box \
--embodiment g1_wbc_joint

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing!

@xyao-nv
xyao-nv merged commit 709de39 into main Feb 14, 2026
5 checks passed
cvolkcvolk added a commit that referenced this pull request Nov 18, 2026
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.

## Why this change?

`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`.

## What changes?

- `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.

## Validation

- 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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants