docker-nvidia-egl-desktop icon indicating copy to clipboard operation
docker-nvidia-egl-desktop copied to clipboard

Choosing a specific GPU device rendering in docker console? / VGL_DISPLAY for VirtualGL

Open sbx126 opened this issue 3 years ago • 7 comments

Hi,

Thanks for this great project. It helps a lot and we really appreciate it. We follow the instructions to run that docker container and it works. How to have GPU-based rendering in docker console?

However, when we try to choose a specific GPU device rendering in docker console, it seems not work.

NVIDIA_VISIBLE_DEVICES=2 vglrun /opt/VirtualGL/bin/glxspheres64 CUDA_VISIBLE_DEVICES=2 vglrun /opt/VirtualGL/bin/glxspheres64

We try some command above, but vglrun still run on the device 1. Could you give us some advice for that?
Thank you very much.

sbx126 avatar Aug 16 '22 07:08 sbx126

Hi, this is because the default GPU for EGL is used in https://github.com/ehfd/docker-nvidia-egl-desktop/blob/main/entrypoint.sh#L33. I'll add an envvar for this for easy changes.

ehfd avatar Aug 17 '22 13:08 ehfd

@sbx126 You can override using export VGL_DISPLAY="/dev/dri/card0" or use vglrun -d /dev/dri/card0. Note that the specific device must be provisioned using docker --device=/dev/dri. More complicated with Kubernetes and keeping VGL_DISPLAY to default is recommended in this case.

ehfd avatar Aug 18 '22 10:08 ehfd

Background: Our compute clusters, all managed via Slurm, the /dev/dri/card[n] devices are either not all present or have restrictive permissions . We can only use Singularity instead of docker. We'll find out the similar method as docker --device=/dev/dri.

Thank you very much!

sbx126 avatar Aug 19 '22 03:08 sbx126

@sbx126 Interesting, could you please try both https://github.com/ehfd/docker-nvidia-egl-desktop and https://github.com/ehfd/docker-nvidia-glx-desktop ? And also, VGL_DISPLAY is meant to be set as egl if in Singularity, as --device=/dev/dri is not required this way. Not advised to change.

ehfd avatar Aug 19 '22 04:08 ehfd

--device=/dev/dri and vglrun -d /dev/dri/card[n] works for the docker.

In Singularity, just --nv is OK, if have permissions. With restrictive permissions, we install virtualgl=3.0.2 from virtualgl PreReleases. Then we use vglrun -d egl[n], it works. https://github.com/VirtualGL/virtualgl/pull/207

Thank you very much for helping.

sbx126 avatar Aug 19 '22 17:08 sbx126

I'll update to vgl 3.0.2 when the official release is out. Closing after an option to set this variable is implemented.

ehfd avatar Aug 20 '22 08:08 ehfd

Specifying VGL_DISPLAY via environment variables is now possible. Closing when 3.0.2 is added.

ehfd avatar Aug 24 '22 08:08 ehfd

Version 3.0.2 is here.

ehfd avatar Oct 21 '22 15:10 ehfd