当前位置:主页 > 软件编程 > Python代码 >

详解Tensorflow不同版本要求与CUDA及CUDNN版本对应关系

时间:2020-12-21 19:22:43 | 栏目:Python代码 | 点击:

参考官网地址:

Windows端:https://tensorflow.google.cn/install/source_windows

CPU

Version Python version Compiler Build tools
tensorflow-1.11.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.10.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.9.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.8.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.7.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.6.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.5.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.4.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.3.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.2.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.1.0 3.5 MSVC 2015 update 3 Cmake v3.6.3
tensorflow-1.0.0 3.5 MSVC 2015 update 3 Cmake v3.6.3

GPU

Version Python version Compiler Build tools cuDNN CUDA
tensorflow_gpu-1.11.0 3.5-3.6 MSVC 2015 update 3 Bazel 0.15.0 7 9
tensorflow_gpu-1.10.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 7 9
tensorflow_gpu-1.9.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 7 9
tensorflow_gpu-1.8.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 7 9
tensorflow_gpu-1.7.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 7 9
tensorflow_gpu-1.6.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 7 9
tensorflow_gpu-1.5.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 7 9
tensorflow_gpu-1.4.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 6 8
tensorflow_gpu-1.3.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 6 8
tensorflow_gpu-1.2.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 5.1 8
tensorflow_gpu-1.1.0 3.5 MSVC 2015 update 3 Cmake v3.6.3 5.1 8
tensorflow_gpu-1.0.0 3.5 MSVC 2015 update 3 Cmake v3.6.3 5.1 8

Linux端:https://tensorflow.google.cn/install/source

Linux

Version Python version Compiler Build tools
tensorflow-1.11.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.15.0
tensorflow-1.10.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.15.0
tensorflow-1.9.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.11.0
tensorflow-1.8.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.10.0
tensorflow-1.7.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.10.0
tensorflow-1.6.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.9.0
tensorflow-1.5.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.8.0
tensorflow-1.4.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.5.4
tensorflow-1.3.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.4.5
tensorflow-1.2.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.4.5
tensorflow-1.1.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.4.2
tensorflow-1.0.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.4.2

Version Python version Compiler Build tools cuDNN CUDA
tensorflow_gpu-1.11.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.15.0 7 9
tensorflow_gpu-1.10.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.15.0 7 9
tensorflow_gpu-1.9.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.11.0 7 9
tensorflow_gpu-1.8.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.10.0 7 9
tensorflow_gpu-1.7.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.9.0 7 9
tensorflow_gpu-1.6.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.9.0 7 9
tensorflow_gpu-1.5.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.8.0 7 9
tensorflow_gpu-1.4.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.5.4 6 8
tensorflow_gpu-1.3.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.4.5 6 8
tensorflow_gpu-1.2.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.4.5 5.1 8
tensorflow_gpu-1.1.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.4.2 5.1 8
tensorflow_gpu-1.0.0 2.7, 3.3-3.6 GCC 4.8 Bazel 0.4.2 5.1 8

macOS

CPU

Version Python version Compiler Build tools
tensorflow-1.11.0 2.7, 3.3-3.6 Clang from xcode Bazel 0.15.0
tensorflow-1.10.0 2.7, 3.3-3.6 Clang from xcode Bazel 0.15.0
tensorflow-1.9.0 2.7, 3.3-3.6 Clang from xcode Bazel 0.11.0
tensorflow-1.8.0 2.7, 3.3-3.6 Clang from xcode Bazel 0.10.1
tensorflow-1.7.0 2.7, 3.3-3.6 Clang from xcode Bazel 0.10.1
tensorflow-1.6.0 2.7, 3.3-3.6 Clang from xcode Bazel 0.8.1
tensorflow-1.5.0 2.7, 3.3-3.6 Clang from xcode Bazel 0.8.1
tensorflow-1.4.0 2.7, 3.3-3.6 Clang from xcode Bazel 0.5.4
tensorflow-1.3.0 2.7, 3.3-3.6 Clang from xcode Bazel 0.4.5
tensorflow-1.2.0 2.7, 3.3-3.6 Clang from xcode Bazel 0.4.5
tensorflow-1.1.0 2.7, 3.3-3.6 Clang from xcode Bazel 0.4.2
tensorflow-1.0.0 2.7, 3.3-3.6 Clang from xcode Bazel 0.4.2

GPU

Version Python version Compiler Build tools cuDNN CUDA
tensorflow_gpu-1.1.0 2.7, 3.3-3.6 Clang from xcode Bazel 0.4.2 5.1 8
tensorflow_gpu-1.0.0 2.7, 3.3-3.6 Clang from xcode Bazel 0.4.2 5.1 8

tensorflow的CUDA driver version is insufficient for CUDA runtime version 问题解决方案

CUDA driver version is insufficient for CUDA runtime version 翻译过来就是CUDA的驱动程序版本跟CUDA的运行时版本不匹配!

1.CUDA driver version(驱动版本):就是NVIDIA GPU的驱动程序版本;

查看命令:nvidia-smi

我们看到我的GPU的驱动程序版本是:384.81

2.CUDA runtime version(运行时版本):是在python中安装的cudatoolkit和cudnn程序包的版本

查看命令:pip list

python安装的cudatoolkit和cudnn程序包版本是:9.2

3.nvidia 驱动和cuda runtime 版本对应关系

运行时版本   驱动版本
CUDA 9.1     387.xx 
CUDA 9.0     384.xx 
CUDA 8.0     375.xx (GA2) 
CUDA 8.0     367.4x 
CUDA 7.5     352.xx 
CUDA 7.0     346.xx 
CUDA 6.5     340.xx 
CUDA 6.0     331.xx 
CUDA 5.5     319.xx 
CUDA 5.0     304.xx 
CUDA 4.2     295.41 
CUDA 4.1     285.05.33 
CUDA 4.0     270.41.19 
CUDA 3.2     260.19.26 
CUDA 3.1     256.40 
CUDA 3.0     195.36.15

4.解决方案

从驱动和运行时的版本对应关系来看,版本为384.81的驱动程序 对应的 运行时版本是9.0,也就是说我们在python中安装cudatoolkit和cudnn程序包版本9.2是过高了。

因为系统中依赖GPU驱动的程序比较多,一般出现这种情况,我们都是更改cudatoolkit和cudnn程序包的版本。

于是,先卸载python中安装cudatoolkit和cudnn程序包:pip uninstall cudnn ; pip uninstall cudatoolkit

然后安装对应版本的cudatoolkit和cudnn程序包:pip install cudatoolkit=9.0;pip install cudnn

5.为什么会出现这种情况呢:

一般出现这种情况是因为在python中安装tensorflow的gpu版本时,pip会检查tensorflow依赖的其他的包,如果依赖的包没有安装,则会先安装最新版本的依赖包。这时候tensorflow的gpu版本依赖cudatoolkit和cudnn程序包,pip就会安装最新版本的cudatoolkit和cudnn程序包,最终导致gpu驱动版本和cuda运行时版本不匹配。

您可能感兴趣的文章:

相关文章