sail-sg/envpool
C++-based high-performance parallel environment execution engine (vectorized env) for general RL environments.
What it solves
EnvPool addresses the performance bottleneck in reinforcement learning (RL) caused by slow environment simulation. Traditional Python-based vector environments often suffer from high overhead due to subprocesses, limiting the throughput of experience collection. EnvPool provides a high-performance, C++-based execution engine that allows for massive parallelization of environments with significantly higher frames-per-second (FPS) than standard Python implementations.
How it works
EnvPool is implemented in C++ and uses pybind11 to provide a Python interface. It manages a pool of environments and utilizes a thread pool to execute them in parallel. It supports two primary interaction modes:
- Synchronous API: Closely follows Gymnasium and dm_env APIs, where
stepandresetfunctions operate on batches of environments by default. - Asynchronous API: Splits the
stepfunction intosendandrecvoperations, allowing the user to feed actions and retrieve states without waiting for the entire batch to complete, further increasing efficiency.
It integrates with XLA via JAX jit functions and is compatible with major RL libraries like Stable-Baselines3, Tianshou, and CleanRL.
Who it’s for
It is designed for reinforcement learning researchers and developers who need to collect large amounts of experience quickly to train agents, particularly those using computationally expensive environments like Atari, MuJoCo, or various robotics simulators.
Highlights
- Extreme Throughput: Capable of reaching ~1M Atari FPS and ~3M MuJoCo steps per second on high-end hardware (DGX-A100).
- Broad Environment Support: Includes Atari, MuJoCo, Box2D, DeepMind Control Suite, ViZDoom, and more.
- Cross-Platform: Available for Linux, macOS, and Windows.
- Flexible APIs: Compatible with Gymnasium and dm_env; supports both sync and async execution.
- Built-in Rendering: Supports batched
rgb_arrayoutput andhumandisplay mode. - C++ Extensibility: Provides a developer API for integrating custom C++ environments.
Related
- Project
- Project
- Dispatch
- Project
- Project