From 8898e88d5b3014a14d269560fb2f928f68562f53 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Mon, 27 Feb 2017 09:10:41 -0800 Subject: Set the clock rate for the host accurately We used CLOCKS_PER_SEC which is defined only in terms of the clock system call. What we needed to use was the hardware clock rate. Change: 148655561 --- tensorflow/stream_executor/host/host_gpu_executor.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tensorflow/stream_executor/host/host_gpu_executor.cc b/tensorflow/stream_executor/host/host_gpu_executor.cc index 830bc9a681..259bd10238 100644 --- a/tensorflow/stream_executor/host/host_gpu_executor.cc +++ b/tensorflow/stream_executor/host/host_gpu_executor.cc @@ -19,6 +19,7 @@ limitations under the License. #include +#include "tensorflow/core/platform/profile_utils/cpu_utils.h" #include "tensorflow/stream_executor/host/host_platform_id.h" #include "tensorflow/stream_executor/host/host_stream.h" #include "tensorflow/stream_executor/host/host_timer.h" @@ -190,7 +191,10 @@ DeviceDescription *HostExecutor::PopulateDeviceDescription() const { // doesn't result in thrashing or other badness? 4GiB chosen arbitrarily. builder.set_device_memory_size(static_cast(4) * 1024 * 1024 * 1024); - builder.set_clock_rate_ghz(static_cast(CLOCKS_PER_SEC) / 1e9); + builder.set_clock_rate_ghz( + static_cast( + tensorflow::profile_utils::CpuUtils::GetCycleCounterFrequency()) / + 1e9); auto built = builder.Build(); return built.release(); -- cgit v1.2.3