1、之前tensorflow的版本是1.11.0
后来在创建虚拟环境的时候,误操作,把root里的tensorflow直接给安装成1.7.0的版本了。
然后再运行程序的时候,就报错了,错误如下:
E T:\src\github\tensorflow\tensorflow\stream_executor\cuda\cuda_dnn.cc:396] Loaded runtime CuDNN library: 7104 (compatibility version 7100) but source was compiled with 7003 (compatibility version 7000). If using a binary install, upgrade your CuDNN library to match. If building from sources, make sure the library loaded at runtime matches a compatible version specified during compile configuration.
Check failed: stream->parent()->GetConvolveAlgorithms(&algorithms)
2、查了一些资料以后,意识到可能是cudnn的版本与cuda不一致,cudnn的版本过高,应该由7.1变为7.0.所以又重新下载了cudnn7.0.cudnn的下载需要先注册会员,网址https://developer.nvidia.com/cudnn
把cudnn安装包的三个文件夹里的文件依次对应复制到你自己cuda的文件夹下对应子文件夹下即可
3、这样试过之后,还是不行,我就重新安装了tensorflow,试了一下最新版1.13.0,发现又冒出了一个新错误。未找到制定DDL
Failed to load the native TensorFlow runtime.
原来这个最新版本,有了很多革命性的改进,并支持的CUDA版本变成了10。
最后换成1.9.0的tensorflow后,程序又可以运行了。
而且少了以前版本的警告:WARNING:tensorflow:`tf.train.start_queue_runners()` was called when no queue runners were defined. You can safely remove the call to this deprecated function.
应该是tf.train.start_queue_runners()在1.11.0这个版本没有了。
4、
打开D:\Anaconda3\envs\tensorflow\Lib\site-packages\tensorflow\python\platform\build_info.py这个文件,可以看到相应信息。
is_cuda_build = True msvcp_dll_name = 'msvcp140.dll' cudart_dll_name = 'cudart64_90.dll' cuda_version_number = '9.0' nvcuda_dll_name = 'nvcuda.dll' cudnn_dll_name = 'cudnn64_7.dll' cudnn_version_number = '7'
5、在看一些博客上讲的,说要安装vs,可是我并没有安装过,而tensorflow gpu还是可以用。后来我明白了,在安装cuda时,可以选择自定义安装的,选中除Visual Studio Integration外的全部选项,避免电脑自带vs版本不兼容的问题。
总结就是:网上的教程五花八门的,都不太一样,按照网上说的尝试了很多次都失败了,我觉得缺少一个系统的安装说明给我们这种无助的小白啊。
6、查看安装包的版本
conda list 安装包
7、FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
这个警告其实直接忽视就好了,网上有人说,将numpy版本改成1.13.0,就可以消除警告。