Skip to content

Commit 43ceded

Browse files
committed
feat: enforce google benchmark options
1 parent 6fe2627 commit 43ceded

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

benchmark/benchmark_advection_2d.cpp

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ void ADVECTION_2D(benchmark::State& state)
193193
MPI_Barrier(MPI_COMM_WORLD);
194194
#endif
195195
state.ResumeTiming();
196-
for (int i = 0; i < 10; i++)
196+
int ITER_STEPS = 10;
197+
for (int i = 0; i < ITER_STEPS; i++)
197198
{
198199
MRadaptation(mr_epsilon, mr_regularity);
199200
t += dt;
@@ -220,22 +221,36 @@ void ADVECTION_2D(benchmark::State& state)
220221
// BENCHMARK(ADVECTION_2D);
221222

222223
// MRA with min_level = 5
223-
BENCHMARK_TEMPLATE(ADVECTION_2D, 5, 8);
224-
BENCHMARK_TEMPLATE(ADVECTION_2D, 5, 10);
225-
BENCHMARK_TEMPLATE(ADVECTION_2D, 5, 12);
226-
BENCHMARK_TEMPLATE(ADVECTION_2D, 5, 14);
224+
BENCHMARK_TEMPLATE(ADVECTION_2D, 5, 8)->Unit(benchmark::kMillisecond)->Iterations(1);
225+
;
226+
BENCHMARK_TEMPLATE(ADVECTION_2D, 5, 10)->Unit(benchmark::kMillisecond)->Iterations(1);
227+
;
228+
BENCHMARK_TEMPLATE(ADVECTION_2D, 5, 12)->Unit(benchmark::kMillisecond)->Iterations(1);
229+
;
230+
BENCHMARK_TEMPLATE(ADVECTION_2D, 5, 14)->Unit(benchmark::kMillisecond)->Iterations(1);
231+
;
227232

228233
// MRA with max_level - min-level = 2
229-
BENCHMARK_TEMPLATE(ADVECTION_2D, 6, 8);
230-
BENCHMARK_TEMPLATE(ADVECTION_2D, 8, 10);
231-
BENCHMARK_TEMPLATE(ADVECTION_2D, 10, 12);
232-
BENCHMARK_TEMPLATE(ADVECTION_2D, 12, 14);
234+
BENCHMARK_TEMPLATE(ADVECTION_2D, 6, 8)->Unit(benchmark::kMillisecond)->Iterations(1);
235+
;
236+
BENCHMARK_TEMPLATE(ADVECTION_2D, 8, 10)->Unit(benchmark::kMillisecond)->Iterations(1);
237+
;
238+
BENCHMARK_TEMPLATE(ADVECTION_2D, 10, 12)->Unit(benchmark::kMillisecond)->Iterations(1);
239+
;
240+
BENCHMARK_TEMPLATE(ADVECTION_2D, 12, 14)->Unit(benchmark::kMillisecond)->Iterations(1);
241+
;
233242

234243
// Uniform
235-
BENCHMARK_TEMPLATE(ADVECTION_2D, 6, 6);
236-
BENCHMARK_TEMPLATE(ADVECTION_2D, 8, 8);
237-
BENCHMARK_TEMPLATE(ADVECTION_2D, 10, 10);
238-
BENCHMARK_TEMPLATE(ADVECTION_2D, 12, 12);
244+
BENCHMARK_TEMPLATE(ADVECTION_2D, 6, 6)->Unit(benchmark::kMillisecond)->Iterations(1);
245+
;
246+
BENCHMARK_TEMPLATE(ADVECTION_2D, 8, 8)->Unit(benchmark::kMillisecond)->Iterations(1);
247+
;
248+
BENCHMARK_TEMPLATE(ADVECTION_2D, 10, 10)->Unit(benchmark::kMillisecond)->Iterations(1);
249+
;
250+
BENCHMARK_TEMPLATE(ADVECTION_2D, 12, 12)->Unit(benchmark::kMillisecond)->Iterations(1);
251+
;
252+
BENCHMARK_TEMPLATE(ADVECTION_2D, 14, 14)->Unit(benchmark::kMillisecond)->Iterations(1);
253+
;
239254

240255
/** SOURCE : https://gist.github.com/mdavezac/eb16de7e8fc08e522ff0d420516094f5
241256
**/

0 commit comments

Comments
 (0)