美团的知识库上已经有在CentOS 7上安装TF的详细教程,但是有很多坑还是不踩不知道,现在记录一下安装过程遇到的各种问题。
安装方法:
注意:
安装过程一定要按照顺序操作!!!TF和CUDNN一定版本要匹配,否则会报各种错误,如找不到文件、找不到GPU卡等
Tensorflow对CUDNN对版本兼容性看发行说明:
All our prebuilt binaries have been builtwith cuDNN 6. We anticipate releasingTensorFlow 1.4 with cuDNN 7.
TensorFlow 1.2 may be the last time we build withcuDNN 5.1. Starting with TensorFlow 1.3, we will try to build all our prebuilt binaries with cuDNN 6.0. While we will try to keep our source code compatible with cuDNN 5.1, it will be best effort.
TensorFlow 1.1.0 will be the last time we release a binary with Mac GPU support. Going forward, we will stop testing on Mac GPU systems. We continue to welcome patches that maintain Mac GPU support, and we will try to keep the Mac GPU build working.
安装软件准备:
Nvidia 驱动:sh NVIDIA-Linux-x86_64-375.66.run
cuDNN v5.1 for CUDA8.0
tensorflow_gpu-1.1.0-cp27-none-linux_x86_64.whl
官方下载地址:
查看TF的版本及安装路径:
python
>>> import tensorflow as tf
>>> tf.__version__
>>> tf.__path__
安装过程中报错解答:
GPU driver 与 CUDNN/CUDA不匹配,降低 driver版本或者升级CUDNN/CUDA,在执行python时,import tensorflow as tf 报错
sess = tf.Session()时找不到GPU,没有安装tensorflow-gpu,或安装中有错误,重新安装
>>> sess = tf.Session()
>>> print(sess.run(hello))
TensorFlow 版本太高,CUDNN不支持,需要降低TF或者升级cuDNN