openai / mujoco-py

MuJoCo is a physics engine for detailed, efficient rigid body simulations with contacts. mujoco-py allows using MuJoCo from Python 3.
Other
2.87k stars 813 forks source link

MjRenderContext does not render on device_id GPU #621

Open Kelly510 opened 3 years ago

Kelly510 commented 3 years ago

Describe the bug When I run training on multi-gpus and run the following part of the code, I hope to perform rendering on GPU 3 so I set device_id = 3. But GPU utilization message shows that the rendering actually perform on GPU 1.

# set ofscreen render contexts
print('offscreen render contexts on gpu', device_id)
print('before rendering:')
GPUtil.showUtilization()
self.mjr_render_context_offscreen = MjRenderContext(self.sim, offscreen=True, device_id=device_id, opengl_backend='egl')
print('after rendering:')
GPUtil.showUtilization()

The output is as following.

offscreen render contexts on gpu 3
before rendering:
| ID | GPU | MEM |
------------------
|  0 |  2% |  4% |
|  1 |  0% |  4% |
|  2 |  0% |  0% |
|  3 |  0% |  0% |
|  4 |  0% |  0% |
|  5 |  0% |  0% |
after rendering:
| ID | GPU | MEM |
------------------
|  0 |  0% |  4% |
|  1 |  7% |  8% |
|  2 |  0% |  0% |
|  3 |  0% |  0% |
|  4 |  0% |  0% |
|  5 |  0% |  0% |

Expected behavior Perform rendering on device_id gpu.

Error Messages Shown in Description part.

Desktop (please complete the following information):

Environment

zichunxx commented 2 years ago

Same issue. Do you figure this out?