It seems like it uses gpu automatically, but I do not know why.
First, I declared as below
tf_config = tf.ConfigProto( allow_soft_placement=True )
tf_config.gpu_options.allow_growth = True
sess = tf.Session(config=tf_config)
keras.backend.set_session(sess)
Then I defined some model as below
with K.tf.device('/gpu:0'):
some keras model
This is obvious that it will use the gpu and I checked it uses the first gpu(with index 0) as I expected.
But then, I removed the line
with K.tf.device('/gpu:0'):
and re-indented all the keras model. I ran the code, it still seems like using first gpu(with index 0).
On my ubuntu I used nvidia-smi command to check the gpu memory usage, and I looked on the process manager on my windows.
Both of them take the gpu memory and its usages.
As far as I remember, tensorflow does not use gpu if I do not spare them to its model. But with Keras it seems like it uses gpu automatically ... is it because I ran the code
tf_config = tf.ConfigProto( allow_soft_placement=True )
tf_config.gpu_options.allow_growth = True
sess = tf.Session(config=tf_config)
keras.backend.set_session(sess)
or is there some other reason I am missing?