Add unified runtime and startup benchmark scripts (benchmark refactor, Part 2/5)#6198
Add unified runtime and startup benchmark scripts (benchmark refactor, Part 2/5)#6198AntoineRichard wants to merge 2 commits into
Conversation
e1f4ef7 to
935b759
Compare
Add training.py dispatching over --rl_library {rsl_rl, rl_games, skrl,
sb3}; each adapter runs real training under BenchmarkMonitor and emits a
TrainingBundle via the shared core, with an optional success-metric early
stop. Scripts use develop's launch API (launch_simulation from
isaaclab.app; preset tokens forwarded without folding). Remove the legacy
benchmark_rsl_rl.py / benchmark_rlgames.py scripts, the
run_training_benchmarks.sh runner shell, and the obsolete utils.py helper.
Part 3 of the benchmark refactor series (core -> runtime/startup ->
training -> play); stacked on Parts 1-2 (isaac-sim#6197, isaac-sim#6198).
Greptile SummaryThis PR adds unified
Confidence Score: 3/5The core library modules and tests are solid, but two data-correctness bugs in the entry scripts need fixing before the output can be trusted. In
Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant CLI as CLI / isaaclab.sh
participant RT as runtime.py / startup.py
participant Common as _common.py
participant Core as BaseIsaacLabBenchmark
participant Backends as MetricsBackend
participant Schema as SchemaBundleFile
participant Builders as builders.py
participant Capture as capture.py
CLI->>RT: argv
RT->>Common: get_backend_types(--benchmark_backend)
RT->>Common: preset_tokens(remaining)
RT->>Core: "__init__(backend_type=[...])"
Core->>Backends: get_instance(type) x N
Backends-->>Core: [SchemaBundleFile, OmniPerfKPIFile, ...]
RT->>Capture: capture_versions / capture_hardware / capture_resources
Capture-->>RT: Versions, Hardware, Resources
RT->>Builders: build_runtime_bundle / build_startup_bundle
Builders-->>RT: RuntimeBundle / StartupBundle
RT->>Core: attach_bundle(bundle)
RT->>Core: _finalize_impl()
loop for each backend
Core->>Backends: add_metrics(phase)
Core->>Backends: "finalize(path, filename_backend, bundle=bundle)"
alt "backend == schema"
Schema->>Schema: write_bundle_file(bundle, path)
else other backend
Backends->>Backends: write flat KPI JSON
end
end
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant CLI as CLI / isaaclab.sh
participant RT as runtime.py / startup.py
participant Common as _common.py
participant Core as BaseIsaacLabBenchmark
participant Backends as MetricsBackend
participant Schema as SchemaBundleFile
participant Builders as builders.py
participant Capture as capture.py
CLI->>RT: argv
RT->>Common: get_backend_types(--benchmark_backend)
RT->>Common: preset_tokens(remaining)
RT->>Core: "__init__(backend_type=[...])"
Core->>Backends: get_instance(type) x N
Backends-->>Core: [SchemaBundleFile, OmniPerfKPIFile, ...]
RT->>Capture: capture_versions / capture_hardware / capture_resources
Capture-->>RT: Versions, Hardware, Resources
RT->>Builders: build_runtime_bundle / build_startup_bundle
Builders-->>RT: RuntimeBundle / StartupBundle
RT->>Core: attach_bundle(bundle)
RT->>Core: _finalize_impl()
loop for each backend
Core->>Backends: add_metrics(phase)
Core->>Backends: "finalize(path, filename_backend, bundle=bundle)"
alt "backend == schema"
Schema->>Schema: write_bundle_file(bundle, path)
else other backend
Backends->>Backends: write flat KPI JSON
end
end
|
| start_utc = capture.now_utc_iso() | ||
| end_utc = capture.now_utc_iso() |
There was a problem hiding this comment.
start_utc / end_utc captured at the same instant — duration_s always ≈ 0
Both timestamps are obtained in consecutive calls inside _run_main, just before bundle assembly. build_run_identity derives duration_s from end_utc - start_utc, so it will always be microseconds even though the actual run lasted many seconds. Compare runtime.py, which captures start_utc before launch_simulation and end_utc after the stepping loop.
start_utc should be captured before the first profiled phase — either as a module-level variable (alongside _imports_time_begin) or passed into _run_main as a parameter so the elapsed wall time of the full profiling session is reflected in the bundle.
| module = importlib.util.module_from_spec(spec) | ||
| sys.modules[module_name] = module | ||
| spec.loader.exec_module(module) | ||
| return module |
There was a problem hiding this comment.
Incomplete module cached in
sys.modules if exec_module raises
The module is registered in sys.modules before exec_module executes it. If exec_module raises (e.g., a syntax error or import error in the target file), the half-initialized module object remains in the cache. A subsequent call with the same module_name hits the early-return path and silently returns the broken module instead of retrying or surfacing the original failure.
| module = importlib.util.module_from_spec(spec) | |
| sys.modules[module_name] = module | |
| spec.loader.exec_module(module) | |
| return module | |
| module = importlib.util.module_from_spec(spec) | |
| sys.modules[module_name] = module | |
| try: | |
| spec.loader.exec_module(module) | |
| except Exception: | |
| sys.modules.pop(module_name, None) | |
| raise | |
| return module |
Introduce the capture, metrics, builders, stepping, profiling, and backend_descriptor submodules for assembling the schema-v1 benchmark bundles, add a schema output backend, and let BaseIsaacLabBenchmark emit several backends in one run via a new attach_bundle hook. Unit tests cover each submodule plus the schema backend and multi-backend finalize. Part 1 of a series splitting the oversized benchmark refactor (core -> runtime/startup -> training -> play).
935b759 to
c248c6a
Compare
Add training.py dispatching over --rl_library {rsl_rl, rl_games, skrl,
sb3}; each adapter runs real training under BenchmarkMonitor and emits a
TrainingBundle via the shared core, with an optional success-metric early
stop. Scripts use develop's launch API (launch_simulation from
isaaclab.app; preset tokens forwarded without folding). Remove the legacy
benchmark_rsl_rl.py / benchmark_rlgames.py scripts, the
run_training_benchmarks.sh runner shell, and the obsolete utils.py helper.
Part 3 of the benchmark refactor series (core -> runtime/startup ->
training -> play); stacked on Parts 1-2 (isaac-sim#6197, isaac-sim#6198).
Add backend-agnostic runtime.py (random-action stepping, emits a RuntimeBundle) and startup.py (cProfile startup-phase profiling, emits a StartupBundle), wired to develop's launch API (launch_simulation and add_launcher_args from isaaclab.app; preset tokens forwarded to Hydra without folding). Remove the legacy benchmark_non_rl.py and benchmark_startup.py scripts plus the run_non_rl_benchmarks.sh and run_physx_benchmarks.sh runner shells; repoint benchmark_hydra_resolve at _common.get_backend_type. Part 2 of the benchmark refactor series (core -> runtime/startup -> training -> play); stacked on Part 1 (isaac-sim#6197).
c248c6a to
b50c1eb
Compare
Add training.py dispatching over --rl_library {rsl_rl, rl_games, skrl,
sb3}; each adapter runs real training under BenchmarkMonitor and emits a
TrainingBundle via the shared core, with an optional success-metric early
stop. Scripts use develop's launch API (launch_simulation from
isaaclab.app; preset tokens forwarded without folding). Remove the legacy
benchmark_rsl_rl.py / benchmark_rlgames.py scripts, the
run_training_benchmarks.sh runner shell, and the obsolete utils.py helper.
Part 3 of the benchmark refactor series (core -> runtime/startup ->
training -> play); stacked on Parts 1-2 (isaac-sim#6197, isaac-sim#6198).
Description
Part 2 of 5 of the benchmark refactor series — the unified non-RL entry scripts.
Series: Part 1/5 core (#6197) → Part 2/5 runtime + startup (this PR) → Part 3/5 training (#6199) → Part 4/5 play (#6201) → Part 5/5 cleanup.
This PR is purely additive — it adds the new scripts alongside the existing
benchmark_non_rl.py/benchmark_startup.py/run_*.sh, which keep working unchanged. Removal of the legacy scripts is deferred to Part 5/5 so downstream consumers can migrate at their own pace.Adds:
scripts/benchmarks/runtime.py— steps an environment with random actions (no policy) and emits aRuntimeBundle.scripts/benchmarks/startup.py—cProfilestartup-phase profiling (5 phases), emits aStartupBundle.scripts/benchmarks/_common.py— shared CLI helpers (get_backend_type(s),preset_tokens, module loader).Backends are selected with
presets=Hydra tokens (same astrain.py); the output format is chosen with--benchmark_backend(defaults toschema, accepts a comma-separated list, e.g.schema,omniperf). Existing OmniPerf / JSON / Osmo outputs are unchanged except for the additive peak rows contributed by Part 1's recorders.Validated on
develop(Newton/MJWarp): both smoke suites pass, including the multi-backend (schema,omniperf) run that emits two distinct output files.Fixes # (n/a)
Type of change
Checklist
pre-commitchecks with./isaaclab.sh --formattesting/benchmarks.rst,migration/comparing_simulation_isaacgym.rst)source/<pkg>/changelog.d/for every touched packageCONTRIBUTORS.mdor my name already exists there