尝试windows下使用docker_desktop安装深度学习的GPU环境,结果很失败,GPU调用不了。我一共尝试两种方式调用GPU。
docker run -it --gpus=all --rm nvidia/cuda:11.4.2-base-ubuntu20.04 nvidia-smi
报错:
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook #0: error running hook: exit status 1, stdout: , stderr: Auto-detected mode as 'legacy'
nvidia-container-cli: initialization error: WSL environment detected but no adapters were found: unknown.
安装成功后nvdia-smi还是运行不了,报错:
Failed to initialize NVML: GPU access blocked by the operating system
Failed to properly shut down NVML: GPU access blocked by the operating system
在网上查了一下这两种报错的原因,可能是由于windows版本不匹配,需要升级到21H2的版本才可以。
附录:安装过程中用到的几个网址和博客:
Nvidia官网cuda on wsl说明书:https://docs.nvidia.com/cuda/wsl-user-guide/index.html
Nvidia-cuda官方Docker镜像库:https://hub.docker.com/r/nvidia/cuda/tags
微软官网wsl说明书:https://docs.microsoft.com/zh-cn/windows/wsl/basic-commands
B站博客:https://www.bilibili.com/read/cv14608547/
CSDN博客1(直接运行命令):https://blog.csdn.net/fleaxin/article/details/108911522
CSDN博客2:https://blog.csdn.net/dongbox_/article/details/122483636
CSDN博客3(windows版本问题导致无法链接GPU):
https://blog.csdn.net/weixin_44121966/article/details/122848667