selkies-project / docker-nvidia-egl-desktop

KDE Plasma Desktop container designed for Kubernetes, supporting OpenGL EGL and GLX, Vulkan, and Wine/Proton for NVIDIA GPUs through WebRTC and HTML5, providing an open-source remote cloud/HPC graphics or game streaming platform.
https://github.com/selkies-project/docker-nvidia-egl-desktop/pkgs/container/nvidia-egl-desktop
Mozilla Public License 2.0
227 stars 48 forks source link

Choosing a specific device ID for NVIDIA GPUs #9

Closed k7 closed 3 years ago

k7 commented 3 years ago

Thanks for your great job!

I have success run docker-nvidia-egl-desktop:latest.

However, I happened to this problem and failed.

I want to run Calar simulator which need to run in ubuntu 18.04.

It would be great to provide 18.04 version too.

Here is some information run in docker.

docker run --gpus 4 --device=/dev/dri:rw -it  -e SHARED=TRUE -e VNCPASS=vncpasswd -p 5901:5901 ehfd/nvidia-glx-desktop:18.04
user@b769976cec0e:~$ printf "3\nn\nx\n" | sudo /opt/VirtualGL/bin/vglserver_config

1) Configure server for use with VirtualGL (GLX + EGL back ends)
2) Unconfigure server for use with VirtualGL (GLX + EGL back ends)
3) Configure server for use with VirtualGL (EGL back end only)
4) Unconfigure server for use with VirtualGL (EGL back end only)
X) Exit

Choose:

Restrict framebuffer device access to vglusers group (recommended)?
[Y/n]
... Creating /etc/modprobe.d/virtualgl.conf to set requested permissions for
    /dev/nvidia* ...
... Attempting to remove nvidia module from memory so device permissions
    will be reloaded ...
rmmod: ERROR: Module nvidia is in use by: nvidia_uvm nvidia_modeset
... Granting write permission to /dev/nvidia-modeset /dev/nvidia-uvm /dev/nvidia-uvm-tools /dev/nvidia0 /dev/nvidia1 /dev/nvidia2 /dev/nvidia3 /dev/nvidiactl for all users ...
chmod: changing permissions of '/dev/nvidia-modeset': Read-only file system
chmod: changing permissions of '/dev/nvidia-uvm': Read-only file system
chmod: changing permissions of '/dev/nvidia-uvm-tools': Read-only file system
chmod: changing permissions of '/dev/nvidia0': Read-only file system
chmod: changing permissions of '/dev/nvidia1': Read-only file system
chmod: changing permissions of '/dev/nvidia2': Read-only file system
chmod: changing permissions of '/dev/nvidia3': Read-only file system
chmod: changing permissions of '/dev/nvidiactl': Read-only file system
chown: changing ownership of '/dev/nvidia-modeset': Read-only file system
chown: changing ownership of '/dev/nvidia-uvm': Read-only file system
chown: changing ownership of '/dev/nvidia-uvm-tools': Read-only file system
chown: changing ownership of '/dev/nvidia0': Read-only file system
chown: changing ownership of '/dev/nvidia1': Read-only file system
chown: changing ownership of '/dev/nvidia2': Read-only file system
chown: changing ownership of '/dev/nvidia3': Read-only file system
chown: changing ownership of '/dev/nvidiactl': Read-only file system
... Granting write permission to /dev/dri/card0 /dev/dri/card1 /dev/dri/card2 /dev/dri/card3 /dev/dri/card4 /dev/dri/card5 /dev/dri/card6 /dev/dri/card7 /dev/dri/card8 for all users ...
... Granting write permission to /dev/dri/renderD128 /dev/dri/renderD129 /dev/dri/renderD130 /dev/dri/renderD131 /dev/dri/renderD132 /dev/dri/renderD133 /dev/dri/renderD134 /dev/dri/renderD135 for all users ...

1) Configure server for use with VirtualGL (GLX + EGL back ends)
2) Unconfigure server for use with VirtualGL (GLX + EGL back ends)
3) Configure server for use with VirtualGL (EGL back end only)
4) Unconfigure server for use with VirtualGL (EGL back end only)
X) Exit

Choose:
k7 commented 3 years ago

I have found the solution.

Use --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=4 instead of --gpus 4.

docker run --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=4 --device=/dev/dri:rw -it  -e SHARED=TRUE -e VNCPASS=vncpasswd -p 5901:5901 ehfd/nvidia-glx-desktop:18.04
ehfd commented 3 years ago

--gpus 4 means to provision 4 GPUs, not provision the GPU with the ID of 4. In addition to the solution you wrote, --gpus '"device=4"' is also the same thing. For 18.04, check README.md.

ehfd commented 2 years ago

Added to Troubleshooting docs.