How can I use tf.keras with GPU?

25 views
Skip to first unread message

karen....@ciencias.unam.mx

unread,
Jul 25, 2019, 6:06:46 PM7/25/19
to Keras-users
I have this:


import keras
from keras.backend.tensorflow_backend import set_session

from keras import backend as K
K.tensorflow_backend.set_session(sess)


and when I check the use of GPU is right, I got 6% until 25%, but is there any way to select how many gpu to use and what portion to use of them?

thanks

Greetings

Matias Valdenegro

unread,
Jul 26, 2019, 5:07:58 PM7/26/19
to keras...@googlegroups.com

Hello,

 

I don't get why you need to set the session at all, this mixes keras and tf.keras and will bring problems. You don't need to do that at all to use the GPU.

 

About multi-GPU, there is the keras.utils.multi_gpu to train using multiple GPUs. See example at https://keras.io/utils/#multi_gpu_model

 

There is no way to select "portions" as far as I know.

Reply all
Reply to author
Forward
0 new messages