tensorflow gpu - can memory growth and memory limit be used in conjunction?

Viewed 673

Official TF documentation [1] suggests 2 ways to control GPU memory allocation

Memory growth allows TF to grow memory based on usage

tf.config.experimental.set_memory_growth(gpus[0], True)

Virtual device config sets limit to memory

tf.config.experimental.set_virtual_device_configuration(
  gpus[0],
  [tf.config.experimental.VirtualDeviceConfiguration(memory_limit=1024)])

In this case, can these two statements be used together in conjunction? or are these mutually exclusive and opposite?

Speak: Can we set memory growth to true but at the same time restrict memory limit?

Refer

[1] https://www.tensorflow.org/guide/gpu#limiting_gpu_memory_growth

0 Answers
Related