public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/auto-numerical-bench:master commit in: btl/generic_bench/utils/, numbench/utils/
@ 2012-08-04  1:11 Andrea Arteaga
  0 siblings, 0 replies; 2+ messages in thread
From: Andrea Arteaga @ 2012-08-04  1:11 UTC (permalink / raw
  To: gentoo-commits

commit:     9625486543cff4fee2dde786bb68b3ba166e95dc
Author:     Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
AuthorDate: Sat Aug  4 01:01:37 2012 +0000
Commit:     Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
CommitDate: Sat Aug  4 01:01:37 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/auto-numerical-bench.git;a=commit;h=96254865

Changed BTL init operation output from stderr to stdout. Log stderr of
BTL to a different file.

---
 btl/generic_bench/utils/utilities.h |    6 ++--
 numbench/utils/btl.py               |   41 +++++++++++++++++++++++++++-------
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/auto-numerical-bench:master commit in: btl/generic_bench/utils/, numbench/utils/
@ 2012-08-04  1:11 Andrea Arteaga
  0 siblings, 0 replies; 2+ messages in thread
From: Andrea Arteaga @ 2012-08-04  1:11 UTC (permalink / raw
  To: gentoo-commits

commit:     e5e9d7288dde1532af106407fea63273c4c20891
Author:     Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
AuthorDate: Sat Aug  4 01:01:37 2012 +0000
Commit:     Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
CommitDate: Sat Aug  4 01:04:00 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/auto-numerical-bench.git;a=commit;h=e5e9d728

Changed BTL init operation output from stderr to stdout. Log stderr of
BTL to a different file.

---
 btl/generic_bench/utils/utilities.h |    6 ++--
 numbench/utils/btl.py               |   41 +++++++++++++++++++++++++++-------
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-04  1:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-04  1:11 [gentoo-commits] proj/auto-numerical-bench:master commit in: btl/generic_bench/utils/, numbench/utils/ Andrea Arteaga
  -- strict thread matches above, loose matches on Subject: below --
2012-08-04  1:11 Andrea Arteaga

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox