Skip to content

Software

mjbatch

From github.com/kevinzakka/mjbatch (opens in a new tab)

  • Simulators
  • Library
  • Apache-2.0

A Python library for running thousands of MuJoCo physics simulations in parallel on the CPU, now archived because batched simulation moved into MuJoCo itself.

Facts

GitHub stars
615read on 6 Nov 2026
Last update
22 Oct 2026Newest commit on main
Maintenance
Activea commit in the last 90 days
Difficulty
Advanced
Hardware it needs, as the project states it
A computer with a display is needed only for examples that open a window; --headless runs without one.

Checked on GitHub on 6 Nov 2026.

Licenses

Code
Apache-2.0 (opens in a new tab)

Read by Robotheca from LICENSE (opens in a new tab) (Apache-2.0) at commit 4cba779 (opens in a new tab), on 22 Oct 2026.

Commercial use
Yes

Overview

What it does: Robotheca's summary

  • Runs many MuJoCo simulations at once using a C++ thread pool that releases the GIL.
  • Gives live array access to simulation state and controls across the whole batch via bind.
  • Allows per-simulation model parameters through expand, and recomputes derived constants with set_const.
  • Includes example applications for RL, MPC, system identification and hardware co-design.

Written by Robotheca from the project's README (opens in a new tab) at commit 4cba779, not by its creator.

The README

The creator's own README, copied as written: README.md by @kevinzakka, at commit 4cba779, under Apache-2.0 (opens in a new tab). The original on GitHub (opens in a new tab).

Read the README here

mjbatch

(opens in a new tab) (opens in a new tab)

mjbatch is a Python library for running thousands of MuJoCo simulations in parallel on CPU.

[!NOTE] This repository is archived. Batched simulation is now part of MuJoCo itself, which this project inspired. Please use the mjbatch API (opens in a new tab) in the main repository instead.

Features include:

  • C++ thread pool execution, with the GIL released;
  • Live array access to simulation state and controls across the batch, with bind for MjData fields;
  • Per-simulation model parameters, with expand for MjModel fields and set_const to recompute derived constants.

For example:

import mujoco, numpy as np
from mjbatch import Batch

model = mujoco.MjModel.from_xml_path("scene.xml")
batch = Batch(model, num_sims=4096)  # threads default to every logical CPU
qpos, ctrl = batch.bind("qpos"), batch.bind("ctrl")
batch.expand("geom_friction")[:, :, 0] = np.random.uniform(0.4, 1.2, (4096, 1))
for _ in range(1000):
  ctrl[:] = policy(qpos)             # your controller, all 4096 at once
  batch.step()                       # step them in parallel; qpos updates in place
Examples

We showcase a range of applications built using mjbatch: RL, MPC, SysID, and hardware co-design. Each example is a self-contained, performant implementation. For instance, the Go1 RL controller learns to walk in under a minute on a five-year-old M1 laptop.

Run with uv run examples/<file>.py; some need uv sync --group examples. The ones that open a window need a display; --headless runs the solver without one.

License

Apache-2.0.

Files and versions

Facts read at commit 4cba779

Robotheca never hosts the code: each link goes to the creator's own page.

Use it

How to install it, in the creator's words: The project's README (opens in a new tab)

Robotheca doesn't review code. Read it before running it.

Robotheca lists software as a reference: nothing is hosted or run here, and every fact links to where it was read.