MuJoCo 3 #1101
Replies: 13 comments 30 replies
-
Looks amazing! I knew some of these features were coming, but the extent of this release still surprises me! At our institute there is an ongoing discussion about whether to go with Isaac Sim or MuJoCo, but this settles it for me :) Of course at the end of the day, everyone should be free to choose the tools they feel comfortable with. But for me this release checks off a lot of requirements, I can't wait to integrate and play around with it. |
Beta Was this translation helpful? Give feedback.
-
Will DM control suite introduce functionality to run simulations on the GPU in the future? |
Beta Was this translation helpful? Give feedback.
-
Are RGBD and Lidar sensors in MuJoCo also accelerated? |
Beta Was this translation helpful? Give feedback.
-
Does it feature jax-transformable functions, just as brax? |
Beta Was this translation helpful? Give feedback.
-
Amazing work, excited to dive into the new features!! |
Beta Was this translation helpful? Give feedback.
-
Very exciting! How easy is it to batch the environment? In the tutorial notebook, I notice that the Model is batched over friction/gain/bias as an example, but can it enable batches of geometries? i.e., I'm simulating a humanoid like system and have various data based initial configurations for meshes that are all the same mesh topologically but are different shapes / sizes. Would it be possible to augment the geometries (and update corresponding inertias / physical properties) across a batch dimension once I have instantiated a blueprint mjModel/mjx.Model ? |
Beta Was this translation helpful? Give feedback.
-
Thanks for the release! From what I understand (but I may be wrong), |
Beta Was this translation helpful? Give feedback.
-
Will contact islands be supported for solvers other than CG? In particular for the currently default solver, Newton? |
Beta Was this translation helpful? Give feedback.
-
Are the binaries for MuJoCo 3 available for Unity? |
Beta Was this translation helpful? Give feedback.
-
Wow this seems really cool! Is there any data available in terms of the million steps per second for the humanoid model for the previous version of mujoco using a similar CPU so we can get a sense of scale of the speed improvement? |
Beta Was this translation helpful? Give feedback.
-
Will MJX support html rendering in colab like https://colab.research.google.com/github/google/brax/blob/main/notebooks/training.ipynb#scrollTo=kF5fS-yo35sI ? I teach RL labs and it's amazing we could potentially move away from isaac gym and just have students use colab. However, as far as I know, mujoco doesn't have an interactive renderer that is compatible with colab like with brax. |
Beta Was this translation helpful? Give feedback.
-
Great work! |
Beta Was this translation helpful? Give feedback.
-
The options to set collisions to all, predefined, and dynamic seems to have been removed in the MJCF modeling format 3.0.0 (https://mujoco.readthedocs.io/en/2.3.7/XMLreference.html#option-collision ), is there an alternative option we could set to enable / disable all collisions in MJCF? |
Beta Was this translation helpful? Give feedback.
-
MuJoCo 3
Bringing accelerator support to the MuJoCo ecosystem.
Two years ago, DeepMind took over the development of MuJoCo and made it freely available. Since then, the MuJoCo team made numerous versioned releases accompanied by a long list of new features, improved performance and memory footprint, and made it much easier for new users to get started. We also created the MuJoCo Menagerie, a curated collection of high-quality, ready-to-simulate models, from robot arms, to dogs and mobile manipulators. We have been energised by our steadily growing community on GitHub, and were blown away by the level of interest and engagement at our social event in London during ICRA earlier this year.
Building on this progress, the MuJoCo team recently joined forces with colleagues from Brax and Everyday Robots, who bring expertise in hardware acceleration and broader simulation infrastructure, to form an unified Robotics Simulation team within Google DeepMind. Today, as a result of our combined effort, we are announcing MuJoCo 3: a major new release of MuJoCo, which adds support for accelerator hardware, improves scalability on CPU, and introduces more versatile collision primitives to widen the range of simulatable objects.
The full changelog is available on the release page and in our documentation.
MuJoCo XLA: Accelerated physics with JAX
MuJoCo 3 brings support for accelerated simulation via the new MuJoCo XLA (MJX) module. You can run MuJoCo simulations at millions of steps per second on Google Cloud TPU or your own accelerator hardware.
You can install MJX via
pip install mujoco-mjx
, and documentation is available here.Seamless transition
Users of MuJoCo in Python can transition seamlessly between running MuJoCo on CPU, GPU, or TPU. The MJX API is nearly identical to MuJoCo, employing the same data model and simulation algorithms. Simulations in MJX will generally run in the same way as they do in MuJoCo, and machine learning models trained with MJX will operate the same in MuJoCo.
Blazingly fast simulation
MJX increases MuJoCo simulation throughput on a single machine, making it useful for data-hungry learning regimes such as reinforcement learning, evolution strategies, optimization for model predictive control, and more.
(CPU benchmarking was performed on an
n2d-standard-128
GCE instance)In the benchmark above, although classic MuJoCo can provide high throughput on machines with many CPU cores, the Python bindings are subject to the Global Interpreter Lock (GIL). As such, pure Python code cannot benefit from using threads to scale over available CPU cores. Python users upgrading from classic MuJoCo to MJX can expect to see a big increase in throughput through batching.
Because MJX runs on specialised hardware, it has unique performance characteristics that may require some model tuning, see documentation for details.
Speedy machine learning
MJX makes it easy to simulate big batches of environments to power reinforcement learning. This Colab notebook provides an example that teaches Google’s Barkour robot to run using MJX and Brax’s PPO trainer. We train a policy that can be deployed on a real robot and compare the training time to the Barkour publication, which used Nvidia Isaac Gym.
Support for major hardware vendors through an open source ecosystem
MJX is built on XLA, which allows it to run on Nvidia, AMD, and Apple Silicon GPUs, as well as Google Cloud TPUs.
Scalability and parallelism
MuJoCo offers unparalleled speed for small and medium-sized scenes, but large, building-scale scenes with hundreds of robots or free bodies are not handled well. For CPU-based MuJoCo, we have made significant progress in this direction, with ongoing work to enable full support of very large scenes.
Memory sparsification
MuJoCo already uses sparse algebra for large models, but several key matrices use dense memory allocation, while touching only non-zero entries. As a result, very large models simply do not fit in available memory. We have completed the memory-compression refactor for the Conjugate Gradient solver, which reduced the memory footprint of a scene with a humanoid and 100 free objects by a factor of 80, and are almost done sparsifying the remaining algorithms.
Contact islands and multi-threading
Until today, when we spoke about multithreading in MuJoCo, we talked about running many instances of the same scene in parallel. This threading model is useful for optimization and reinforcement learning, but does not speed up cases where a single large scene is being simulated, for example in gaming.
In order to speed up a single, large scene, MuJoCo 3 detects “contact islands”: sub-components of the scene which do not interact. For example in a scene with two robots, they are assigned to separate islands as long as the robots don’t touch each other. Islands can be solved-for independently, for example on separate threads. Using a new thread-pool API, designed to exploit such parallelization opportunities, a model with 22 humanoids runs 3x faster. Threading over contact islands is currently only implemented for the Conjugate Gradient solver, implementation for all other solvers is in progress.
Other such intra-scene parallelization opportunities, for example collision detection, are also forthcoming.
Non-convex geometries
MuJoCo 3 adds support for collision geometries defined via signed distance functions (SDFs), allowing users to create new primitives by specifying the distance from any given location to the closest point on a surface. These geometries are not constrained to be convex. We provide examples of what is possible including tori, gears, nuts and bolts. Additionally, users can import any mesh and generate a multiresolution voxelized SDF at model compilation time.
In contrast to meshes, SDFs allow the number of contacts to be independent from the mesh resolution, making the cost of collision detection cheaper and more predictable. MuJoCo 3 SDFs can collide with all existing MuJoCo primitives and meshes.
Deformable bodies
MuJoCo 3 introduces a new kind of deformable body called flex. These are collections of segments (1D), triangles (2D) and tetrahedra (3D), corresponding to rope, cloth and deformable volumetric shapes like biological tissue. Flex bodies are not defined in a hierarchical kinematic tree, and can therefore simulate closed loop structures of any topological genus like rubber bands and T-shirts.
Deformation can be controlled either with equality constraints (for relatively stiff bodies) or with passive forces (for relatively soft bodies).
The Robotics Simulation Team
(in alphabetical order) Kyle Bayes (@kbayes), Matthew Bennice (@crewmatt), Tom Erez (@erez-tom), Erik Frey (@erikfrey), Chuyuan Kelly Fu, Nimrod Gileadi (@nimrod-gileadi), Alessio Quaglino (@quagla), Baruch Tabanpour (@btaba), Yuval Tassa (@yuvaltassa), Saran Tunyasuvunakool (@saran-t)
Beta Was this translation helpful? Give feedback.
All reactions