From 8041ee959addd5414dce68121e4b2b405fe46377 Mon Sep 17 00:00:00 2001 From: Colombo Date: Fri, 27 Sep 2019 18:47:18 +0400 Subject: [PATCH] nnlib initialization: fix choosing best gpu when indexes of gpu are different in tf and nvsmi --- nnlib/nnlib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nnlib/nnlib.py b/nnlib/nnlib.py index a095f15..c8031bf 100644 --- a/nnlib/nnlib.py +++ b/nnlib/nnlib.py @@ -148,13 +148,13 @@ NLayerDiscriminator = nnlib.NLayerDiscriminator import tensorflow as tf nnlib.tf = tf - + if device_config.cpu_only: config = tf.ConfigProto(device_count={'GPU': 0}) else: config = tf.ConfigProto() - if device_config.backend != "tensorflow-generic": + if device_config.force_gpu_idx != -1 and device_config.backend != "tensorflow-generic": #tensorflow-generic is system with NVIDIA card, but w/o NVSMI #so dont hide devices and let tensorflow to choose best card visible_device_list = ''