Skip to content
Snippets Groups Projects
Commit a701ab4b authored by Dominic Kempf's avatar Dominic Kempf
Browse files

Change call to benchmark programs and donkey wrapper

parent e4a56e90
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
import time
import sys
import os
# Run the actual command
command = "srun -p haswell10c -n 20 -c 2 --cpu_bin=verbose,core".split()
command.append(sys.argv[1])
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[2]):
time.sleep(0.1)
#!/bin/bash
srun -p haswell10c -n 20 -c 2 --cpu_bin=verbose,core $1
# Give the file system some time to get our results file handled
sleep 0.1s
...@@ -63,7 +63,7 @@ def compiler_invocation(name, filename): ...@@ -63,7 +63,7 @@ def compiler_invocation(name, filename):
return compile_flags return compile_flags
def generate_standalone_code(sf, filename, logname): def generate_standalone_code(sf, filename):
delete_cache_items("kernel_default") delete_cache_items("kernel_default")
with open(filename, "w") as f: with open(filename, "w") as f:
...@@ -174,7 +174,7 @@ def generate_standalone_code(sf, filename, logname): ...@@ -174,7 +174,7 @@ def generate_standalone_code(sf, filename, logname):
# Stop the TSC timer and write the result to a file # Stop the TSC timer and write the result to a file
f.writelines([" auto stop = Dune::PDELab::TSC::stop();\n", f.writelines([" auto stop = Dune::PDELab::TSC::stop();\n",
" std::ofstream file;\n", " std::ofstream file;\n",
" file.open(\"{}\");\n".format(logname), " 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",
" file.close();\n", " file.close();\n",
" accum += output[dis(rng)];\n", " accum += output[dis(rng)];\n",
...@@ -200,7 +200,7 @@ def autotune_realization(sf): ...@@ -200,7 +200,7 @@ def autotune_realization(sf):
with cache_restoring(): with cache_restoring():
with filelock.FileLock(lock): with filelock.FileLock(lock):
if not os.path.isfile(logname): if not os.path.isfile(logname):
generate_standalone_code(sf, filename, logname) generate_standalone_code(sf, filename)
ret = subprocess.call(compiler_invocation(name, filename)) ret = subprocess.call(compiler_invocation(name, filename))
assert ret == 0 assert ret == 0
...@@ -213,6 +213,7 @@ def autotune_realization(sf): ...@@ -213,6 +213,7 @@ def autotune_realization(sf):
# Run the benchmark program # Run the benchmark program
call.append(name) call.append(name)
call.append(logname)
devnull = open(os.devnull, 'w') devnull = open(os.devnull, 'w')
ret = subprocess.call(call, stdout=devnull, stderr=subprocess.STDOUT) ret = subprocess.call(call, stdout=devnull, stderr=subprocess.STDOUT)
assert ret == 0 assert ret == 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment