aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/tensors
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-01-28 16:51:40 -0800
committerGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-01-28 16:51:40 -0800
commita68864b6bce5e00fdec07a9d4dae7376dedb654e (patch)
tree5f861aacb855acafa89244cd495638846b4c212f /bench/tensors
parent8217281ae4bf452d5e17ac894fe485ed3e9d4302 (diff)
Updated the benchmarking code to print the number of flops processed instead of the number of bytes.
Diffstat (limited to 'bench/tensors')
-rw-r--r--bench/tensors/benchmark.h3
-rw-r--r--bench/tensors/benchmark_main.cc14
-rw-r--r--bench/tensors/tensor_benchmarks.h2
3 files changed, 9 insertions, 10 deletions
diff --git a/bench/tensors/benchmark.h b/bench/tensors/benchmark.h
index 2c06075e0..f115b54ad 100644
--- a/bench/tensors/benchmark.h
+++ b/bench/tensors/benchmark.h
@@ -41,10 +41,9 @@ class Benchmark {
void RunWithArg(int arg);
};
} // namespace testing
-void SetBenchmarkBytesProcessed(int64_t);
+void SetBenchmarkFlopsProcessed(int64_t);
void StopBenchmarkTiming();
void StartBenchmarkTiming();
#define BENCHMARK(f) \
static ::testing::Benchmark* _benchmark_##f __attribute__((unused)) = \
(new ::testing::Benchmark(#f, f))
-
diff --git a/bench/tensors/benchmark_main.cc b/bench/tensors/benchmark_main.cc
index b2f457c96..65dbd89bb 100644
--- a/bench/tensors/benchmark_main.cc
+++ b/bench/tensors/benchmark_main.cc
@@ -23,7 +23,7 @@
#include <time.h>
#include <map>
-static int64_t g_bytes_processed;
+static int64_t g_flops_processed;
static int64_t g_benchmark_total_time_ns;
static int64_t g_benchmark_start_time_ns;
typedef std::map<std::string, ::testing::Benchmark*> BenchmarkMap;
@@ -124,7 +124,7 @@ void Benchmark::Run() {
}
}
void Benchmark::RunRepeatedlyWithArg(int iterations, int arg) {
- g_bytes_processed = 0;
+ g_flops_processed = 0;
g_benchmark_total_time_ns = 0;
g_benchmark_start_time_ns = NanoTime();
if (fn_ != NULL) {
@@ -153,10 +153,10 @@ void Benchmark::RunWithArg(int arg) {
}
char throughput[100];
throughput[0] = '\0';
- if (g_benchmark_total_time_ns > 0 && g_bytes_processed > 0) {
- double mib_processed = static_cast<double>(g_bytes_processed)/1e6;
+ if (g_benchmark_total_time_ns > 0 && g_flops_processed > 0) {
+ double mflops_processed = static_cast<double>(g_flops_processed)/1e6;
double seconds = static_cast<double>(g_benchmark_total_time_ns)/1e9;
- snprintf(throughput, sizeof(throughput), " %8.2f MiB/s", mib_processed/seconds);
+ snprintf(throughput, sizeof(throughput), " %8.2f MFlops/s", mflops_processed/seconds);
}
char full_name[100];
if (fn_range_ != NULL) {
@@ -175,8 +175,8 @@ void Benchmark::RunWithArg(int arg) {
fflush(stdout);
}
} // namespace testing
-void SetBenchmarkBytesProcessed(int64_t x) {
- g_bytes_processed = x;
+void SetBenchmarkFlopsProcessed(int64_t x) {
+ g_flops_processed = x;
}
void StopBenchmarkTiming() {
if (g_benchmark_start_time_ns != 0) {
diff --git a/bench/tensors/tensor_benchmarks.h b/bench/tensors/tensor_benchmarks.h
index 6b9d13446..ba7e7eb48 100644
--- a/bench/tensors/tensor_benchmarks.h
+++ b/bench/tensors/tensor_benchmarks.h
@@ -367,7 +367,7 @@ template <typename Device> class BenchmarkSuite {
}
#endif
StopBenchmarkTiming();
- SetBenchmarkBytesProcessed(num_items);
+ SetBenchmarkFlopsProcessed(num_items);
}