Comparison of performance between source‑built and pip‑installed MuJoCo 3.3.4 #2738
Unanswered
kankanzheli
asked this question in
Asking for Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Intro
Hi MuJoCo team and community,
I’m investigating performance differences between building MuJoCo from source and installing the official wheel (via pip), both at version 3.3.4, under Conda environments. I’m seeing significantly different CPU usage and performance in RL training scenarios.
My setup
mujoco 3.3.4
python 3.10
ubuntu 22.04
torch 2.5.1
My question
✅ Test 1 – specs_test.py
pip-installed MuJoCo: Ran 32 tests in 0.031s
source-built MuJoCo: Ran 32 tests in 0.047s
This suggests pip-installed version is ~50% faster on basic tests.
✅ Test 2 – My custom multi-process RL code (2 environments)
Using htop, I observed:
pip version: each CPU core < 20% usage
source build: each core > 60%, multiple over 70%
🔍 Questions
What could cause this performance gap?
Is it possible to achieve comparable performance by re-building from source with appropriate flags?
Could you please share the full set of compiler flags used in the official wheel build?
I want to confirm if rebuilding with identical build configuration will allow my source-built version to match the performance of the official wheel.
Thanks for any advice or pointers!
I used the following commands to build mujoco from source
conda create -n mujoco-dev python=3.10
conda activate mujoco-dev
conda install pytorch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 pytorch-cuda=12.4 -c pytorch -c nvidia
git clone https://github.com/deepmind/mujoco.git
cd mujoco
mkdir build
cd build
pip install numpy cython wheel build
cmake ..
cmake --build .
cmake .. -DCMAKE_INSTALL_PREFIX=/home/ohya/Reinforcement/mujoco-base/mujoco/build/mujoco3.3_install
cmake --install .
PREFIX=/home/ohya/Reinforcement/mujoco-base/mujoco/build/mujoco3.3_install
mkdir -p "$PREFIX/bin/mujoco_plugin"
cp build/lib/libactuator.so build/lib/libelasticity.so build/lib/libsensor.so build/lib/libsdf_plugin.so "$PREFIX/bin/mujoco_plugin/"
cd mujoco/python
bash make_sdist.sh
cd dist
MUJOCO_PATH="$PREFIX" MUJOCO_PLUGIN_PATH="$PREFIX/bin/mujoco_plugin" pip install mujoco-3.3.4.tar.gz --force-reinstall
conda install -c conda-forge libstdcxx-ng=12
Minimal model and/or code that explain my question
No response
Confirmations
Beta Was this translation helpful? Give feedback.
All reactions