1########################################################################## 2# Copyright (c) 2009, 2010, 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 12from common import TestCommon, TimeoutError 13from results import RawResults 14 15class BulkTestCommon(TestCommon): 16 use_memcpy = None 17 18 def get_module_name(self): 19 return "bulkbench" 20 21 def get_build_targets(self, build, machine): 22 targets = super(BulkTestCommon, self).get_build_targets(build, machine) 23 targets.append('%s/sbin/%s' % 24 (machine.get_bootarch(), self.get_module_name())) 25 return targets 26 27 def run(self, build, machine, testdir): 28 if machine.get_ncores() == machine.get_cores_per_socket(): 29 # single-socket machine, pick first and last core 30 sendcore = machine.get_coreids()[0] 31 recvcore = machine.get_coreids()[-1] 32 else: 33 # compute two core IDs on different sockets to benchmark between 34 sendcore = machine.get_coreids()[0] 35 # first core on 2nd socket 36 recvcore = machine.get_coreids()[machine.get_cores_per_socket()] 37 38 # Iterate over all bulk block sizes 39 for i in [2048]: 40 debug.log('running %s block size %d' % (self.name, i)) 41 modules = self.get_modules(build, machine) 42 modules.add_module(self.get_module_name(), 43 ["core=%d" % sendcore, i, "send", self.use_memcpy]) 44 modules.add_module(self.get_module_name(), 45 ["core=%d" % recvcore, i, "recv", self.use_memcpy]) 46 self.boot(machine, modules) 47 for line in self.collect_data(machine): 48 yield line 49 50 def process_data(self, testdir, rawiter): 51 results = RawResults('buffersize') 52 data = [] 53 for line in rawiter: 54 m = re.match("rawresult (\d+)", line) 55 if m: 56 data.append(2048 / int(m.group(1))) 57 58 results.add_group("2048", data) 59 return results 60 61@tests.add_test 62class BulkThroughputTest(BulkTestCommon): 63 ''' Bulk transport throughput microbenchmark ''' 64 name = "bulk" 65 use_memcpy = "nomemcpy" 66 67@tests.add_test 68class BulkMemThroughputTest(BulkTestCommon): 69 ''' Bulk transport throughput microbenchmark with memcpy on receiver ''' 70 name = "bulk_memcpy" 71 use_memcpy = "memcpy" 72