linux安装tensorflow-gpu安装踩坑

cuda9.0+cudnn7.0+tensorflow-gpu1.9.0

cuda和cudnn网上的安装教程都有很多,这里我就不详细说了

查看cuda和cudnn是否安装成功:

cuda一般安装在 /usr/local/cuda/ 路径下,该路径下有一个version.txt文档,里面记录了cuda的版本信息

cat  /usr/local/cuda/version.txt 即可查询

同理,cudnn的信息在其头文件里

cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2  即可查询

重点来了-----------------

tensorflow一定要装1.9.0,不然虽然安装好了,但是import tensorflow的时候就会报错

安装tensorflow用下面的语句:

pip install tensorflow-gpu==1.9.0

安装好之后用下列代码测试一下

import tensorflow as tf
tf.test.is_gpu_available()

会出现以下信息就说明gpu版本的装好了

2019-03-20 10:51:12.233358: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-03-20 10:51:12.635285: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1392] Found device 0 with properties:
name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.582
pciBusID: 0000:02:00.0
totalMemory: 10.92GiB freeMemory: 10.76GiB
2019-03-20 10:51:12.884465: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1392] Found device 1 with properties:
name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.582
pciBusID: 0000:04:00.0
totalMemory: 10.92GiB freeMemory: 10.76GiB
2019-03-20 10:51:13.072415: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1392] Found device 2 with properties:
name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.582
pciBusID: 0000:83:00.0
totalMemory: 10.92GiB freeMemory: 10.76GiB
2019-03-20 10:51:13.270321: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1392] Found device 3 with properties:
name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.582
pciBusID: 0000:84:00.0
totalMemory: 10.92GiB freeMemory: 10.76GiB
2019-03-20 10:51:13.274725: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1471] Adding visible gpu devices: 0, 1, 2, 3
2019-03-20 10:51:14.588672: I tensorflow/core/common_runtime/gpu/gpu_device.cc:952] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-03-20 10:51:14.588747: I tensorflow/core/common_runtime/gpu/gpu_device.cc:958]      0 1 2 3
2019-03-20 10:51:14.588765: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0:   N Y N N
2019-03-20 10:51:14.588778: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 1:   Y N N N
2019-03-20 10:51:14.588791: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 2:   N N N Y
2019-03-20 10:51:14.588803: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 3:   N N Y N
2019-03-20 10:51:14.590197: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1084] Created TensorFlow device (/device:GPU:0 with 10413 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:02:00.0, compute capability: 6.1)
2019-03-20 10:51:14.771710: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1084] Created TensorFlow device (/device:GPU:1 with 10413 MB memory) -> physical GPU (device: 1, name: GeForce GTX 1080 Ti, pci bus id: 0000:04:00.0, compute capability: 6.1)
2019-03-20 10:51:14.992416: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1084] Created TensorFlow device (/device:GPU:2 with 10413 MB memory) -> physical GPU (device: 2, name: GeForce GTX 1080 Ti, pci bus id: 0000:83:00.0, compute capability: 6.1)
2019-03-20 10:51:15.209922: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1084] Created TensorFlow device (/device:GPU:3 with 10413 MB memory) -> physical GPU (device: 3, name: GeForce GTX 1080 Ti, pci bus id: 0000:84:00.0, compute capability: 6.1)
True

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值