From 99b2f2f47e810b751a6e7ed71d2fa1c620d31ec5 Mon Sep 17 00:00:00 2001 From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de> Date: Mon, 18 Feb 2019 10:40:33 +0100 Subject: [PATCH] Add a benchmark compilation wrapper --- bin/donkey_benchmark_compilation_wrapper.sh | 17 +++++++++++++++++ ...py => donkey_benchmark_execution_wrapper.py} | 0 python/dune/codegen/sumfact/autotune.py | 12 +++++++++--- 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 bin/donkey_benchmark_compilation_wrapper.sh rename bin/{donkey_benchmark_wrapper.py => donkey_benchmark_execution_wrapper.py} (100%) diff --git a/bin/donkey_benchmark_compilation_wrapper.sh b/bin/donkey_benchmark_compilation_wrapper.sh new file mode 100644 index 00000000..c911180d --- /dev/null +++ b/bin/donkey_benchmark_compilation_wrapper.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +ml gcc/6.4.0 +ml benchmark/1.4.0 +ml python/3.6.3 +ml openmpi +ml cmake +ml openblas +ml metis +ml suite-sparse +ml superlu +ml parmetis + +"$@" + +sleep 0.1s + diff --git a/bin/donkey_benchmark_wrapper.py b/bin/donkey_benchmark_execution_wrapper.py similarity index 100% rename from bin/donkey_benchmark_wrapper.py rename to bin/donkey_benchmark_execution_wrapper.py diff --git a/python/dune/codegen/sumfact/autotune.py b/python/dune/codegen/sumfact/autotune.py index 717b9d80..74146153 100644 --- a/python/dune/codegen/sumfact/autotune.py +++ b/python/dune/codegen/sumfact/autotune.py @@ -304,14 +304,20 @@ def autotune_realization(sf): else: generate_standalone_code(sf, filename) + call = [] + wrapper = get_cmake_cache_entry("DUNE_CODEGEN_BENCHMARK_COMPILATION_WRAPPER") + if wrapper: + call.append(wrapper) + + call.extend(compiler_invocation(executable, filename)) devnull = open(os.devnull, 'w') - ret = subprocess.call(compiler_invocation(executable, filename), stdout=devnull, stderr=subprocess.STDOUT) + ret = subprocess.call(call, stdout=devnull, stderr=subprocess.STDOUT) if ret != 0: - raise CodegenAutotuneError("Compilation of autotune executable failed. Invocation: {}".format(" ".join(compiler_invocation(executable, filename)))) + raise CodegenAutotuneError("Compilation of autotune executable failed. Invocation: {}".format(" ".join(call))) # Check whether the user specified an execution wrapper call = [] - wrapper = get_cmake_cache_entry("DUNE_CODEGEN_BENCHMARK_WRAPPER") + wrapper = get_cmake_cache_entry("DUNE_CODEGEN_BENCHMARK_EXECUTION_WRAPPER") if wrapper: call.append(wrapper) -- GitLab