From 70471e9f63eaa55b9fdf4e12365772e38a81e443 Mon Sep 17 00:00:00 2001 From: Bumsoo Kim Date: Thu, 22 Jul 2021 22:40:10 +0900 Subject: [PATCH] Add Memory Growth Differ error in Multi-GPU In Multi-GPU environment, previous code occur `ValueError: Memory growth cannot differ between GPU devices` See more about tensorflow docs : https://www.tensorflow.org/guide/gpu --- object_tracker.py | 1 + 1 file changed, 1 insertion(+) diff --git a/object_tracker.py b/object_tracker.py index 3e37d4b2..5a18d8e4 100644 --- a/object_tracker.py +++ b/object_tracker.py @@ -5,6 +5,7 @@ import tensorflow as tf physical_devices = tf.config.experimental.list_physical_devices('GPU') if len(physical_devices) > 0: + tf.config.experimental.set_visible_devices(physical_devices[0], 'GPU') tf.config.experimental.set_memory_growth(physical_devices[0], True) from absl import app, flags, logging from absl.flags import FLAGS