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

How to default to EGL on GPU and OSMESA on CPU? #419

Open
danijar opened this issue Aug 17, 2023 · 0 comments
Open

How to default to EGL on GPU and OSMESA on CPU? #419

danijar opened this issue Aug 17, 2023 · 0 comments

Comments

@danijar
Copy link

danijar commented Aug 17, 2023

Right now, the preference order is glfw > egl > osmesa. In the common scenario of training an RL agent on a GPU machine, this means windows will pop up, which is typically not desired. I could also pin os.environ['MUJOCO_GL'] = 'egl' in my code to avoid this behavior. However, then the code will crash when running on a CPU-only machine.

Is there any way to set up my RL training code so that it will do headless rendering on GPU but osmesa on CPU, skipping the glfw backend? The goal here is for my RL training code to work out of the box when other people run it, without them having to set up their own env variable.

The potential workarounds I can think of all have their own downsides:

  • Detecting whether the machine has a GPU by asking the deep learning framework, to only set the backend to EGL if a GPU is available: This would require importing JAX inside the env processes and hog GPU memory.
  • Detecting whether the machine has a GPU by checking for common executable like nvcc or nvidia-smi: This doesn't work in many server environments (including internally at Google), where those binaries aren't available at runtime.

If DMC would just allow specifying a preference order for the backends or change the default to favor EGL over GLFW, that would simplify things a lot.

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

1 participant