From 4384bb4146a87d2dcb7eb04833e6728822173666 Mon Sep 17 00:00:00 2001
From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de>
Date: Mon, 18 Feb 2019 15:37:48 +0100
Subject: [PATCH] Build file system synchronization into the autotuner.

---
 bin/donkey_benchmark_compilation_wrapper.sh | 3 ---
 bin/donkey_benchmark_execution_wrapper.py   | 5 -----
 python/dune/codegen/sumfact/autotune.py     | 9 +++++++++
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/bin/donkey_benchmark_compilation_wrapper.sh b/bin/donkey_benchmark_compilation_wrapper.sh
index e2691b5d..a786d111 100755
--- a/bin/donkey_benchmark_compilation_wrapper.sh
+++ b/bin/donkey_benchmark_compilation_wrapper.sh
@@ -13,7 +13,4 @@ ml parmetis
 
 ("$@")
 code=$?
-echo "Code: $code"
-sleep 0.1s
-
 exit $code
diff --git a/bin/donkey_benchmark_execution_wrapper.py b/bin/donkey_benchmark_execution_wrapper.py
index ef77e1a1..d3839633 100755
--- a/bin/donkey_benchmark_execution_wrapper.py
+++ b/bin/donkey_benchmark_execution_wrapper.py
@@ -13,8 +13,3 @@ ret = subprocess.call(command)
 # If that failed - fail!
 if ret != 0:
     sys.exit(ret)
-
-# If that was succesful, wait for the output file to be available on the filesystem
-# This step is necessary because the NFS synchronization is too slow for our workflow.
-while not os.path.isfile(sys.argv[-1]):
-    time.sleep(0.1)
diff --git a/python/dune/codegen/sumfact/autotune.py b/python/dune/codegen/sumfact/autotune.py
index d19fd7be..e0788ca6 100644
--- a/python/dune/codegen/sumfact/autotune.py
+++ b/python/dune/codegen/sumfact/autotune.py
@@ -14,6 +14,7 @@ import re
 import subprocess
 import filelock
 import hashlib
+import time
 
 
 def get_cmake_cache_entry(entry):
@@ -320,6 +321,10 @@ def autotune_realization(sf):
                 if ret != 0:
                     raise CodegenAutotuneError("Compilation of autotune executable failed. Invocation: {}".format(" ".join(call)))
 
+                # File system synchronization!
+                while not os.path.exists(executable):
+                    time.sleep(0.01)
+
                 # Check whether the user specified an execution wrapper
                 call = []
                 wrapper = get_cmake_cache_entry("DUNE_CODEGEN_BENCHMARK_EXECUTION_WRAPPER")
@@ -337,6 +342,10 @@ def autotune_realization(sf):
                 if ret != 0:
                     raise CodegenAutotuneError("Execution of autotune benchmark failed. Invocation: {}".format(" ".join(call)))
 
+                # File system synchronization!
+                while not os.path.exists(logname):
+                    time.sleep(0.01)
+
             # Extract the result form the log file
             if get_option("autotune_google_benchmark"):
                 import json
-- 
GitLab