From cda87e9f70222875d8b16fb6cffdf0a04781acae Mon Sep 17 00:00:00 2001 From: Hal Finkel <hfinkel@anl.gov> Date: Fri, 26 Aug 2016 19:28:54 -0500 Subject: [PATCH] The GIO write benchmark should not use completely trivial data (so compression is not trivial) --- GenericIOBenchmarkWrite.cxx | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/GenericIOBenchmarkWrite.cxx b/GenericIOBenchmarkWrite.cxx index ef10b5c..3134efd 100644 --- a/GenericIOBenchmarkWrite.cxx +++ b/GenericIOBenchmarkWrite.cxx @@ -43,6 +43,7 @@ #include <cstdio> #include <cstring> #include <cmath> +#include <algorithm> #include <iostream> #include <string> #include <cassert> @@ -56,6 +57,18 @@ using namespace std; using namespace gio; +template <typename T> +struct Generator { + Generator(T start, T inc) : value(start), inc(inc) {} + T operator()() { + value += inc; + return value; + } + + T value; + T inc; +}; + int main(int argc, char *argv[]) { MPI_Init(&argc, &argv); @@ -119,14 +132,14 @@ int main(int argc, char *argv[]) { id.resize(Np + GIO.requestedExtraSpace()/sizeof(ID_T)); mask.resize(Np + GIO.requestedExtraSpace()/sizeof(MASK_T)); - std::fill(xx.begin(), xx.end(), 25); - std::fill(yy.begin(), yy.end(), 25); - std::fill(zz.begin(), zz.end(), 25); - std::fill(vx.begin(), vx.end(), 25); - std::fill(vy.begin(), vy.end(), 25); - std::fill(vz.begin(), vz.end(), 25); - std::fill(phi.begin(), phi.end(), 25); - std::fill(id.begin(), id.end(), 25); + std::generate(xx.begin(), xx.end(), Generator<POSVEL_T>(25, 3)); + std::generate(yy.begin(), yy.end(), Generator<POSVEL_T>(25, 3)); + std::generate(zz.begin(), zz.end(), Generator<POSVEL_T>(25, 3)); + std::generate(vx.begin(), vx.end(), Generator<POSVEL_T>(25, 3)); + std::generate(vy.begin(), vy.end(), Generator<POSVEL_T>(25, 3)); + std::generate(vz.begin(), vz.end(), Generator<POSVEL_T>(25, 3)); + std::generate(phi.begin(), phi.end(), Generator<POSVEL_T>(25, 3)); + std::generate(id.begin(), id.end(), Generator<ID_T>(25, 3)); std::fill(mask.begin(), mask.end(), 25); GIO.addVariable("x", xx, CoordFlagsX | GenericIO::VarHasExtraSpace); -- GitLab