Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Found 0 GPUs for rendering. Using device 0. #98

Closed
ggggfff1 opened this issue Dec 5, 2024 · 4 comments
Closed

Found 0 GPUs for rendering. Using device 0. #98

ggggfff1 opened this issue Dec 5, 2024 · 4 comments

Comments

@ggggfff1
Copy link

ggggfff1 commented Dec 5, 2024

Hi,

I have encountered some problems with MetaWorld evaluation on a headless server. I suspect that MuJoCo is failing to find a GPU for rendering. However, I have confirmed that my GPUs work properly during training. Have you encountered this issue when deploying DP3 on a remote server? Looking forward to your reply!

Here is the error message:

Found 0 GPUs for rendering. Using device 0.
Device id outside of range of available devices.
Traceback (most recent call last):
File "test.py", line 27, in
img = sim.render(12, 12, camera_name='corner2', depth=False, device_id=-1,mode='offscreen',)
File "mjsim.pyx", line 156, in mujoco_py.cymj.MjSim.render
File "mjsim.pyx", line 158, in mujoco_py.cymj.MjSim.render
File "mjrendercontext.pyx", line 46, in mujoco_py.cymj.MjRenderContext.init
File "mjrendercontext.pyx", line 114, in mujoco_py.cymj.MjRenderContext._setup_opengl_context
File "opengl_context.pyx", line 130, in mujoco_py.cymj.OffscreenOpenGLContext.init
RuntimeError: Failed to initialize OpenGL

Additionally, I referred to another issue, but it did not solve my problem.

Thank you for your help!

@YanjieZe
Copy link
Owner

YanjieZe commented Dec 5, 2024

This seems to be a problem in metaworld/mujoco/opengl. like this?
openai/mujoco-py#187

@wut19
Copy link

wut19 commented Dec 6, 2024

@ggggfff1 Have you handled this problem? I've met the same problem. Any suggestions?
Thank you.

@ggggfff1
Copy link
Author

ggggfff1 commented Dec 9, 2024

@ggggfff1 Have you handled this problem? I've met the same problem. Any suggestions? Thank you.

Hi, I found a solution, is to use

self.viewer = mujoco_py.MjRenderContextOffscreen(self.env.sim, None, device_id=self.device_id) 
self.viewer.render(self.image_size, self.image_size, self.env.sim.model.camera_name2id("corner2"))
img = self.viewer.read_pixels(self.image_size, self.image_size, depth=False)

instead of
img = self.env.sim.render(width=self.image_size, height=self.image_size, camera_name="corner2", device_id=self.device_id)
in 3D-Diffusion-Policy/diffusion_policy_3d/env/metaworld/metaworld_wrapper.py line130

but it will occur new problems. The eval speed will become slower and the result will become bad. @wut19

@ggggfff1
Copy link
Author

ggggfff1 commented Dec 9, 2024

This seems to be a problem in metaworld/mujoco/opengl. like this? openai/mujoco-py#187

I have tried this method, but it doesn't work. @YanjieZe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants