Skip to content

Commit 07e1a8c

Browse files
committed
Request determinism from the play entrypoints too
apply_env_overrides is a training-entrypoint helper, so --deterministic reached neither the physics config nor Warp's global on the play paths, which build their own environments. They now share a request_determinism() helper, called before the environment exists so Warp's module-build-time read still sees it. Also qualify the reproducibility docs: the flag configures Warp through the RL entrypoints, not through AppLauncher, so a script that builds its own environment must set warp.config.deterministic itself.
1 parent 3d4a82c commit 07e1a8c

6 files changed

Lines changed: 34 additions & 6 deletions

File tree

docs/source/features/reproducibility.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ which the flag sets (see :ref:`below <reproducibility-warp-determinism>`).
4343
**Warp determinism.** Newton's solvers accept a ``deterministic`` argument that Isaac Lab supplies
4444
from :attr:`~isaaclab.physics.PhysicsCfg.deterministic`, and they apply it as a per-module option.
4545
Its sensor and geometry kernels take no such argument and fall back to ``warp.config.deterministic``,
46-
so ``--deterministic`` sets that global to ``RUN_TO_RUN`` as well. Without it the scene BVH is built
46+
so the RL training and play entrypoints set that global to ``RUN_TO_RUN`` when
47+
``--deterministic`` is passed. A script that builds its own environment without those entrypoints
48+
must set ``warp.config.deterministic`` itself, before the environment is created. Without it the scene BVH is built
4749
over an atomically compacted shape list whose order varies between processes, and a tiled camera can
4850
render a few pixels differently from identical simulation state. An explicitly chosen mode, such as
4951
``GPU_TO_GPU``, is left untouched.

source/isaaclab_rl/isaaclab_rl/entrypoints/backends/play_rl_games.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
apply_video_recording,
3131
create_isaaclab_env,
3232
pre_launch_video_config,
33+
request_determinism,
3334
resolve_checkpoint_selector,
3435
resolve_play_task_name,
3536
show_run_summary,
@@ -107,6 +108,8 @@ def main():
107108
train_task_name = task_name.replace("-Play", "")
108109

109110
env_cfg.scene.num_envs = args_cli.num_envs if args_cli.num_envs is not None else env_cfg.scene.num_envs
111+
# Warp reads its determinism mode at module build time, so request it before the env exists.
112+
request_determinism(args_cli, env_cfg)
110113
env_cfg.sim.device = args_cli.device if args_cli.device is not None else env_cfg.sim.device
111114

112115
if args_cli.seed == -1:

source/isaaclab_rl/isaaclab_rl/entrypoints/backends/play_rsl_rl.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
apply_video_recording,
3030
create_isaaclab_env,
3131
pre_launch_video_config,
32+
request_determinism,
3233
resolve_checkpoint_selector,
3334
resolve_play_task_name,
3435
show_run_summary,
@@ -126,6 +127,8 @@ def main(env_cfg: ManagerBasedRLEnvCfg | DirectRLEnvCfg | DirectMARLEnvCfg, agen
126127

127128
agent_cfg = cli_args.update_rsl_rl_cfg(agent_cfg, args_cli)
128129
env_cfg.scene.num_envs = args_cli.num_envs if args_cli.num_envs is not None else env_cfg.scene.num_envs
130+
# Warp reads its determinism mode at module build time, so request it before the env exists.
131+
request_determinism(args_cli, env_cfg)
129132

130133
agent_cfg = handle_deprecated_rsl_rl_cfg(agent_cfg, installed_version)
131134

source/isaaclab_rl/isaaclab_rl/entrypoints/backends/play_sb3.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
apply_video_recording,
2828
create_isaaclab_env,
2929
pre_launch_video_config,
30+
request_determinism,
3031
resolve_checkpoint_selector,
3132
resolve_play_task_name,
3233
show_run_summary,
@@ -112,6 +113,8 @@ def main():
112113
args_cli.seed = random.randint(0, 10000)
113114

114115
env_cfg.scene.num_envs = args_cli.num_envs if args_cli.num_envs is not None else env_cfg.scene.num_envs
116+
# Warp reads its determinism mode at module build time, so request it before the env exists.
117+
request_determinism(args_cli, env_cfg)
115118
agent_cfg["seed"] = args_cli.seed if args_cli.seed is not None else agent_cfg["seed"]
116119
env_cfg.seed = agent_cfg["seed"]
117120
env_cfg.sim.device = args_cli.device if args_cli.device is not None else env_cfg.sim.device

source/isaaclab_rl/isaaclab_rl/entrypoints/backends/play_skrl.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
create_isaaclab_env,
3333
pre_launch_video_config,
3434
preserve_attribute,
35+
request_determinism,
3536
resolve_checkpoint_selector,
3637
resolve_play_task_name,
3738
show_run_summary,
@@ -165,6 +166,8 @@ def _main():
165166
train_task_name = task_name.replace("-Play", "")
166167

167168
env_cfg.scene.num_envs = args_cli.num_envs if args_cli.num_envs is not None else env_cfg.scene.num_envs
169+
# Warp reads its determinism mode at module build time, so request it before the env exists.
170+
request_determinism(args_cli, env_cfg)
168171
env_cfg.sim.device = args_cli.device if args_cli.device is not None else env_cfg.sim.device
169172

170173
# configure the ML framework into the global skrl variable

source/isaaclab_rl/isaaclab_rl/entrypoints/common.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -493,11 +493,25 @@ def apply_env_overrides(args_cli: argparse.Namespace, env_cfg: Any, *, apply_dev
493493
# --deterministic is an AppLauncher flag, so it only reaches carb settings on its own.
494494
# Record the request on the resolved physics config; each backend translates and validates
495495
# it when the simulation starts.
496-
if getattr(args_cli, "deterministic", False):
497-
physics_cfg = getattr(getattr(env_cfg, "sim", None), "physics", None)
498-
if physics_cfg is not None:
499-
physics_cfg.deterministic = True
500-
request_warp_determinism(physics_cfg)
496+
request_determinism(args_cli, env_cfg)
497+
498+
499+
def request_determinism(args_cli: argparse.Namespace, env_cfg: Any) -> None:
500+
"""Record a ``--deterministic`` request on the config tree and on Warp's global.
501+
502+
Call this before the environment is created: Warp reads its setting at module build time
503+
and the scene BVH is built while the environment is constructed.
504+
505+
Args:
506+
args_cli: Parsed command-line arguments.
507+
env_cfg: Isaac Lab environment config.
508+
"""
509+
if not getattr(args_cli, "deterministic", False):
510+
return
511+
physics_cfg = getattr(getattr(env_cfg, "sim", None), "physics", None)
512+
if physics_cfg is not None:
513+
physics_cfg.deterministic = True
514+
request_warp_determinism(physics_cfg)
501515

502516

503517
def request_warp_determinism(physics_cfg: Any) -> None:

0 commit comments

Comments
 (0)