[Performance] Enable worker metadata for automatic parallel envs - #4093
[Performance] Enable worker metadata for automatic parallel envs#4093vmoens wants to merge 1 commit into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/4093
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (6 Unrelated Failures)As of commit e5726f0 with merge base 4169419 ( FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
ee9a6cb to
e5726f0
Compare
|
@ParamThakkar123 @itwasabhi, would you be able to review this follow-up? It automatically enables |
|
Sure @vmoens, I will review this one |
Summary
ParallelEnvfromnum_workersMotivation
metadata_from_workers=Truewas introduced in #4028 to avoid constructing temporary environments in the parent process. Convenience constructors such asGymEnv(..., num_workers=N)synthesized aParallelEnvwithout enabling that mode, so they still paid the parent-side construction cost unless users built theParallelEnvmanually.This follow-up makes the optimized path automatic when the generated workers have compatible tensor schemas. Gym's native
num_envsvectorization remains unchanged.User impact
Automatically generated process-based environments now start their workers during construction and use pipe-based communication (
use_buffers=False), as required by worker-originated metadata. Expensive simulator environments are no longer instantiated solely for metadata in the parent process.Validation
pytest -q test/envs/test_parallel.py -k metadata_from_workersnum_workerstests across Gym, LIBERO, Habitat, Genesis, MJLab, custom MuJoCo, Brax, DMControl, and MuJoCo Playgroundufmtrun directly from the cached Python 3.11 hook environment)Local result: 16 passed. Seven optional-dependency cases were collected and skipped because those dependencies or CUDA were unavailable locally; the
ci/optdepslabel requests their full CI coverage.