Skip to content

Commit d907223

Browse files
authored
Add fix for multiple instances on a single GPU (#1192)
1 parent 51abb23 commit d907223

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ml-agents/mlagents/trainers/trainer_controller.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,10 @@ def start_learning(self):
291291

292292
tf.reset_default_graph()
293293

294-
with tf.Session() as sess:
294+
# Prevent a single session from taking all GPU memory.
295+
config = tf.ConfigProto()
296+
config.gpu_options.allow_growth = True
297+
with tf.Session(config=config) as sess:
295298
self._initialize_trainers(trainer_config, sess)
296299
for _, t in self.trainers.items():
297300
self.logger.info(t)

0 commit comments

Comments
 (0)