Tensorflow によって自動的に検出されない XLA GPU がありますが、それに対して計算を実行できます。私の望む結果:の結果print(tf.test.is_gpu_available())
は「True」です。
ここに私が実行しているコードがあります:
#!/usr/bin/python3
import tensorflow as tf
print("Is a GPU Available for TensorFlow?")
print(tf.test.is_gpu_available())
with tf.device('/device:XLA_GPU: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_device_placement=True))
print("Result of Running the Session")
print(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_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