From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RfKfR-0002cI-7N for garchives@archives.gentoo.org; Tue, 27 Dec 2011 00:13:21 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 258AE21C022; Tue, 27 Dec 2011 00:13:12 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id D79B021C022 for ; Tue, 27 Dec 2011 00:13:11 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2DCA51B4012 for ; Tue, 27 Dec 2011 00:13:11 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 6B97C80043 for ; Tue, 27 Dec 2011 00:13:10 +0000 (UTC) From: "Andrea Arteaga" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Andrea Arteaga" Message-ID: Subject: [gentoo-commits] proj/auto-numerical-bench:master commit in: numbench/ X-VCS-Repository: proj/auto-numerical-bench X-VCS-Files: numbench/benchload.py numbench/main.py X-VCS-Directories: numbench/ X-VCS-Committer: spiros X-VCS-Committer-Name: Andrea Arteaga X-VCS-Revision: f4aec545e93de31072f883125276a405ce4e4514 Date: Tue, 27 Dec 2011 00:13:10 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 716d77ba-1708-4b8c-a8b9-730fb469c9d0 X-Archives-Hash: 414d3b5374982844c224c76dc5cc72e1 commit: f4aec545e93de31072f883125276a405ce4e4514 Author: spiros spib (none)> AuthorDate: Tue Dec 27 00:13:00 2011 +0000 Commit: Andrea Arteaga gmail com> CommitDate: Tue Dec 27 00:13:00 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/auto-numerica= l-bench.git;a=3Dcommit;h=3Df4aec545 Removed buggy load printer thread. --- numbench/benchload.py | 61 -------------------------------------------= --- numbench/main.py | 65 +++++++++++++++++++++++--------------------= ----- 2 files changed, 31 insertions(+), 95 deletions(-) diff --git a/numbench/benchload.py b/numbench/benchload.py deleted file mode 100644 index 8363862..0000000 --- a/numbench/benchload.py +++ /dev/null @@ -1,61 +0,0 @@ -#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D -# Copyright (C) 2011 Andrea Arteaga -#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,= USA. -# -import sys, shlex, threading, time, subprocess as sp - -class PrintLoad(threading.Thread): - =20 - _active =3D False - _continue =3D True - =20 - def run(self): - while self._continue: - if self._active: - out =3D sp.check_output('uptime') - printstr =3D ' '.join(shlex.split(out)[-5:]) - sys.stdout.flush() - sys.stdout.write(printstr + '\r') - sys.stdout.flush() - time.sleep(.5) - =20 - def setActive(self, active=3DTrue): - self._active =3D active - =20 - def stop(self): - self._continue =3D False - - - -def start(): - printLoadThread.setActive(True) - -def stop(): - printLoadThread.setActive(False) - =20 -def close(): - printLoadThread.stop() - =20 -try: - needsinitialization =3D not initialized -except: - needsinitialization =3D True - -if needsinitialization: - printLoadThread =3D PrintLoad() - printLoadThread.start() - =20 -initialized =3D True \ No newline at end of file diff --git a/numbench/main.py b/numbench/main.py index e0f5857..105a699 100755 --- a/numbench/main.py +++ b/numbench/main.py @@ -33,7 +33,7 @@ def close(*args): Print("Exiting") exit(0) signal.signal(signal.SIGINT, close) - =20 + =20 def print_usage(): print "Usage: numbench [blas|cblas|lapack|scalapack|fftw|metis|" + \ @@ -60,7 +60,7 @@ def print_help(): print print "More information about a module is available through the comm= and:" print " numbench module --help" - =20 + def readEnvFile(fname): """Reads a bash file with void environment and returns the environme= nt at the end of the execution.""" @@ -68,13 +68,13 @@ def readEnvFile(fname): shell=3DTrue, stdout=3Dsp.PIPE, env=3D{}) lines =3D proc.stdout.read().split('\n')[:-1] env =3D dict([l.split('=3D', 1) for l in lines]) - =20 + for k in ('SHLVL', 'PWD', '_'): if env.has_key(k): del env[k] return env - =20 - =20 + + def tests_from_input(input): tests =3D {} for line in input.split('\n'): @@ -89,37 +89,37 @@ def tests_from_input(input): change =3D {} descr =3D None fileenv =3D {} - =20 + # Interpret arguments for var in spl[2:]: - =20 + # if begins with '-': skip implementation if var[0] =3D=3D '-': skip.append(var[1:]) - =20 + # if key:value, substitute pkg-config dependency elif ':' in var and not '=3D' in var: c_0, c_1 =3D var.split(':', 1) change[c_0] =3D c_1 - =20 + # if descr|text set description (for future use) elif var[:6] =3D=3D 'descr|': descr =3D var[6:] - =20 + # if @file: read bash script and set env elif var[0] =3D=3D '@': fileenvNew =3D readEnvFile(pjoin(cfg.curdir, var[1:])) fileenv =3D dict( fileenv.items() + fileenvNew.items() ) del fileenvNew - =20 + # Otherwise, assume key=3Dvalue syntax else: e_0, e_1 =3D var.split('=3D', 1) env[e_0] =3D e_1 - =20 + # Set environment (argument overrides bash file) env =3D dict( fileenv.items() + env.items() ) - =20 + try: # Insert test avail =3D available_packages(spl[1])[-1] @@ -153,18 +153,18 @@ try: if (sys.argv[1] in ('-h', '--help')): print_help() exit(0); - =20 + cfg.modulename =3D sys.argv[1] - =20 + # Print module help if (sys.argv[2] in ('-h', '--help')): cfg.inputfile =3D '' tmp =3D __import__('numbench.'+cfg.modulename, fromlist =3D ['Mo= dule']) tmp.Module.printHelp() exit(0) - =20 + # Normal run: import module - =20 + # Catch command-line arguments passargs =3D [] purge =3D False @@ -173,7 +173,7 @@ try: purge =3D True else: passargs.append(v) - =20 + cfg.inputfile =3D os.path.abspath(sys.argv[2]) os.chdir(cfg.scriptdir) tmp =3D __import__('numbench.'+cfg.modulename, fromlist =3D ['Module= ']) @@ -182,7 +182,7 @@ try: if purge: cfg.purgedirs() cfg.makedirs() - =20 + except ImportError as e: print e print_usage() @@ -190,10 +190,9 @@ except ImportError as e: except IndexError: print_usage() exit(1) - =20 + from PortageUtils import * from benchprint import Print -import benchload as load =20 =20 =20 @@ -220,7 +219,7 @@ Every line contains a configuration and will be an en= try in the tests dictionary; the line has to contain: - an identification string - a package description, which can, but does not must to, contain a vers= ion -- a list of environment variables separated by means of spaces=20 +- a list of environment variables separated by means of spaces """ if not os.path.exists(cfg.inputfile): sys.stderr.write("File not found: " + cfg.inputfile) @@ -263,12 +262,12 @@ Print() for tn,(name,test) in enumerate(cfg.tests.items(),1): Print._level =3D 0 Print("BEGIN TEST %i - %s" % (tn, name)) - =20 + pkgdir =3D pjoin(cfg.pkgsdir, name) root =3D pjoin(cfg.rootsdir, name) tlogdir =3D pjoin(cfg.logdir, name) os.path.exists(tlogdir) or os.makedirs(tlogdir) - =20 + # Emerge package Print.down() package =3D normalize_cpv(test['package']) @@ -285,7 +284,7 @@ for tn,(name,test) in enumerate(cfg.tests.items(),1): install_dependencies( \ test['package'], root=3Droot, pkgdir=3Dpkgdir, \ logdir=3Dtlogdir) - =20 + # Emerge pacakge Print("Emerging package %s" % package) logfile =3D pjoin(tlogdir, 'emerge.log') @@ -296,7 +295,7 @@ for tn,(name,test) in enumerate(cfg.tests.items(),1): logfile=3Dlogfile ) test['emergesuccess'] =3D True - =20 + except InstallException as e: test['emergesuccess'] =3D False Print("Package %s failed to emerge" % package) @@ -305,11 +304,11 @@ for tn,(name,test) in enumerate(cfg.tests.items(),1= ): print continue Print("Package emerged") - =20 + # Find implementations impls =3D [i for i in mod.get_impls(root) if not i in test['skip']] test['implementations'] =3D impls - =20 + # Test every implementation test['results'] =3D {} if len(impls) =3D=3D 0: @@ -317,20 +316,18 @@ for tn,(name,test) in enumerate(cfg.tests.items(),1= ): for impl in impls: Print("Testing " + impl) Print.down() - =20 + # Run the test suite testdir =3D os.path.join(cfg.testsdir, name, impl) t =3D mod.getTest(root, impl, testdir, logdir=3Dtlogdir) test['results'][impl] =3D t.run_test(test['changes']) Print.up() - =20 + Print.up() print - =20 =20 -load.close() =20 -# Save the results (first re-order them) =20 +# Save the results (first re-order them) results =3D {} for (name,test) in cfg.tests.items(): if test.has_key('implementations'): @@ -360,6 +357,6 @@ for name,test in cfg.tests.items(): Print.up() except: pass - =20 + Print.up() Print()