我看到了几个关于这个主题的问答,并尝试了这两种方法。任何关于如何继续任何一条路线的建议表示赞赏:
从 WSL2 中运行 nvidia-docker
我关注了 NVIDIA docs和 this tutorial .一切安装和docker
命令从 Ubuntu 20.04 中运行。然而,sudo service docker start
返回:docker: unrecognized service
更新 :
这变成了 known issue .我能够按照 these instructions 在 Ubuntu 上安装和运行 docker .但是,接下来我遇到了 issue like this
$docker run --gpus all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark
Status: Downloaded newer image for nvcr.io/nvidia/k8s/cuda-sample:nbody
docker: Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:459: container init caused: Running hook #0:: error running hook: exit status 1, stdout: , stderr: nvidia-container-cli: initialization error: nvml error: driver not loaded: unknown.
ERRO[0065] error waiting for container: context canceled
从 Windows 运行 NVIDIA docker:
另一个 school of thought建议从 WSL Ubuntu 中删除 docker 并改为运行 Windows docker。然后可以从 WSL 连接到它。好吧,我无法运行
nvidia-docker
完全来自 Windows:$ docker run --gpus all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark
Unable to find image 'nvcr.io/nvidia/k8s/cuda-sample:nbody' locally
nbody: Pulling from nvidia/k8s/cuda-sample
...
docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]].
此外,从 ubuntu 中删除 docker 后,我仍然可以从 Ubuntu20.04 或运行时运行 docker
wsl
来自 Powershell:$ which docker
/mnt/c/ProgramData/DockerDesktop/version-bin/docker
$ docker
The command 'docker' could not be found in this WSL 2 distro.
We recommend to activate the WSL integration in Docker Desktop settings.
See https://docs.docker.com/docker-for-windows/wsl/ for details.
我已经在 Docker 设置的两个不同选项卡中为 Ubuntu 20.04 启用了基于 WSL2 的引擎和集成。系统
Windows 10
WSL 2
Ubuntu 20.04 within WSL2
Windows Docker with WSL2-based engine and integration enabled
非常感谢如何进一步诊断它的任何帮助
最佳答案
我认为在 WSL2 上运行 nVidia GPU (CUDA) 的最佳方法是遵循 nVidia 文档中的教程 CUDA on WSL .您需要按顺序正确执行三件事:
正确执行这三个步骤后,您可以按照 nVidia 教程from Setting up CUDA Toolkit 进行操作。 .
这是另一个 nVidia document陈述您在第 8 章中面临的相同问题。他们声称
This error usually indicates that the right Microsoft Windows Insider Preview Builds, WSL 2, NVIDIA drivers and NVIDIA Container Toolkit may not be installed correctly.
对我来说,这是我的 Windows Insider Preview Builds 版本没有正确设置为 20145 或更高版本。
关于docker - 在 Windows 10 + WSL2 上运行 nvidia-docker,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65295415/