[Performance] Eliminate parent LIBERO environment construction - #4028
[Performance] Eliminate parent LIBERO environment construction#4028vmoens wants to merge 2 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/4028
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
…tracebacks - Drop ParallelEnv-only kwargs (mp_start_method, metadata_from_workers) when serial_for_single falls back to SerialEnv instead of raising a TypeError, and retain mp_start_method when the env stays parallel - Expose the worker shutdown grace period as a shutdown_timeout constructor argument (also settable via configure_parallel) instead of a hardcoded 10s - Send the full worker traceback in metadata_error messages so construction failures are debuggable from the parent - Close transient metadata envs with raise_if_closed=False so a close failure cannot mask the metadata result or the original error - Document the identical-schema requirement and sequential shutdown of metadata_from_workers in the docstring and the vectorized-envs docs Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
35911c6 to
efac773
Compare
|
Reviewed the rebased head efac773, including the latest follow-up commit. The SerialEnv fallback now removes ParallelEnv-only arguments, worker construction failures preserve the full traceback, temporary metadata envs close on failure, and the configurable shutdown path reaps slow workers; these changes address the failure modes described in the updated commit and PR body. I ran the six metadata_from_workers tests plus test_callable_metadata_env_closes_when_extraction_fails locally: 7 passed. I did not find a blocking code issue in the current diff. Residual risk is the real LIBERO/OpenVLA and high-worker-count path, which I could not reproduce locally; the freshly triggered full CI is also still in progress. |
Summary
ParallelEnv(metadata_from_workers=True)startup handshake so real workers report and validate metadata without parent-side shadow environmentscreate_env_kwargsfor worker-specific assignment, while keepingspawnas the configured worker start methodRoot cause
VLA-GRPO built each LIBERO worker from a distinct partial, so
ParallelEnvclassified the batch as heterogeneous and constructed every environment serially in the parent for metadata. At 320 environments, that produced 320 temporary MuJoCo/EGL environments before constructing the 320 long-lived workers.Benchmark
The committed synthetic benchmark (
benchmarks/benchmark_parallel_env_startup.py) with 20 workers and a 10 ms constructor delay measured:The production LIBERO configuration (4 subcollectors x 80 environments on H200s) measured:
The successful
spawnrun retained all 10 task instructions per subcollector, the expected task/group offsets, worker indices, and seeds. Peak child-process counts were 81-82 per subcollector, the first environment step completed, and shutdown reported zero orphan worker processes. Theforkserverrun accumulated EGL allocations on GPU 0 rather than the requested per-subcollector render GPUs, so it is not enabled. Complete benchmark commands, logs, per-collector JSON, and process snapshots were retained with the run artifacts.spawnremains the VLA default.forkserveris reported as benchmark evidence only rather than being selected from a single startup stress run.Validation
pytest -q test/envs/test_parallel.pypytest -q sota-implementations/vla_grpo/test_openvla.py -k 'factory or instruction or group'pytest -q test/envs/test_special.py -k callable_metadata_env