cli: Option --gpus failes with AMD and Intel GPUs
Description
New option --gpus to provide the GPU to containers failes with AMD and Intel GPUs.
It is specific to systems with NVIDIA GPU and NVIDIA’s proprietary driver and NVIDIA’s container runtime setup.
A cli option should be general and not be vendor-specific.
Steps to reproduce the issue: On a system with an AMD GPU:
$ docker run --rm --gpus all debian echo
docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]].
Describe the results you received:
Option --gpus all fails on a system with an AMD GPU.
Likely it also fails with Intel GPUs and with NVIDIA GPUs using the nouveau driver.
Describe the results you expected:
Option --gpus all should provide the GPU to the container.
Output of docker --version:
Docker version 19.03.1, build 74b1e89
Discussion
Coming from #1200, #1714 , opening a new ticket:
I want to analyze the current state of --gpus and make proposals:
- Either make GPU support vendor-specific to NVIDIA with
docker plugin installand drop the cli option--gpus. - Or make
--gpuswork in general for all vendors. I would prefer that.
The current state:
--gpusworks with a specific NVIDIA setup only. Dependencies:- NVIDIA GPU
- NVIDIA proprietary driver on host
- nvidia-container-toolkit on host
- nvidia/nvidia-docker image.
--gpusfails with NVIDIA GPUs not fulfilling above dependencies.--gpusfails with AMD GPUs.--gpusfails with Intel GPUs.--gpusfails with NVIDIA GPUs andnouveau.- Unknown/to check: Does
--gpuswork with the combination:- NVIDIA GPU
- NVIDIA proprietary driver on host
- same NVIDIA proprietary driver in container (arbitrary image)
- Without nvidia-container-toolkit on host
Desirable:
- Support of other vendors and
nouveauand possible existing NVIDIA driver in container. ToDo:--gpusshould provide/dev/drito container.--gpusshould provide/dev/nvidia*to container.--gpusmaybe should provide/dev/vga_arbiterto container.--gpusmaybe should add the container user to groupsvideoandrenderto support unprivileged users in container.
At least for --gpus all or e.g. --gpus intel this should not be too hard.
Maybe additional, or to be done by the user:
- Driver check on host and in container by docker.
- Driver installation in container by docker. (Probably going too far. However, possible e.g. with NVIDIA’s proprietary driver. I am not sure how to accomplish this with MESA drivers, but likely possible, too.)
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 35
- Comments: 15 (2 by maintainers)
Links to this issue
- Add GPU support for Docker executor (!1955) · Merge requests · GitLab.org / gitlab-runner · GitLab
- Add GPU support for Docker executor (!1955) · Merge requests · GitLab.org / gitlab-runner · GitLab
- Add GPU support for Docker executor (!1955) · Merge requests · GitLab.org / gitlab-runner · GitLab
- Integration of AgentDVR&DeepstackAI on Docker
I don’t think contributions have been made to provide support for other GPU vendors, so no change
It doesn’t need to support other vendors, but it should not be crashing like this
Also, look at this error message. It doesn’t say Nvidia GPU not detected. It says
ERR[0003]. This is not user friendly.any update?
Docker is a masive project. Basic hardware support is required.
Thanks! I am not experienced with Go, though, so I cannot contribute directly with code. However, I have some experience in providing GPUs of all vendors to docker containers. My project x11docker allows to run GUI applications in docker containers, optionally with GPU hardware acceleration.
This works quite well with MESA drivers on host and in image, even if host and container system are quite different (e.g. debian host and alpine image). Given MESA is installed, all you need is described above:
However, this does not cover additional setups like limited GPU memory access. That would indeed need expertise from the vendors. But the probably most common
--gpus allwould be served.These packages cover all MESA packages needed in their dependencies:
Ubuntu
mesa-utilsmesa-utils-extramesa-demosglx-utilsmesa-dri-driversmesa-demosmesa-dri-atimesa-dri-intelmesa-dri-nouveaumesa-dri-swrastlibxv1va-driver-alllibxvlibvalibva-intel-driverlibva-vdpau-driverlibXvlibvalibva-intel-hybrid-driverlibva-vdpau-driverlibxvlibvalibva-glxlibva-intel-driverlibva-vdpau-driver@mviereck thanks, it was always meant to be vendor-neutral. If you want to contribute to the moby/moby repo to add support for other GPU vendors, you are more than welcome! We would need expertise from the various GPU vendors which I don’t have. @RenaudWasTaken was providing NVIDIA expertise hence the first implementation.