MuJoCo Batching That Finally Drops the GIL
mjbatch exists so you can run thousands of MuJoCo simulations in parallel on CPU without Python’s GIL getting in the way.

What it does
mjbatch is a Python wrapper around a C++ thread pool that steps thousands of MuJoCo simulations concurrently on CPU. It exposes batched states and controls as NumPy arrays you can read and write directly via bind, and supports per-simulation model variations through expand and set_const. The target use cases are RL, MPC, system identification, and hardware co-design.
The interesting bit Instead of wrapping a GPU simulator or forcing you to manage processes, the library releases the GIL and keeps the concurrency in C++, yet still lets you manipulate live arrays across the entire batch with NumPy ergonomics. That design is what lets a five-year-old M1 laptop train a quadruped gait in under a minute, according to the README.
Key highlights
- C++ thread pool with the GIL fully released; Python overhead does not scale with sim count.
- Live NumPy array access to batched
MjDatafields viabind, plus per-simMjModeltweaks viaexpandandset_const. - Self-contained reference implementations for RL, MPC, system ID, and hardware co-design.
- The Go1 quadruped RL example is claimed to train a walking gait in under a minute on an older M1 MacBook.
- Runs entirely on CPU; no GPU required.
Verdict Grab it if you need batched robot rollouts on CPU-bound machines or want vectorized MuJoCo without rewriting controllers in C++. Look elsewhere if you are already locked into a GPU physics backend like Isaac Gym.
Frequently asked
- What is kevinzakka/mjbatch?
- mjbatch exists so you can run thousands of MuJoCo simulations in parallel on CPU without Python’s GIL getting in the way.
- Is mjbatch open source?
- Yes — kevinzakka/mjbatch is open source, released under the Apache-2.0 license.
- What language is mjbatch written in?
- kevinzakka/mjbatch is primarily written in Python.
- How popular is mjbatch?
- kevinzakka/mjbatch has 521 stars on GitHub.
- Where can I find mjbatch?
- kevinzakka/mjbatch is on GitHub at https://github.com/kevinzakka/mjbatch.