diff --git a/benchmarks/Benchmark_comms.cc b/benchmarks/Benchmark_comms.cc index d4c59785..ce881ef6 100644 --- a/benchmarks/Benchmark_comms.cc +++ b/benchmarks/Benchmark_comms.cc @@ -31,16 +31,31 @@ using namespace std; using namespace Grid; using namespace Grid::QCD; -void statistics(std::vector v, double &mean, double &std_err){ +struct time_statistics{ + double mean; + double err; + double min; + double max; + + void statistics(std::vector v){ double sum = std::accumulate(v.begin(), v.end(), 0.0); mean = sum / v.size(); std::vector diff(v.size()); - std::transform(v.begin(), v.end(), diff.begin(), [mean](double x) { return x - mean; }); + std::transform(v.begin(), v.end(), diff.begin(), [=](double x) { return x - mean; }); double sq_sum = std::inner_product(diff.begin(), diff.end(), diff.begin(), 0.0); - std_err = std::sqrt(sq_sum / (v.size()*(v.size() - 1))); -} + err = std::sqrt(sq_sum / (v.size()*(v.size() - 1))); + auto result = std::minmax_element(v.begin(), v.end()); + min = *result.first; + max = *result.second; +} +}; + +void header(){ + std::cout < t_time(Nloop); - double mean_time, std_err_time; + time_statistics timestat; std::cout<