Commit e5e8faef authored by Robert Kimball's avatar Robert Kimball Committed by Sang Ik Lee

Don't imbue locale to cout, imbue a stringstream instead so that it does not…

Don't imbue locale to cout, imbue a stringstream instead so that it does not contaminate ngraph output (#3989)
parent 86bf4762
...@@ -38,8 +38,9 @@ vector<runtime::PerformanceCounter> run_benchmark(shared_ptr<Function> f, ...@@ -38,8 +38,9 @@ vector<runtime::PerformanceCounter> run_benchmark(shared_ptr<Function> f,
auto backend = runtime::Backend::create(backend_name); auto backend = runtime::Backend::create(backend_name);
auto exec = backend->compile(f, timing_detail); auto exec = backend->compile(f, timing_detail);
timer.stop(); timer.stop();
cout.imbue(locale("")); stringstream ss;
cout << "compile time: " << timer.get_milliseconds() << "ms" << endl; ss.imbue(locale(""));
ss << "compile time: " << timer.get_milliseconds() << "ms" << endl;
vector<shared_ptr<runtime::HostTensor>> arg_data; vector<shared_ptr<runtime::HostTensor>> arg_data;
vector<shared_ptr<runtime::Tensor>> args; vector<shared_ptr<runtime::Tensor>> args;
...@@ -111,7 +112,8 @@ vector<runtime::PerformanceCounter> run_benchmark(shared_ptr<Function> f, ...@@ -111,7 +112,8 @@ vector<runtime::PerformanceCounter> run_benchmark(shared_ptr<Function> f,
} }
t1.stop(); t1.stop();
float time = t1.get_milliseconds(); float time = t1.get_milliseconds();
cout << time / iterations << "ms per iteration" << endl; ss << time / iterations << "ms per iteration" << endl;
cout << ss.str();
vector<runtime::PerformanceCounter> perf_data = exec->get_performance_data(); vector<runtime::PerformanceCounter> perf_data = exec->get_performance_data();
return perf_data; return perf_data;
......
...@@ -120,8 +120,9 @@ vector<runtime::PerformanceCounter> run_benchmark_pipelined(shared_ptr<Function> ...@@ -120,8 +120,9 @@ vector<runtime::PerformanceCounter> run_benchmark_pipelined(shared_ptr<Function>
auto backend = runtime::Backend::create(backend_name); auto backend = runtime::Backend::create(backend_name);
auto exec = backend->compile(f, timing_detail); auto exec = backend->compile(f, timing_detail);
timer.stop(); timer.stop();
cout.imbue(locale("")); stringstream ss;
cout << "compile time: " << timer.get_milliseconds() << "ms" << endl; ss.imbue(locale(""));
ss << "compile time: " << timer.get_milliseconds() << "ms" << endl;
set_denormals_flush_to_zero(); set_denormals_flush_to_zero();
// Create random input data for all input tensors // Create random input data for all input tensors
...@@ -182,7 +183,8 @@ vector<runtime::PerformanceCounter> run_benchmark_pipelined(shared_ptr<Function> ...@@ -182,7 +183,8 @@ vector<runtime::PerformanceCounter> run_benchmark_pipelined(shared_ptr<Function>
threads[i].join(); threads[i].join();
} }
float time = s_timer.get_milliseconds(); float time = s_timer.get_milliseconds();
cout << time / iterations << "ms per iteration" << endl; ss << time / iterations << "ms per iteration" << endl;
cout << ss.str();
vector<runtime::PerformanceCounter> perf_data = exec->get_performance_data(); vector<runtime::PerformanceCounter> perf_data = exec->get_performance_data();
return perf_data; return perf_data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment