Skip to main content

Module batched

Module batched 

Source
Expand description

Batched simulation engine for vectorized RL training.

BatchedEngine owns N LockstepWorlds and steps them all in a single call, eliminating per-world FFI overhead. Observation extraction uses ObsPlan::execute_batch() to fill a contiguous output buffer across all worlds.

§Design

The hot path is step_and_observe: step all worlds sequentially, then extract observations in batch. The GIL is released once at the Python layer, covering the entire operation. This reduces 2N GIL cycles (the current MurkVecEnv approach) to exactly 1.

Parallelism (rayon) is deferred to v2. The GIL elimination alone is the dominant win; adding par_iter_mut later is a 3-line change.

Structs§

BatchResult
Result of stepping a batch of worlds.
BatchedEngine
Batched simulation engine owning N lockstep worlds.

Enums§

BatchError
Error from a batched operation, annotated with the failing world index.