首页 > 解决方案 > Tensorflow 未检测到 GPU - 添加可见 gpu 设备:0

问题描述

我有一个带有 NVIDIA GeForce GTX 980 Ti 的系统。我安装了 tensorflow,并使用 tf.test.gpu_device_name() 查找 gpu 设备。看起来它找到了 gpu,但随后显示“添加可见 gpu 设备:0”

>>> import tensorflow as tf
>>> tf.test.gpu_device_name()
2019-01-08 10:01:12.589000: I tensorflow/core/platform/cpu_feature_guard.cc:141]
 Your CPU supports instructions that this TensorFlow binary was not compiled to
use: AVX2
2019-01-08 10:01:12.855000: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1
432] Found device 0 with properties:
name: GeForce GTX 980 Ti major: 5 minor: 2 memoryClockRate(GHz): 1.228
pciBusID: 0000:01:00.0
totalMemory: 6.00GiB freeMemory: 5.67GiB
2019-01-08 10:01:12.862000: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1
511] Adding visible gpu devices: 0

标签: tensorflow

解决方案


有趣的是,你关心的 0 并不是你用来计数的 0。准确地说,它不是“检测到 0 个设备”而是“检测到设备 0”。“添加可见设备 0”,这里的 0 是您 GPU 的标识。或者你可以说,tensorflow 的方式来区分系统中的多个 GPU。这是我的系统的输出,我很确定,我正在用 gpu 进行计算。所以不用担心。你已准备好出发!

Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.test.gpu_device_name()
2019-01-08 20:51:02.212125: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2019-01-08 20:51:03.199893: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1411] Found device 0 with properties:
name: GeForce GTX 1060 with Max-Q Design major: 6 minor: 1 memoryClockRate(GHz): 1.3415
pciBusID: 0000:01:00.0
totalMemory: 6.00GiB freeMemory: 4.97GiB
2019-01-08 20:51:03.207308: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1490] Adding visible gpu devices: 0
2019-01-08 20:51:04.857881: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-01-08 20:51:04.861791: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977]      0
2019-01-08 20:51:04.863796: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990] 0:   N
2019-01-08 20:51:04.867507: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1103] Created TensorFlow device (/device:GPU:0 with 4722 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1060 with Max-Q Design, pci bus id: 0000:01:00.0, compute capability: 6.1)
'/device:GPU:0'


推荐阅读