原因分析
在ubuntu20.04中也安装了nvidia-docker,cuda11.2以及对应的cudnn,这是因为docker镜像里面没有适配好nvidia的驱动,具体那个驱动我不知道
解决方案
网上的解决方案一大堆,各不相同,并且也无法解决,NVIDIA已经给了对用的解决方案,只是搜索报错信息搜不到而已。
在docker 运行的时候添加–gpus即可
docker run -it --gpus all
如果添加以后报错:
docker: Error response from daemon: could not select device driver “” with capabilities: [[gpu]].
那证明您还有没有安装NVIDIA Container Runtime
下载安装 nvidia-container-runtime-script.sh即可