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 1QTg3C-0004cv-TJ for garchives@archives.gentoo.org; Mon, 06 Jun 2011 20:05:27 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0FC071C17F; Mon, 6 Jun 2011 20:05:19 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id C526D1C17F for ; Mon, 6 Jun 2011 20:05:19 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 22F641B4016 for ; Mon, 6 Jun 2011 20:05:19 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 10C628003C for ; Mon, 6 Jun 2011 20:05:18 +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: / X-VCS-Repository: proj/auto-numerical-bench X-VCS-Files: PortageUtils.py blas.py main.py X-VCS-Directories: / X-VCS-Committer: spiros X-VCS-Committer-Name: Andrea Arteaga X-VCS-Revision: e929ad6df4c9e9ce5656b5aa79b27e78ad13633d Date: Mon, 6 Jun 2011 20:05:18 +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: X-Archives-Hash: 22cdc6221e23b7afe9d15bf9d6c7555f commit: e929ad6df4c9e9ce5656b5aa79b27e78ad13633d Author: spiros gmail com> AuthorDate: Mon Jun 6 20:04:03 2011 +0000 Commit: Andrea Arteaga gmail com> CommitDate: Mon Jun 6 20:04:03 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/auto-numerica= l-bench.git;a=3Dcommit;h=3De929ad6d User input interface begin --- PortageUtils.py | 2 +- blas.py | 4 +- main.py | 87 +++++++++++++++++++++++++++++++++++++++----------= ------ 3 files changed, 65 insertions(+), 28 deletions(-) diff --git a/PortageUtils.py b/PortageUtils.py index 1cb1521..c27dc79 100644 --- a/PortageUtils.py +++ b/PortageUtils.py @@ -14,7 +14,7 @@ def available_packages(pattern): every matching pattern in the portage tree and installed overlays. """ return [portage.catpkgsplit(l) \ - for l in cmd.getoutput('equery -q list -p -e ' + pattern).split()] + for l in cmd.getoutput('equery -q list -po ' + pattern).split()] =20 =20 def install_package(package, env=3D{}, root=3D'/', pkgdir=3D'usr/portage= /packages'): diff --git a/blas.py b/blas.py index 88ebe90..2cf1ec8 100644 --- a/blas.py +++ b/blas.py @@ -23,8 +23,8 @@ class Module: 'syr2', 'ger', 'rot', 'matrix_matrix', 'aat', 'trisolve_vector', 'trisolve_matrix', 'trmm')] =20 - # Create dir. If alls results already exist use them, otherwise - # remove old results=20 + # Create dir. If all results already exist use them, otherwise + # remove old results runtests =3D False if os.path.exists(testdir): runtests =3D all([os.path.exists(i) for i in files]) diff --git a/main.py b/main.py index dcd0488..5f2f0d3 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,4 @@ -import os, sys +import os, sys, shlex import commands as cmd from PortageUtils import * =20 @@ -37,6 +37,22 @@ def print_usage(): print "Usage: benchmarks [blas|cblas|lapack]" =20 =20 +def tests_from_input(input): + tests =3D {} + for line in input.split('\n'): + line =3D line.strip() + spl =3D shlex.split(line) + if len(spl) < 2: + continue + package =3D available_packages(spl[1]) + env =3D {} + for var in spl[2:]: + s =3D var.split('=3D') + env[s[0]] =3D s[1] + tests[spl[0]] =3D {'package' : package , 'env' : env} + return tests + =20 + =20 # Import the desired module or print help and exit try: tmp =3D __import__(sys.argv[1], fromlist =3D ['Module']) @@ -61,27 +77,45 @@ used at compile-time as dictionary (it can just be a = void one). After the tests every successful tested item will contain the item "resu= lt", which can contain any type of data and will be used for the final report= . """ -tests =3D { - "abcde" : { - "package" : ('sci-libs', 'blas-reference', '3.3.1', 'r1'), - "env" : {'FC' : 'gfortran'} - }, - =20 - "fghij" : { - "package" : ('dev-cpp', 'eigen', '3.0.0', 'r1'), - "env" : {'CXX' : 'gcc', 'CXXFLAGS' : '-O2'} - }, - =20 +#tests =3D { +# "abcde" : { +# "package" : ('sci-libs', 'blas-reference', '3.3.1', 'r1'), +# "env" : {'FC' : 'gfortran'} +# }, +# =20 +# "fghij" : { +# "package" : ('dev-cpp', 'eigen', '3.0.0', 'r1'), +# "env" : {'CXX' : 'gcc', 'CXXFLAGS' : '-O2'} +# }, +# =20 # "klmno" : { # "package" : ('dev-cpp', 'eigen', '3.0.0', 'r1'), # "env" : {'CXX' : 'icc', 'CXXFLAGS' : '-O3'} # }, +# +# "pqrst" : { +# "package" : ('sci-libs', 'blas-reference', '3.3.1', 'r1'), +# "env" : {'FC' : 'ifort'} +# } +#} =20 - "pqrst" : { - "package" : ('sci-libs', 'blas-reference', '3.3.1', 'r1'), - "env" : {'FC' : 'ifort'} - } -} + +""" +The test variable is generated from a string which can be read from inpu= t. +Here is an example of the parsed input. +Every line contains a configuration and will be an entry 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 +""" +input =3D ''' +abcde blas-reference-3.3.1-r1 FC=3Dgfortran +fghij dev-cpp/eigen-3.0.0-r1 CXX=3Dgcc CXXFLAGS=3D'-O2' +klmno dev-cpp/eigen-3.0.0-r1 CXX=3Dicc CXXFLAGS=3D'-O3' +pqrst sci-libs/blas-reference-3.3.1-r1 FC=3Difort +''' +tests =3D tests_from_input(input) =20 for tn,(name,test) in enumerate(tests.items(),1): Print("BEGIN TEST %i" % tn) @@ -93,14 +127,17 @@ for tn,(name,test) in enumerate(tests.items(),1): Print.down() package =3D "%s/%s-%s-%s" % test['package'] Print("Emerging package %s" % package) - try: - install_package( \ - test['package'], env=3Dtest['env'], root=3Droot, pkgdir=3Dpkgd= ir) - except InstallException as e: - Print("Package %s failed to emerge: %s" % (package, e.command)) - Print.up() - print - continue + if os.exists(pkgdir+package+".tbz2"): + Print("Package already emerged - skipping") + else: + try: + install_package( \ + test['package'], env=3Dtest['env'], root=3Droot, pkgdir=3D= pkgdir) + except InstallException as e: + Print("Package %s failed to emerge: %s" % (package, e.comman= d)) + Print.up() + print + continue Print("Package emerged") =20 # Find implementations