From bc76efa13b9495884c5a30eba4a3c8139550015d Mon Sep 17 00:00:00 2001 From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de> Date: Fri, 28 Sep 2018 11:08:49 +0200 Subject: [PATCH] Move all benchmark results into a dedicated subdirectory --- python/dune/perftool/sumfact/autotune.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/python/dune/perftool/sumfact/autotune.py b/python/dune/perftool/sumfact/autotune.py index 9933e585..24f85dc0 100644 --- a/python/dune/perftool/sumfact/autotune.py +++ b/python/dune/perftool/sumfact/autotune.py @@ -164,9 +164,15 @@ def generate_standalone_code(sf, filename, logname): def autotune_realization(sf): - name = "autotune_sumfact_{}".format(sf.function_name) - filename = "{}.cc".format(name) - logname = "{}.log".format(name) + # Make sure that the benchmark directory exists + dir = os.path.join(get_option("project_basedir"), "autotune-benchmarks") + if not os.path.exists(dir): + os.mkdir(dir) + + basename = "autotune_sumfact_{}".format(sf.function_name) + name = os.path.join(dir, "autotune_sumfact_{}".format(sf.function_name)) + filename = os.path.join(dir, "{}.cc".format(basename)) + logname = os.path.join(dir, "{}.log".format(basename)) # If the log file already exists, we can reuse the benchmark results # and do not need to rerun it. @@ -180,7 +186,7 @@ def autotune_realization(sf): # Run the benchmark program devnull = open(os.devnull, 'w') - ret = subprocess.call(["./{}".format(name)], stdout=devnull, stderr=subprocess.STDOUT) + ret = subprocess.call([name], stdout=devnull, stderr=subprocess.STDOUT) assert ret == 0 # Extract the result form the log file -- GitLab