Keras with TensorFlow backend not using GPU

I had similar kind of issue - keras didn't use my GPU. I had tensorflow-gpu installed according to instruction into conda, but after installation of keras it simply not listed GPU as available device. I've realized that installation of keras adds tensorflow package! So I had both tensorflow and tensorflow-gpu packages. I've found that there is keras-gpu package available. After complete uninstallation of keras, tensorflow, tensorflow-gpu and installation of tensorflow-gpu, keras-gpu the problem was solved.


It is never a good idea to have both tensorflow and tensorflow-gpu packages installed side by side (the one single time it happened to me accidentally, Keras was using the CPU version).

I guess now I need to figure out how to have keras use the gpu version of tensorflow.

You should simply remove both packages from your system, and then re-install tensorflow-gpu [UPDATED after comment]:

pip uninstall tensorflow tensorflow-gpu
pip install tensorflow-gpu

Moreover, it is puzzling why you seem to use the floydhub/dl-docker:cpu container, while according to the instructions you should be using the floydhub/dl-docker:gpu one...


In the future, you can try using virtual environments to separate tensorflow CPU and GPU, for example:

conda create --name tensorflow python=3.5
activate tensorflow
pip install tensorflow

AND

conda create --name tensorflow-gpu python=3.5
activate tensorflow-gpu
pip install tensorflow-gpu