From eacd852579aa32cde5755c39000044469efe540b Mon Sep 17 00:00:00 2001 From: Trivernis Date: Thu, 14 Jan 2021 15:29:34 +0100 Subject: [PATCH] Change default benchmark filename Signed-off-by: Trivernis --- src/main.rs | 30 ++++++++++++++++++++++++++++-- src/utils/args.rs | 4 ++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index c9699d6..02ac3ec 100644 --- a/src/main.rs +++ b/src/main.rs @@ -103,7 +103,20 @@ fn calculate_primes( fn bench_local_size(opts: BenchLocalSize, mut controller: KernelController) -> OCLStreamResult<()> { set_output_colored(opts.bench_options.general_options.color); controller.set_concurrency(opts.bench_options.general_options.threads); - let bench_writer = open_write_buffered(&opts.bench_options.benchmark_file); + let bench_output = opts + .bench_options + .benchmark_file + .unwrap_or(PathBuf::from(format!( + "bench_local_{}-{}-{}_g{}_r{}_s{}_{}.csv", + opts.local_size_start, + opts.local_size_step, + opts.local_size_stop, + opts.global_size, + opts.bench_options.repetitions, + opts.bench_options.calculation_steps, + Local::now().format("%Y%m%d%H%M%S") + ))); + let bench_writer = open_write_buffered(&bench_output); let csv_writer = ThreadedCSVWriter::new( bench_writer, &[ @@ -136,7 +149,20 @@ fn bench_global_size( ) -> OCLStreamResult<()> { set_output_colored(opts.bench_options.general_options.color); controller.set_concurrency(opts.bench_options.general_options.threads); - let bench_writer = open_write_buffered(&opts.bench_options.benchmark_file); + let bench_output = opts + .bench_options + .benchmark_file + .unwrap_or(PathBuf::from(format!( + "bench_global_{}-{}-{}_l{}_r{}_s{}_{}.csv", + opts.global_size_start, + opts.global_size_step, + opts.global_size_stop, + opts.local_size, + opts.bench_options.repetitions, + opts.bench_options.calculation_steps, + Local::now().format("%Y%m%d%H%M%S") + ))); + let bench_writer = open_write_buffered(&bench_output); let csv_writer = ThreadedCSVWriter::new( bench_writer, &[ diff --git a/src/utils/args.rs b/src/utils/args.rs index 9e00000..17a6bb2 100644 --- a/src/utils/args.rs +++ b/src/utils/args.rs @@ -125,8 +125,8 @@ pub struct BenchOptions { pub calculation_steps: u32, /// The output file for timings - #[structopt(short = "o", long = "bench-output", default_value = "bench.csv")] - pub benchmark_file: PathBuf, + #[structopt(short = "o", long = "bench-output")] + pub benchmark_file: Option, /// The average of n runs that is used instead of using one value only. /// By default the benchmark for each step is only run once