summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Arteaga <andyspiros@gmail.com>2012-08-04 03:01:37 +0200
committerAndrea Arteaga <andyspiros@gmail.com>2012-08-04 03:01:37 +0200
commit9625486543cff4fee2dde786bb68b3ba166e95dc (patch)
tree75f91f5fad593a335f2ddc03d82f5713fc5777b5
parentNew BTL module lapacke. (diff)
downloadauto-numerical-bench-9625486543cff4fee2dde786bb68b3ba166e95dc.tar.gz
auto-numerical-bench-9625486543cff4fee2dde786bb68b3ba166e95dc.tar.bz2
auto-numerical-bench-9625486543cff4fee2dde786bb68b3ba166e95dc.zip
Changed BTL init operation output from stderr to stdout. Log stderr of
BTL to a different file.
-rw-r--r--btl/generic_bench/utils/utilities.h6
-rw-r--r--numbench/utils/btl.py41
2 files changed, 35 insertions, 12 deletions
diff --git a/btl/generic_bench/utils/utilities.h b/btl/generic_bench/utils/utilities.h
index d2330d0..320ad4a 100644
--- a/btl/generic_bench/utils/utilities.h
+++ b/btl/generic_bench/utils/utilities.h
@@ -18,8 +18,8 @@
/* --- INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */
-# define HEREWEARE cout<<flush ; cerr << __FILE__ << " [" << __LINE__ << "] : " << flush ;
-# define INFOS(chain) {HEREWEARE ; cerr << chain << endl ;}
+# define HEREWEARE cout<<flush ; cout << __FILE__ << " [" << __LINE__ << "] : " << flush ;
+# define INFOS(chain) {HEREWEARE ; cout << chain << endl ;}
# define PYSCRIPT(chain) {cout<<flush ; cerr << "---PYSCRIPT--- " << chain << endl ;}
/* --- To print date and time of compilation of current source on stdout --- */
@@ -40,7 +40,7 @@
# error INFOS_COMPILATION already defined
# endif
# define INFOS_COMPILATION {\
- cerr << flush;\
+ cout << flush;\
cout << __FILE__ ;\
cout << " [" << __LINE__ << "] : " ;\
cout << "COMPILED with " << COMPILER ;\
diff --git a/numbench/utils/btl.py b/numbench/utils/btl.py
index c081ef4..6801299 100644
--- a/numbench/utils/btl.py
+++ b/numbench/utils/btl.py
@@ -20,7 +20,7 @@ from ..utils import benchutils as bu
from ..benchprint import Print
from os.path import join as pjoin, dirname
-import shlex, subprocess as sp
+import os, re, shlex, subprocess as sp
# BTL global flags
btlincludes = ('actions','generic_bench','generic_bench/utils','libs/STL')
@@ -186,9 +186,13 @@ def runTest(test, btlconfig):
logfs.write(3*'\n' + ' '.join(args) + 3*'\n')
logfs.flush()
+ # Error log
+ errfname = pjoin(btlconfig['logdir'], "btlRun.err")
+ errfs = file(errfname, 'w')
+
# Open pipe
try:
- proc = sp.Popen(args, bufsize=1, stdout=sp.PIPE, stderr=sp.PIPE, \
+ proc = sp.Popen(args, bufsize=1, stdout=sp.PIPE, stderr=errfs, \
env=runenv, cwd=btlconfig['testdir'])
benchchildren.append(proc)
except OSError:
@@ -202,14 +206,25 @@ def runTest(test, btlconfig):
# Interpret output
Print('Begin execution')
while True:
- # Each operation test begins with a line on stderr
- errline = proc.stderr.readline()
- if not errline:
- break
- logfs.write(errline)
+ # Use regexps to see which operation is benchmarked now
+ linere = \
+ r'.*/bench.hh \[[0-9]*?] : starting (bench_(.*)_[a-zA-Z0-9]*.dat)'
+ operation = None
+ while operation is None:
+ line = proc.stdout.readline()
+ if not line:
+ break
+
+ try:
+ resfile, operation = re.match(linere, line).groups()
+ logfs.write(line)
+ except:
+ pass
- resfile = errline.split()[-1]
- operation = resfile.split('_', 1)[-1].rsplit('_', 1)[0]
+ # Check is program is terminated
+ if operation is None:
+ break
+
result[operation] = pjoin(btlconfig['testdir'], resfile)
Print(operation + " -> " + resfile)
@@ -243,6 +258,14 @@ def runTest(test, btlconfig):
proc.wait()
Print("Execution finished with return code " + str(proc.returncode))
+ # Close logs
+ logfs.close()
+ errp = errfs.tell()
+ errfs.close()
+ if errp == 0:
+ os.unlink(errfname)
+
+
# Close, return
logfs.close()
return proc.returncode, result