高GPU内存使用但零易失性gpu-util

时间:2017-01-17 08:29:14

标签: python tensorflow gpu nvidia

我的新培训代码占用了高GPU内存使用率但零易失性gpu-util

enter image description here

/home/diana/data/KaggleDiabeticRetinopaI tensorflow/core/common_runtime/gpu/gpu_device.cc:885] Found device 0 with     properties: 
name: GeForce GTX 1080
major: 6 minor: 1 memoryClockRate (GHz) 1.835
pciBusID 0000:05:00.0
Total memory: 7.92GiB
Free memory: 7.81GiB
I tensorflow/core/common_runtime/gpu/gpu_device.cc:906] DMA: 0 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:916] 0:   Y 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlowdevice (/gpu:0) -> (device: 0, name: GeForce GTX 1080, pci bus id: 0000:05:00.0)

我正在尝试一个新的数据生成器,旧的数据生成器使用10%的volatile gpu-util运行,因此环境或tensorflow版本将不是关键问题

所以我想知道是否有人能告诉我代码中的哪个元素可能会导致这个问题?

非常感谢你!

1 个答案:

答案 0 :(得分:3)

默认情况下,Tensorflow会在您创建会话时预先分配所有可用的VRAM,无论是否实际需要。 0%易失性GPU-util仅显示实际上没有任何东西"运行"在GPU上(没有活动内核)。

如果您不希望这种情况发生,可以将allow_growth设置为True,并在创建会话时在config对象中将其正确传递。

阅读tf.Sessionconfig.proto了解详情。

编辑:这是您将allow_growth设置为True

的方法
session = tf.Session(config=tf.ConfigProto(gpu_options=tf.GPUOptions(allow_growth=True)))

enter image description here

相关问题