Genesis icon indicating copy to clipboard operation
Genesis copied to clipboard

100% CPU load when using show_viewer True on Docker

Open Nulliik opened this issue 10 months ago • 8 comments
trafficstars

Environment:

  • OS: Windows, using Docker
  • GPU RTX 4090

I am trying to setup Genesis working under docker and render the visualization results to Widows X server. Currently everything works, but viewer is rendering scene only using the CPU, I believe it is bound to pyrender and pyopengl. My CPU usage is 100%, but as I turn shadows off it becomes lower and keeps at ~70%.

Setting os.environ["SDL_VIDEO_X11_FORCE_EGL"] = "1" and os.environ['PYOPENGL_PLATFORM'] = 'egl' results in

Exception in thread Thread-2 (_init_and_start_app):
Traceback (most recent call last):
  File "/opt/conda/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
  File "/opt/conda/lib/python3.11/threading.py", line 982, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/conda/lib/python3.11/site-packages/genesis/ext/pyrender/viewer.py", line 1142, in _init_and_start_app
    pyglet.clock.tick()
  File "/opt/conda/lib/python3.11/site-packages/pyglet/clock.py", line 528, in tick
    return _default.tick(poll)
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/pyglet/clock.py", line 270, in tick
    self.call_scheduled_functions(delta_t)
  File "/opt/conda/lib/python3.11/site-packages/pyglet/clock.py", line 217, in call_scheduled_functions
    item.func(now - item.last_ts, *item.args, **item.kwargs)
  File "/opt/conda/lib/python3.11/site-packages/genesis/ext/pyrender/viewer.py", line 936, in _time_event
    self.on_draw()
  File "/opt/conda/lib/python3.11/site-packages/genesis/ext/pyrender/viewer.py", line 635, in on_draw
    self._render()
  File "/opt/conda/lib/python3.11/site-packages/genesis/ext/pyrender/viewer.py", line 1079, in _render
    retval = renderer.render(self.scene, flags, seg_node_map=seg_node_map)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/genesis/ext/pyrender/renderer.py", line 141, in render
    self._update_context(scene, flags)
  File "/opt/conda/lib/python3.11/site-packages/genesis/ext/pyrender/renderer.py", line 899, in _update_context
    p._add_to_context()
  File "/opt/conda/lib/python3.11/site-packages/genesis/ext/pyrender/primitive.py", line 359, in _add_to_context
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, FLOAT_SZ * 3, ctypes.c_void_p(0))
  File "/opt/conda/lib/python3.11/site-packages/OpenGL/latebind.py", line 63, in __call__
    return self.wrapperFunction( self.baseFunction, *args, **named )
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/OpenGL/GL/VERSION/GL_2_0.py", line 469, in glVertexAttribPointer
    contextdata.setValue( key, array )
  File "/opt/conda/lib/python3.11/site-packages/OpenGL/contextdata.py", line 58, in setValue
    context = getContext( context )
              ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/OpenGL/contextdata.py", line 40, in getContext
    raise error.Error(
OpenGL.error.Error: Attempt to retrieve context when no valid context

Nulliik avatar Dec 26 '24 22:12 Nulliik