tensorflow-gpu 2.0无法检测到GPU

时间:2019-10-27 15:30:08

标签: tensorflow keras

tensorflow-gpu 2.0无法检测到GPU,这是什么问题? 为

import tensorflow as tf
print(tf.test.is_built_with_cuda())
print(tf.test.is_gpu_available())
from tensorflow.python.client import device_lib

device_lib.list_local_devices()

输出在我使用Ubuntu 16.04的计算机中的下方

True
False
[name: "/device:CPU:0"
 device_type: "CPU"
 memory_limit: 268435456
 locality {
 }
 incarnation: 10185800011826802770, name: "/device:XLA_CPU:0"
 device_type: "XLA_CPU"
 memory_limit: 17179869184
 locality {
 }
 incarnation: 2908743746130792497
 physical_device_desc: "device: XLA_CPU device", name: "/device:XLA_GPU:0"
 device_type: "XLA_GPU"
 memory_limit: 17179869184
 locality {
 }
 incarnation: 13796634005997726084
 physical_device_desc: "device: XLA_GPU device", name: "/device:XLA_GPU:1"
 device_type: "XLA_GPU"
 memory_limit: 17179869184
 locality {
 }
 incarnation: 4940094218016527544
 physical_device_desc: "device: XLA_GPU device", name: "/device:XLA_GPU:2"
 device_type: "XLA_GPU"
 memory_limit: 17179869184
 locality {
 }
 incarnation: 15391692776259568109
 physical_device_desc: "device: XLA_GPU device", name: "/device:XLA_GPU:3"
 device_type: "XLA_GPU"
 memory_limit: 17179869184
 locality {
 }
 incarnation: 8368387340417357161
 physical_device_desc: "device: XLA_GPU device"]

1 个答案:

答案 0 :(得分:0)

正如y.selivonchyk指出的那样,它在安装cuda 10.0之后现在可以工作。不过,去那里并不容易(涉及卸载/重新安装nvidia驱动程序和cuda),如果有人需要帮助,请在评论中告诉我。