proper warmup loop for latency

This commit is contained in:
Simon Bürger 2024-05-09 23:33:04 +01:00
parent a267986800
commit f7e607eae4

View File

@ -266,7 +266,8 @@ class Benchmark
static void Latency(void) static void Latency(void)
{ {
int Nloop = 200; int Nwarmup = 100;
int Nloop = 1000;
Coordinate simd_layout = GridDefaultSimd(Nd, vComplexD::Nsimd()); Coordinate simd_layout = GridDefaultSimd(Nd, vComplexD::Nsimd());
Coordinate mpi_layout = GridDefaultMpi(); Coordinate mpi_layout = GridDefaultMpi();
@ -302,7 +303,7 @@ class Benchmark
time_statistics timestat; time_statistics timestat;
MPI_Status status; MPI_Status status;
for (int i = 0; i < Nloop; ++i) for (int i = -Nwarmup; i < Nloop; ++i)
{ {
double start = usecond(); double start = usecond();
if (from == me) if (from == me)
@ -321,7 +322,8 @@ class Benchmark
assert(err == MPI_SUCCESS); assert(err == MPI_SUCCESS);
} }
double stop = usecond(); 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 // important: only the 'from' rank has a trustworthy time
MPI_Bcast(t_time.data(), Nloop, MPI_DOUBLE, from, Grid.communicator); MPI_Bcast(t_time.data(), Nloop, MPI_DOUBLE, from, Grid.communicator);