1########################################################################## 2# Copyright (c) 2009, 2010, 2011, ETH Zurich. 3# All rights reserved. 4# 5# This file is distributed under the terms in the attached LICENSE file. 6# If you do not find this file, copies can be found by writing to: 7# ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group. 8########################################################################## 9 10import re 11import debug, tests, datetime 12from common import TestCommon, TimeoutError 13from results import RowResults 14 15# timeout for a complete run, including setup etc. 16RCCE_TIMEOUT = datetime.timedelta(hours=1) 17 18@tests.add_test 19class RCCELUTest(TestCommon): 20 '''RCCE LU Benchmark''' 21 name = "rcce_lu" 22 23 def get_finish_string(self): 24 return " Please send the results of this run to:" 25 26 def get_build_targets(self, build, machine): 27 targets = super(RCCELUTest, self).get_build_targets(build, machine) 28 for i in self.mkrange(machine): 29 targets.append("%s/sbin/rcce_lu_A%d" % (machine.get_bootarch(), i)) 30 return targets 31 32 def mkrange(self, machine): 33 # XXX: Don't run on more than 16 cores -- it's awfully slow 34 ncores = min(machine.get_ncores(), 16) 35 return [2**x for x in range(0,ncores + 1) if 2 ** x <= ncores] 36 37 def run(self, build, machine, testdir): 38 ncores = machine.get_ncores() 39 for i in self.mkrange(machine): 40 debug.log('running %s power %d/%d' % (self.name, i, ncores)) 41 modules = self.get_modules(build, machine) 42 modules.add_module("rcce_lu_A%d" % i, [i, 1] + range(0, i)) 43 self.boot(machine, modules) 44 self.set_timeout(RCCE_TIMEOUT) 45 for line in self.collect_data(machine): 46 yield line 47 48 def process_data(self, testdir, raw_iter): 49 res = RowResults(["cores", "compute_time"]) 50 computetime = {} 51 ct = 0 52 53 for line in raw_iter: 54 m = re.match(r" Time in seconds =\s+(\d+.\d+)", line) 55 if m: 56 ct = float(m.group(1)); 57 continue 58 m = re.match(r" Total processes =\s+(\d+)", line) 59 if m: 60 computetime[int(m.group(1))] = ct 61 62 allcores = computetime.keys() 63 allcores.sort() 64 nan = float('nan') 65 for c in allcores: 66 res.add_row([c, computetime.get(c, nan)]) 67 68 return res 69