From f7e607eae4a15f9a19d82d69b770f63742e50a9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20B=C3=BCrger?= Date: Thu, 9 May 2024 23:33:04 +0100 Subject: [PATCH] proper warmup loop for latency --- Grid/Benchmark_Grid.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Grid/Benchmark_Grid.cpp b/Grid/Benchmark_Grid.cpp index 8b81863..d8b8de9 100644 --- a/Grid/Benchmark_Grid.cpp +++ b/Grid/Benchmark_Grid.cpp @@ -266,7 +266,8 @@ class Benchmark static void Latency(void) { - int Nloop = 200; + int Nwarmup = 100; + int Nloop = 1000; Coordinate simd_layout = GridDefaultSimd(Nd, vComplexD::Nsimd()); Coordinate mpi_layout = GridDefaultMpi(); @@ -302,7 +303,7 @@ class Benchmark time_statistics timestat; MPI_Status status; - for (int i = 0; i < Nloop; ++i) + for (int i = -Nwarmup; i < Nloop; ++i) { double start = usecond(); if (from == me) @@ -321,7 +322,8 @@ class Benchmark assert(err == MPI_SUCCESS); } double stop = usecond(); - t_time[i] = stop - start; + if (i >= 0) + t_time[i] = stop - start; } // important: only the 'from' rank has a trustworthy time MPI_Bcast(t_time.data(), Nloop, MPI_DOUBLE, from, Grid.communicator);