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

Add a bit of error handling

parent fd63c424
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,7 @@ import os
# Run the actual command
command = "srun -p haswell10c -n 20 -c 2 --cpu_bin=verbose,core".split()
command.append(sys.argv[1])
command.extend(sys.argv[1:])
ret = subprocess.call(command)
# If that failed - fail!
......
......@@ -19,3 +19,7 @@ class PerftoolLoopyError(PerftoolError):
class PerftoolVectorizationError(PerftoolCodegenError):
pass
class PerftoolAutotuneError(PerftoolVectorizationError):
pass
......@@ -4,6 +4,7 @@ from dune.perftool.generation import cache_restoring, delete_cache_items
from dune.perftool.loopy.target import DuneTarget
from dune.perftool.sumfact.realization import realize_sumfact_kernel_function
from dune.perftool.options import get_option, set_option
from dune.perftool.error import PerftoolAutotuneError
import loopy as lp
from pytools import product
......@@ -203,7 +204,8 @@ def autotune_realization(sf):
generate_standalone_code(sf, filename)
ret = subprocess.call(compiler_invocation(name, filename))
assert ret == 0
if ret != 0:
raise PerftoolAutotuneError("Compilation of autotune executable failed. Invocation: {}".format(" ".join(compiler_invocation(name, filename))))
# Check whether the user specified an execution wrapper
call = []
......@@ -216,7 +218,8 @@ def autotune_realization(sf):
call.append(logname)
devnull = open(os.devnull, 'w')
ret = subprocess.call(call, stdout=devnull, stderr=subprocess.STDOUT)
assert ret == 0
if ret != 0:
raise PerftoolAutotuneError("Execution of autotune benchmark failed. Invocation: {}".format(" ".join(call)))
# Extract the result form the log file
return float(next(iter(open(logname, "r")))) / 1000000
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