Unify `EGL_DEVICE_ID` in `dm_control` with `MUJOCO_EGL_DEVICE_ID` in `mujoco`
See original GitHub issueI’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:
- Created a year ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I completely forgot about this! Going to fix it for the upcoming
dm_control
release.Yes, that’s on our cleanup backlog. Render context management is the one thing that we haven’t unified across
mujoco
anddm_control
.I’ll transfer this issue over to the
dm_control
repo.