我正在尝试在 WSL 2 上安装 Cuda。我正在按照 this 等说明进行操作.
执行每一步后,我尝试通过执行 docker run --gpus all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark< 来检查 gpu 在 Linux 环境中是否可用
(如上述说明所建议)。
但是我收到以下错误:
docker:来自守护进程的错误响应:无法选择具有功能的设备驱动程序“”:[[gpu]]。
ERRO[0000] 等待容器时出错:上下文已取消
。
知道这可能是什么原因吗?
最佳答案
我遇到了同样的问题。您使用的是适用于 Windows 的 Docker Desktop 吗?因为我发现 WSL2 + CUDA 不适用于 Docker Desktop for Windows:
https://forums.developer.nvidia.com/t/hiccups-setting-up-wsl2-cuda/128641
相反,在 WSL2 中手动安装 Docker(如您链接的教程中所建议):
sudo apt update && sudo apt install -y nvidia-docker2
然后确保启动 docker 服务:
sudo service docker start
之后,您可以通过以下方式验证 CUDA/Docker/WSL2 设置:
docker run --gpus all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark
你应该在哪里看到这样的输出:
NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.
Windowed mode Simulation data stored in video memory Single precision floating point simulation 1 Devices used for simulation MapSMtoCores for SM 7.5 is undefined. Default to use 64 Cores/SM GPU Device 0: "GeForce RTX 2060" with compute capability 7.5
Compute 7.5 CUDA device: [GeForce RTX 2060] 30720 bodies, total time for 10 iterations: 52.181 ms = 180.854 billion interactions per second = 3617.077 single-precision GFLOP/s at 20 flops per interaction
关于ubuntu - 无法选择功能为 : [[gpu]] 的设备驱动程序 "",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62477330/