Skip to content

Commit 72ae75b

Browse files
andrewharptensorflower-gardener
authored andcommitted
Add output_prefix parameter benchmark_model so that output directory can be explicitly specified on the command-line.
Change: 126725665
1 parent dd92f1b commit 72ae75b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

tensorflow/tools/benchmark/benchmark_model.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ int Main(int argc, char** argv) {
169169
string run_delay = "-1.0";
170170
int num_threads = -1;
171171
string benchmark_name = "";
172+
string output_prefix = "";
172173

173174
const bool parse_result = ParseFlags(
174175
&argc, argv, {
@@ -181,6 +182,7 @@ int Main(int argc, char** argv) {
181182
Flag("run_delay", &run_delay), //
182183
Flag("num_threads", &num_threads), //
183184
Flag("benchmark_name", &benchmark_name), //
185+
Flag("output_prefix", &output_prefix), //
184186
});
185187

186188
if (!parse_result) {
@@ -203,6 +205,7 @@ int Main(int argc, char** argv) {
203205
LOG(INFO) << "Inter-run delay (seconds): [" << run_delay << "]";
204206
LOG(INFO) << "Num threads: [" << num_threads << "]";
205207
LOG(INFO) << "Benchmark name: [" << benchmark_name << "]";
208+
LOG(INFO) << "Output prefix: [" << output_prefix << "]";
206209

207210
std::unique_ptr<Session> session;
208211
std::unique_ptr<StatSummarizer> stats;
@@ -238,7 +241,7 @@ int Main(int argc, char** argv) {
238241

239242
stats->PrintStepStats();
240243

241-
if (!benchmark_name.empty()) {
244+
if (!benchmark_name.empty() && !output_prefix.empty()) {
242245
// Compute the total number of values per input.
243246
int64 total_size = 1;
244247
for (int32 size : sizes) {
@@ -251,7 +254,7 @@ int Main(int argc, char** argv) {
251254
(1024 * 1024);
252255

253256
// Report the stats.
254-
TestReporter reporter(benchmark_name);
257+
TestReporter reporter(output_prefix, benchmark_name);
255258
reporter.Initialize();
256259
reporter.Benchmark(num_runs, -1.0, wall_time, throughput);
257260
reporter.Close();

0 commit comments

Comments
 (0)