Tensorflow 获取TysFraceFLUE自动检测和使用XLA GPU 我有一个XLA-GPU,它不是由ToSoFr流自动检测的,但是我能够在上面进行计算。我想要的结果是:print(tf.test.is\u gpu\u available())的结果为“True”

Tensorflow 获取TysFraceFLUE自动检测和使用XLA GPU 我有一个XLA-GPU,它不是由ToSoFr流自动检测的,但是我能够在上面进行计算。我想要的结果是:print(tf.test.is\u gpu\u available())的结果为“True”,tensorflow,tensorflow-xla,Tensorflow,Tensorflow Xla,以下是我正在运行的代码: #/usr/bin/python3 导入tensorflow作为tf 打印(“TensorFlow是否有GPU可用?”) 打印(tf.test.is\gpu\u可用()) 使用tf.device('/device:xlagpu:0'): a=tf.constant([1.0,2.0,3.0,4.0,5.0,6.0],shape=[2,3],name='a') b=tf.constant([1.0,2.0,3.0,4.0,5.0,6.0],shape=[3,2],name

以下是我正在运行的代码:

#/usr/bin/python3
导入tensorflow作为tf
打印(“TensorFlow是否有GPU可用?”)
打印(tf.test.is\gpu\u可用())
使用tf.device('/device:xlagpu:0'):
a=tf.constant([1.0,2.0,3.0,4.0,5.0,6.0],shape=[2,3],name='a')
b=tf.constant([1.0,2.0,3.0,4.0,5.0,6.0],shape=[3,2],name='b')
c=tf.matmul(a,b)
sess=tf.Session(config=tf.ConfigProto(log\u device\u placement=True))
打印(“运行会话的结果”)
打印(sess.run(c))
以下是相关输出:

Is a GPU Available for TensorFlow?
False
Result of Running the Session
[[22. 28.]
 [49. 64.]]
Device mapping:
/job:localhost/replica:0/task:0/device:XLA_GPU:0 -> device: XLA_GPU device
/job:localhost/replica:0/task:0/device:XLA_CPU:0 -> device: XLA_CPU device
MatMul: (MatMul): /job:localhost/replica:0/task:0/device:XLA_GPU:0
a: (Const): /job:localhost/replica:0/task:0/device:XLA_GPU:0
b: (Const): /job:localhost/replica:0/task:0/device:XLA_GPU:0
从这个输出中我们可以看到,没有可用的GPU,即使所有东西都分配给设备。出什么事了?以下是我安装的tensorflow软件包:

$ pip3 list | grep tensor
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
tensorboard (1.14.0)
tensorflow-estimator (1.14.0)
tensorflow-gpu (1.14.0)
如果需要更多信息,请让我知道我应该提供什么

以下是完整的输出(警告:长):

2019-07-05 18:48:13.207029:I tensorflow/core/platform/cpu\u feature\u guard.cc:142]您的cpu支持未编译此tensorflow二进制文件以使用的指令:AVX2 FMA
2019-07-05 18:48:13.224448:I tensorflow/stream_executor/platform/default/dso_loader.cc:42]已成功打开动态库libcuda.so.1
2019-075-18:48:13.430265:I TysFult/Cys/XLA/Service / Service .CC:168)XLA服务0x55 C1A2E445 E0在CUDA平台上执行计算。设备:
2019-07-05 18:48:13.430319:I tensorflow/compiler/xla/service/service.cc:175]StreamExecutor设备(0):GeForce GTX 1080 Ti,计算能力6.1
2019-07-05 18:48:13.434415:I tensorflow/core/platform/profile_utils/cpu_utils.cc:94]cpu频率:2400010000 Hz
2019-0705:18:48:13.434837 TysFrace/编译器/ XLA/Service / Service .CC:168)XLA服务0x55 C1A2EB51 B0在平台主机上执行计算。设备:
2019-07-05 18:48:13.434871:I tensorflow/compiler/xla/service/service.cc:175]流执行器设备(0):,
2019-07-05 18:48:13.436872:I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640]找到了具有以下属性的设备0:
名称:GeForce GTX 1080 Ti大调:6小调:1记忆锁定率(GHz):1.582
pciBusID:0000:02:00.0
2019-07-05 18:48:13.437073:I tensorflow/stream_executor/platform/default/dso_loader.cc:53]无法打开库“libcudart.so.10.0”;dlerror:libcudart.so.10.0:无法打开共享对象文件:没有此类文件或目录
2019-07-05 18:48:13.437183:I tensorflow/stream_executor/platform/default/dso_loader.cc:53]无法打开库“libcublas.so.10.0”;dError:libcublas.so.10.0:无法打开共享对象文件:没有此类文件或目录
2019-07-05 18:48:13.437281:I tensorflow/stream_executor/platform/default/dso_loader.cc:53]无法打开库“libcuft.so.10.0”;dlerror:libcuft.so.10.0:无法打开共享对象文件:没有此类文件或目录
2019-07-05 18:48:13.437377:I tensorflow/stream_executor/platform/default/dso_loader.cc:53]无法打开库“libcurand.so.10.0”;Dleror:libcurand.so.10.0:无法打开共享对象文件:没有此类文件或目录
2019-07-05 18:48:13.437472:I tensorflow/stream_executor/platform/default/dso_loader.cc:53]无法打开库“libcusolver.so.10.0”;dlerror:libcusolver.so.10.0:无法打开共享对象文件:没有此类文件或目录
2019-07-05 18:48:13.437567:I tensorflow/stream_executor/platform/default/dso_loader.cc:53]无法打开库“libcusparse.so.10.0”;dlerror:libcusparse.so.10.0:无法打开共享对象文件:没有此类文件或目录
2019-07-05 18:48:13.437666:I tensorflow/stream_executor/platform/default/dso_loader.cc:53]无法打开库“libcudnn.so.7”;dlerror:libcudnn.so.7:无法打开共享对象文件:没有这样的文件或目录
2019-07-05 18:48:13.437682:W tensorflow/core/common_runtime/gpu/gpu_device.cc:1663]无法打开某些gpu库。正在跳过注册GPU设备。。。
2019-07-05 18:48:13.437703:I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181]设备互连拖缆执行器与强度1边缘矩阵:
2019-07-05 18:48:13.437715:I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187]0
2019-07-05 18:48:13.437725:I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200]0:N
警告:在标记解析转到stderr之前进行日志记录。
W0705 18:48:13.442357 139885136246528 tf_train的弃用包装器.py:119]py:15:名称tf.Session已弃用。请改用tf.compat.v1.Session。
W0705 18:48:13.442660 139885136246528不推荐使用来自tf的包装器。py:119]火车。py:15:名称tf.ConfigProto不推荐使用。请改用tf.compat.v1.ConfigProto。
2019-07-05 18:48:13.444866:I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640]找到了具有以下属性的设备0:
名称:GeForce GTX 1080 Ti大调:6小调:1记忆锁定率(GHz):1.582
pciBusID:0000:02:00.0
2019-07-05 18:48:13.444976:I tensorflow/stream_executor/platform/default/dso_loader.cc:53]无法打开库“libcudart.so.10.0”;dlerror:libcudart.so.10.0:无法打开共享对象文件:没有此类文件或目录
2019-07-05 18:48:13.445074:I tensorflow/stream_executor/platform/default/dso_loader.cc:53]无法打开库“libcublas.so.10.0”;dError:libcublas.so.10.0:无法打开共享对象文件:没有此类文件或目录
2019-07-05 18:48:13.445147:I tensorflow/stream_executor/platform/default/dso_loader.cc:53]无法打开库“libcuft.so.10.0”;dlerror:libcuft.so.10.0:无法打开共享对象文件:没有此类文件或目录
2019-07-05 18:48:13.445214:I tensorflow/stream_executor/platform/default/dso_loader.cc:53]无法打开库“libcurand.so.10.0”;Dleror:libcurand.so.10.0:无法打开共享对象文件:没有此类文件或目录
2019-07-05 18:48:13.445282:I tensorflow/stream_executor/platform/default/dso_loader.cc:53]无法执行
2019-07-05 18:48:13.207029: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-07-05 18:48:13.224448: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcuda.so.1
2019-07-05 18:48:13.430265: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55c1a2e445e0 executing computations on platform CUDA. Devices:
2019-07-05 18:48:13.430319: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): GeForce GTX 1080 Ti, Compute Capability 6.1
2019-07-05 18:48:13.434415: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2400010000 Hz
2019-07-05 18:48:13.434837: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55c1a2eb51b0 executing computations on platform Host. Devices:
2019-07-05 18:48:13.434871: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): <undefined>, <undefined>
2019-07-05 18:48:13.436872: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties: 
name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.582
pciBusID: 0000:02:00.0
2019-07-05 18:48:13.437073: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcudart.so.10.0'; dlerror: libcudart.so.10.0: cannot open shared object file: No such file or directory
2019-07-05 18:48:13.437183: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcublas.so.10.0'; dlerror: libcublas.so.10.0: cannot open shared object file: No such file or directory
2019-07-05 18:48:13.437281: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcufft.so.10.0'; dlerror: libcufft.so.10.0: cannot open shared object file: No such file or directory
2019-07-05 18:48:13.437377: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcurand.so.10.0'; dlerror: libcurand.so.10.0: cannot open shared object file: No such file or directory
2019-07-05 18:48:13.437472: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcusolver.so.10.0'; dlerror: libcusolver.so.10.0: cannot open shared object file: No such file or directory
2019-07-05 18:48:13.437567: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcusparse.so.10.0'; dlerror: libcusparse.so.10.0: cannot open shared object file: No such file or directory
2019-07-05 18:48:13.437666: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcudnn.so.7'; dlerror: libcudnn.so.7: cannot open shared object file: No such file or directory
2019-07-05 18:48:13.437682: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1663] Cannot dlopen some GPU libraries. Skipping registering GPU devices...
2019-07-05 18:48:13.437703: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-07-05 18:48:13.437715: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187]      0 
2019-07-05 18:48:13.437725: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 0:   N 
WARNING: Logging before flag parsing goes to stderr.
W0705 18:48:13.442357 139885136246528 deprecation_wrapper.py:119] From tf_train.py:15: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

W0705 18:48:13.442660 139885136246528 deprecation_wrapper.py:119] From tf_train.py:15: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

2019-07-05 18:48:13.444866: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties: 
name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.582
pciBusID: 0000:02:00.0
2019-07-05 18:48:13.444976: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcudart.so.10.0'; dlerror: libcudart.so.10.0: cannot open shared object file: No such file or directory
2019-07-05 18:48:13.445074: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcublas.so.10.0'; dlerror: libcublas.so.10.0: cannot open shared object file: No such file or directory
2019-07-05 18:48:13.445147: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcufft.so.10.0'; dlerror: libcufft.so.10.0: cannot open shared object file: No such file or directory
2019-07-05 18:48:13.445214: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcurand.so.10.0'; dlerror: libcurand.so.10.0: cannot open shared object file: No such file or directory
2019-07-05 18:48:13.445282: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcusolver.so.10.0'; dlerror: libcusolver.so.10.0: cannot open shared object file: No such file or directory
2019-07-05 18:48:13.445348: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcusparse.so.10.0'; dlerror: libcusparse.so.10.0: cannot open shared object file: No such file or directory
2019-07-05 18:48:13.445415: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcudnn.so.7'; dlerror: libcudnn.so.7: cannot open shared object file: No such file or directory
2019-07-05 18:48:13.445429: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1663] Cannot dlopen some GPU libraries. Skipping registering GPU devices...
2019-07-05 18:48:13.445444: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-07-05 18:48:13.445454: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187]      0 
2019-07-05 18:48:13.445464: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 0:   N 
2019-07-05 18:48:13.445948: I tensorflow/core/common_runtime/direct_session.cc:296] Device mapping:
/job:localhost/replica:0/task:0/device:XLA_GPU:0 -> device: XLA_GPU device
/job:localhost/replica:0/task:0/device:XLA_CPU:0 -> device: XLA_CPU device

2019-07-05 18:48:13.447236: I tensorflow/core/common_runtime/placer.cc:54] MatMul: (MatMul)/job:localhost/replica:0/task:0/device:XLA_GPU:0
2019-07-05 18:48:13.447268: I tensorflow/core/common_runtime/placer.cc:54] a: (Const)/job:localhost/replica:0/task:0/device:XLA_GPU:0
2019-07-05 18:48:13.447282: I tensorflow/core/common_runtime/placer.cc:54] b: (Const)/job:localhost/replica:0/task:0/device:XLA_GPU:0
Is a GPU Available for TensorFlow?
False
Result of Running the Session
[[22. 28.]
 [49. 64.]]
Device mapping:
/job:localhost/replica:0/task:0/device:XLA_GPU:0 -> device: XLA_GPU device
/job:localhost/replica:0/task:0/device:XLA_CPU:0 -> device: XLA_CPU device
MatMul: (MatMul): /job:localhost/replica:0/task:0/device:XLA_GPU:0
a: (Const): /job:localhost/replica:0/task:0/device:XLA_GPU:0
b: (Const): /job:localhost/replica:0/task:0/device:XLA_GPU:0