From 70db082057aa8f33933d79d7f039f285570505fe Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Thu, 27 Feb 2020 14:34:35 -0800 Subject: [PATCH] Bump up `MinSystemMemory` to 6% of `available_memory`. PiperOrigin-RevId: 297689968 Change-Id: I4a6f3fbcc9c4dcc182d1c5b90f0b3e597e04e762 --- tensorflow/core/common_runtime/gpu/gpu_device.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tensorflow/core/common_runtime/gpu/gpu_device.cc b/tensorflow/core/common_runtime/gpu/gpu_device.cc index eaf16d2cc66..65b895c2e21 100644 --- a/tensorflow/core/common_runtime/gpu/gpu_device.cc +++ b/tensorflow/core/common_runtime/gpu/gpu_device.cc @@ -805,17 +805,20 @@ int64 MinSystemMemory(int64 available_memory) { // We use the following heuristic for now: // // If the available_memory is < 2GiB, we allocate 225MiB to system memory. - // Otherwise, allocate max(300MiB, 0.05 * available_memory) to system memory. + // Otherwise, allocate max(300MiB, kMinSystemMemoryFraction * + // available_memory) to system memory. // // In the future we could be more sophisticated by using a table of devices. int64 min_system_memory; + constexpr float kMinSystemMemoryFraction = 0.06; if (available_memory < (1LL << 31)) { // 225MiB min_system_memory = 225 * 1024 * 1024; } else { - // max(300 MiB, 0.05 * available_memory) - min_system_memory = - std::max(int64{314572800}, static_cast(available_memory * 0.05)); + // max(300 MiB, kMinSystemMemoryFraction * available_memory) + min_system_memory = std::max( + int64{314572800}, + static_cast(available_memory * kMinSystemMemoryFraction)); } #if defined(__GNUC__) && defined(__OPTIMIZE__) // Do nothing