I use Keras-Tensorflow combo installed with CPU option (it was said to be more robust), but now I'd like to try it with GPU-version. Is there a convenient way to switch? Or shall I re-install fully Tensorflow? Is the GPU version reliable?
I suggest reinstalling the GPU version of Tensorflow, although you can install both version of Tensorflow via virtualenv. GPU version of Tensorflow supports CPU computation, you can switch to CPU easily:
with device('/cpu:0'): # your code here
I have been using GPU version of Tensorflow on my Tesla K80 for a few months, it works like a charm. Feel free to have a try!
You would first have to uninstall tensorflow and after that install tensorflow-gpu. After that run your code and it would run on GPU provided you have installed gpu libraries such as CUDA and cuDNN.
Once you installed the GPU version of Tensorflow, you don't have anything to do in Keras. As written in the Keras documentation, "If you are running on the TensorFlow backend, your code will automatically run on GPU if any available GPU is detected."
And if you want to check that the GPU is correctly detected, start your script with:
import tensorflow as tf sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
The standard output should not show any error and print the name of the GPU. If so, you are ready to run Keras and Tensorflow in GPU mode.