【docker】WSL+docker_desktop+GPU配置环境失败

尝试windows下使用docker_desktop安装深度学习的GPU环境,结果很失败,GPU调用不了。我一共尝试两种方式调用GPU。

第一种是新版本WSL2直接支持,下载一个Nvidia官方的docker镜像,然后直接输入命令:
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.
第二种是在WSL2子系统下安装CUDA。

安装成功后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的版本才可以。

目前我的电脑是21H1版,暂时更新不了,这里先记下,回头等更新推送了,我再安装。

附录:安装过程中用到的几个网址和博客:
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


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部