📣 MuJoCo Playground works with MuJoCo Warp! 📣 (in Beta) #197
Pinned
btaba
announced in
Announcements
Replies: 4 comments 7 replies
-
For posterity, here are the learning curves as of 229fb1f. The orange curve is Warp, and the green one is JAX. DM Control![]() ![]() ![]() ![]() Locomotion![]() ![]() ![]() ![]() Manipulation![]() ![]() |
Beta Was this translation helpful? Give feedback.
6 replies
-
@btaba you’re a legend |
Beta Was this translation helpful? Give feedback.
0 replies
-
Very cool! I was hitting lots of nan errors while using JAX in a custom environment and they went away after switching to --impl=warp |
Beta Was this translation helpful? Give feedback.
0 replies
-
Beta Was this translation helpful? Give feedback.
1 reply
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello Playground users!
As of 229fb1f, MuJoCo Warp is available in MuJoCo Playground and MJX for all environments. MuJoCo Warp is still in beta in Playground (until the 1.0.0 release), but we have good parity in terms of reward behavior compared to the MuJoCo JAX implementation. We encourage users to start tinkering with Warp in your environments!
Try it out now with:
What is MuJoCo Warp?
MuJoCo Warp is an implementation of MuJoCo implemented in Warp. Similarly to JAX, Warp allows one to write GPU code in Python, and compile just-in-time to run on a GPU. Warp is targeted specifically to NVIDIA GPUs, which enables thread divergent code (SIMT). That means we can now generate a dynamic number of contacts and constraints per physics step. Previously in JAX, we were forced to generate a fixed number of contacts/constraints per step (SIMD).
tl;dr MuJoCo Warp allows us to scale MuJoCo GPU simulation to much larger scenes!
What is MJX-Warp?
MJX-Warp is simply MJX hooked up to MuJoCo Warp. You can think of MJX-Warp as the JAX frontend API to MuJoCo Warp.
How do I migrate from MJX to MJX-Warp?
If you are familiar with MJX, you've probably generated an MJX model and data via:
To start using MJX-Warp, simply add the
impl
argument:In MuJoCo Playground,
impl
was added to all environment configs (example), which you can simply flip towarp
.nconmax
/njmax
You may have noticed that there are two additional parameters that we pass to
make_data
.nconmax
defines the maximum number of contacts for all worlds combined.njmax
defines the maximum number of constraints per world.If you are developing a new scene, these parameters should be tuned by loading them in the viewer and increasing the values accordingly as overflows occur. Don't forget to then scale
nconmax
by the number of environments you'll wind up using during training!Exposing Contacts
As of MuJoCo 3.3.5, contacts were moved from
mjx.Data.contact
to privatemjx.Data._impl
. Since JAX and Warp diverge in their implementations of contact buffers, we encourage users to read out contacts solely through contact sensors. You can find many examples in Playground (e.g. here and here). In the environment, you can read sensor values as such.Why should I use MJX-Warp?
If you are simulating locomotion, loco-manipulation, or manipulation environments with a medium to large number mesh collisions, we encourage you to use the Warp implementation. JAX is performant for a small number of fixed collisions and primitive collisions, but Warp scales much better for medium to large scenes. As an example, many of the Playground manipulation environments have 1.5-2x higher throughput with Warp! If you are already using MJX, the switch to Warp was designed to be as seamless as possible.
Caveats
JAX support
Rewards
legacy_gjk
. We are working to fix this issue as well in MuJoCo Warp.Beta Was this translation helpful? Give feedback.
All reactions