ubuntu18.04+cuda9.0+cudnn7.1.3+tensorflow_gpu安装教程

-------------------------------------------2019.5.24-------------------------------------------
首推黄海广博士的简易安装方式:
Ubuntu18.04深度学习环境配置(简易方式)
-------------------------------------------2019.5.11-------------------------------------------

参考1:https://blog.csdn.net/gaoyu1253401563/article/details/82808269
参考2:https://blog.csdn.net/Aiolia86/article/details/80342240
参考3:https://blog.csdn.net/u010801439/article/details/80483036
tensorflow与cuda版本对应:https://tensorflow.google.cn/install/source
cuda cudnn卸载:https://blog.csdn.net/wanzhen4330/article/details/81704474

显卡驱动与cuda对应关系:https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html
cuda下载地址:https://developer.nvidia.com/cuda-toolkit-archive
cudnn下载地址:https://developer.nvidia.com/cudnn

细节请参考上面两个链接,我的配置为机械革命X1 gtx1050

流程:显卡驱动——》cuda9.0(选择ubuntu17.04版本,下载下面所有文件)——》cuda7.1.3——》anaconda创建tensorflow环境,在tensorflow环境中执行conda install tensorflow-gpu(参考很多博客装指定tensorflow版本的行不通!!!)默认keras自动安装

tensorflow-gpu==1.12.0 cuda9.0 cudnn7.3.1

查看cuda版本:
cat /usr/local/cuda/version.txt
查看cudnn版本:
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2

查看gpu:
import tensorflow as tf
gpu_device_name = tf.test.gpu_device_name()
print(gpu_device_name)


判断gpu是否可用:
tf.test.is_gpu_available()

from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())

from keras import backend as K
K.tensorflow_backend._get_available_gpus()

你可能感兴趣的:(tensorflow)