From 0b909f07abebbc346081119a7c38782e91bd06be Mon Sep 17 00:00:00 2001
From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de>
Date: Fri, 15 Feb 2019 10:58:53 +0100
Subject: [PATCH] Change scaling of autotune results

---
 python/dune/codegen/sumfact/autotune.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/python/dune/codegen/sumfact/autotune.py b/python/dune/codegen/sumfact/autotune.py
index 68d81957..81ac65ba 100644
--- a/python/dune/codegen/sumfact/autotune.py
+++ b/python/dune/codegen/sumfact/autotune.py
@@ -167,7 +167,8 @@ def generate_standalone_code(sf, filename):
                       ])
 
         # Add the implementation of the kernel.
-        f.write("  for(int i=0; i<{}; ++i)\n".format(int(1e9 / sf.operations)))
+        repeats = int(1e9 / sf.operations)
+        f.write("  for(int i=0; i<{}; ++i)\n".format(repeats))
         f.write("  {\n")
         for line in knl.member.lines[1:]:
             f.write("    {}\n".format(line))
@@ -177,7 +178,7 @@ def generate_standalone_code(sf, filename):
         f.writelines(["  auto stop = Dune::PDELab::TSC::stop();\n",
                       "  std::ofstream file;\n",
                       "  file.open(argv[1]);\n",
-                      "  file << Dune::PDELab::TSC::elapsed(start, stop) << std::endl;\n",
+                      "  file << Dune::PDELab::TSC::elapsed(start, stop) / {} << std::endl;\n".format(repeats),
                       "  file.close();\n",
                       "  accum += output[dis(rng)];\n",
                       "  std::cout << accum;\n",
-- 
GitLab