Can't select GPU for EGL headless rendering
See original GitHub issueTL;DR - how can I select the GPU that the EGL headless rendering runs on? I want to use /dev/nvidia2 but it seems only /dev/nvidia0 is supported.
===
I have two machines in the cloud that are Docker containers of the same image (Ubuntu). When I run the code from the EGL offscreen rendering colab notebook as a Python script, one renders the bottle well, while the other gives me the error below. The working machine has its GPU mounted on /dev/nvidia0 while on the faulty machine it is on /dev/nvidia2.
It seems that egl_display = egl.eglGetDisplay(egl.EGL_DEFAULT_DISPLAY) tries picking on /dev/nvidia0 and fails if it is not available. Since I can’t control where will the GPU get mounted on my machine, is there a way to make OpenGL/EGL pick the other device? I tried multiple solutions found around the web, from different environment variables to creating a symlink, but to no avail.
The error:
Traceback (most recent call last):
File "colab", line 30, in <module>
r = pyrender.OffscreenRenderer(640, 480)
File "/miniconda/envs/foo/lib/python3.6/site-packages/pyrender/offscreen.py", line 31, in __init__
self._create()
File "/miniconda/envs/foo/lib/python3.6/site-packages/pyrender/offscreen.py", line 134, in _create
self._platform.init_context()
File "/miniconda/envs/foo/lib/python3.6/site-packages/pyrender/platforms/egl.py", line 177, in init_context
assert eglInitialize(self._egl_display, major, minor)
File "/miniconda/envs/foo/lib/python3.6/site-packages/OpenGL/platform/baseplatform.py", line 402, in __call__
return self( *args, **named )
File "/miniconda/envs/foo/lib/python3.6/site-packages/OpenGL/error.py", line 232, in glCheckError
baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
err = 12290,
baseOperation = eglInitialize,
cArguments = (
<OpenGL._opaque.EGLDisplay_pointer object at 0x7f7c9f107400>,
c_long(0),
c_long(0),
),
result = 0
)
Issue Analytics
- State:
- Created 4 years ago
- Comments:10
Top Related StackOverflow Question
I submitted a PR (https://github.com/mmatl/pyrender/pull/60) a couple months ago that does this.
Just set the environment variable
EGL_DEVICE_IDe.g.I also had the following issue:
OpenGL.error.GLError: GLError( err = 12290,It was related to incompatible versions of pyrender and PyOpenGL.
However, is not working for me using headless rendering with EGL. I now have the following error