from tensorflow.python.client
import device_lib
def get_available_gpus():
local_device_protos = device_lib.list_local_devices()
return [x.name for x in local_device_protos if x.device_type == 'GPU']
xx= get_available_gpus()
print('The GPU device is: ', xx)
print('Tensorflow: ', tf.__version__)`
这给了我以下输出。
Using TensorFlow backend.
2017-12-04 18:13:37.479189: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
The GPU device is: []
Tensorflow: 1.4.0
我正在使用 Pycharm 社区版和 python 3.5。
任何人都可以帮助解决如何强制使用 GPU 的问题吗?虽然在阅读文档时,我发现 Keras 自动使用 GPU。那么我的情况是不使用 GPU 的问题是什么?
我还尝试按照某些问题中的建议卸载 Tensorflow,但它仍然不使用它。需要指导。
我用给出的答案解决了这个问题Keras 与 TensorFlow 后端不使用 GPU https://stackoverflow.com/questions/46080634/keras-with-tensorflow-backend-not-using-gpu/46095279#46095279
您需要卸载tensorflow和tensorflow-gpu。然后重新安装tensorflow-gpu。
如果两者都安装了,Keras 将仅使用 CPU 版本。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)