diff options
Diffstat (limited to 'numbench/main.py')
-rwxr-xr-x | numbench/main.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/numbench/main.py b/numbench/main.py index 3eb8da1..5bdacd2 100755 --- a/numbench/main.py +++ b/numbench/main.py @@ -1,9 +1,22 @@ #! /usr/bin/env python2 -import os, sys, shlex, time +import os, sys, signal, shlex, time from os.path import join as pjoin import subprocess as sp +# Set the signal handler +def close(*args): + load.close() + benchchilds.terminate() + Print._level = 0 + Print() + Print(80*'-') + Print("INTERRUPT TRIGGERED") + Print("Exiting") + exit(0) +signal.signal(signal.SIGINT, close) + + def print_usage(): print "Usage: numbench [blas|cblas|lapack|scalapack|fftw|metis|" + \ "blas_accuracy|lapack_accuracy] file args" @@ -65,6 +78,7 @@ def tests_from_input(input): ########################## import benchconfig as cfg +import benchchilds # If no argument is given, print the help if (len(sys.argv) < 2): @@ -108,6 +122,7 @@ except IndexError: from PortageUtils import * from benchprint import Print +import benchload as load @@ -241,6 +256,8 @@ for tn,(name,test) in enumerate(cfg.tests.items(),1): print +load.close() + # Save the results (first re-order them) results = {} for (name,test) in cfg.tests.items(): |