Keras在具有python 3.5和Tensorflow 1.4的Pycharm上不使用GPU [英] Keras does not use GPU on Pycharm having python 3.5 and Tensorflow 1.4

查看:248
本文介绍了Keras在具有python 3.5和Tensorflow 1.4的Pycharm上不使用GPU的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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,但仍然没有使用它.需要指导.

I am using Pycharm community edition with python 3.5. Can anybody help in fixing how one can enforce to use GPU. Although while reading the documentation, I have found that Keras use GPU automatically. So what is the problem in my case that it does not use GPU? I also tried to uninstall Tensorflow, as suggested in some questions but still it does not use it. Need guidance.

推荐答案

我用您需要同时卸载tensorflow和tensorflow-gpu.并且比重新安装tensorflow-gpu. 如果两者都安装,那么Keras将仅使用CPU版本.

You need to uninstall both tensorflow and tensorflow-gpu. And than reinstall tensorflow-gpu. If both are installed than Keras will use only CPU version.

这篇关于Keras在具有python 3.5和Tensorflow 1.4的Pycharm上不使用GPU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆