0

I have two GPUs, and I just would like to use one GPU to train a network by tensorflow. When I train it, the code use all the memories of two GPUs, but only one GPU is working:

enter image description here

I do not know why and how to solve this problem.

Community
  • 1
  • 1
karl_TUM
  • 5,769
  • 10
  • 24
  • 41

2 Answers2

2

Try setting:

config = tf.ConfigProto()
config.gpu_options.allow_growth=True
sess = tf.Session(config=config)

as in question.

Community
  • 1
  • 1
sygi
  • 4,557
  • 2
  • 32
  • 54
0

By default tensorflow will occupy consume the memory of all available GPUs. You can either set allow growth as per @sygi's answer or make only one of the GPUs visible to tensorflow as per Yaroslav's comment. And as per this question.

Community
  • 1
  • 1
Russell
  • 1,252
  • 15
  • 21