question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unify `EGL_DEVICE_ID` in `dm_control` with `MUJOCO_EGL_DEVICE_ID` in `mujoco`

See original GitHub issue

I’m using EGL backend for GPU rendering of mujoco environments. I am using MUJOCO_EGL_DEVICE_ID environment variable to select which GPU should run for rendering, but this has no effect.

MUJOCO_GL=egl MUJOCO_EGL_DEVICE_ID=0 CUDA_VISIBLE_DEVICES=0 python run.py
MUJOCO_GL=egl MUJOCO_EGL_DEVICE_ID=1 CUDA_VISIBLE_DEVICES=1 python run.py
MUJOCO_GL=egl MUJOCO_EGL_DEVICE_ID=2 CUDA_VISIBLE_DEVICES=2 python run.py
...

and all the rendering happens in the first GPU (index 0):

[0] NVIDIA TITAN Xp | 29°C,   3 % |  2058 / 12196 MB | python(607M) python(86M) python(86M) python(86M) python(86M) python(86M) python(86M) python(86M)
[1] NVIDIA TITAN Xp | 29°C,  14 % |   987 / 12196 MB | python(521M)
[2] NVIDIA TITAN Xp | 29°C,   7 % |   987 / 12196 MB | python(521M)
[3] NVIDIA TITAN Xp | 28°C,   8 % |   987 / 12196 MB | python(521M)
[4] NVIDIA TITAN Xp | 29°C,   7 % |   987 / 12196 MB | python(521M)
[5] NVIDIA TITAN Xp | 26°C,   7 % |   987 / 12196 MB | python(521M)
[6] NVIDIA TITAN Xp | 30°C,   6 % |   987 / 12196 MB | python(521M)
[7] NVIDIA TITAN Xp | 28°C,   7 % |   987 / 12196 MB | python(521M)

I checked the code at https://github.com/deepmind/mujoco/blob/main/python/mujoco/egl/__init__.py#L35, and it seems the correct display was selected out of 8 available GPUs (telling from the debugger). Initialization is successful, but in the backend the designated GPU was not chosen.

  • OS: Linux 20.04 focal LTS
  • MuJoCo version: 2.1.0 (tried 2.2.x as well)
  • EGL installation:
ii  libegl-dev:amd64                       1.3.2-1~ubuntu0.20.04.2               amd64        Vendor neutral GL dispatch library -- EGL development files
ii  libegl-mesa0:amd64                     21.2.6-0ubuntu0.1~20.04.2             amd64        free implementation of the EGL API -- Mesa vendor library
ii  libegl1:amd64                          1.3.2-1~ubuntu0.20.04.2               amd64        Vendor neutral GL dispatch library -- EGL support
ii  libegl1-mesa-dev:amd64                 21.2.6-0ubuntu0.1~20.04.2             amd64        free implementation of the EGL API -- development files
ii  libwayland-egl1:amd64                  1.18.0-1                              amd64        wayland compositor infrastructure - EGL library

ii  libopengl-dev:amd64                    1.3.2-1~ubuntu0.20.04.2               amd64        Vendor neutral GL dispatch library -- OpenGL development files
ii  libopengl0:amd64                       1.3.2-1~ubuntu0.20.04.2               amd64        Vendor neutral GL dispatch library -- OpenGL support
  • python: PyOpenGL==3.1.6 (latest)
  • I’m using dm_control with mujoco==2.2.0 python bindings. (not mujoco_py)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
saran-tcommented, Dec 5, 2022

I completely forgot about this! Going to fix it for the upcoming dm_control release.

1reaction
saran-tcommented, Sep 7, 2022

Yes, that’s on our cleanup backlog. Render context management is the one thing that we haven’t unified across mujoco and dm_control.

I’ll transfer this issue over to the dm_control repo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found