2
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__)`

This gives me the following output.

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

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.

MBT
  • 21,733
  • 19
  • 84
  • 102
khan
  • 531
  • 6
  • 29

1 Answers1

4

I solved it with the answer given by Keras with TensorFlow backend not using GPU

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.

khan
  • 531
  • 6
  • 29