aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/stream_executor/host
diff options
context:
space:
mode:
authorGravatar David Majnemer <majnemer@google.com>2017-02-27 09:10:41 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-02-27 10:14:26 -0800
commit8898e88d5b3014a14d269560fb2f928f68562f53 (patch)
tree4f8ce88463017a098a5a638754af0ec333563e0b /tensorflow/stream_executor/host
parent6e9d1c8afeb3f6f544a577652e0773181438bcea (diff)
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
Diffstat (limited to 'tensorflow/stream_executor/host')
-rw-r--r--tensorflow/stream_executor/host/host_gpu_executor.cc6
1 files changed, 5 insertions, 1 deletions
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 <string.h>
+#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<uint64>(4) * 1024 * 1024 * 1024);
- builder.set_clock_rate_ghz(static_cast<float>(CLOCKS_PER_SEC) / 1e9);
+ builder.set_clock_rate_ghz(
+ static_cast<float>(
+ tensorflow::profile_utils::CpuUtils::GetCycleCounterFrequency()) /
+ 1e9);
auto built = builder.Build();
return built.release();