def main(): SKPBench.print_header() # Delimiter is "," or " ", skip if nested inside parens (e.g. gpu(a=b,c=d)). DELIMITER = r'[, ](?!(?:[^(]*\([^)]*\))*[^()]*\))' configs = re.split(DELIMITER, FLAGS.config) skps = _path.find_skps(FLAGS.skps) benches = collections.deque([(skp, config, FLAGS.max_stddev) for skp in skps for config in configs]) while benches: benchargs = benches.popleft() skpbench = SKPBench(*benchargs) try: skpbench.execute() except StddevException: retry_max_stddev = skpbench.max_stddev * math.sqrt(2) if FLAGS.verbosity >= 1: print('NOTE: stddev too high for %s/%s (%s%%; max=%.2f%%). ' 'Re-queuing with max=%.2f%%.' % (skpbench.best_result.config, skpbench.best_result.bench, skpbench.best_result.stddev, skpbench.max_stddev, retry_max_stddev), file=sys.stderr) benches.append((skpbench.skp, skpbench.config, retry_max_stddev, skpbench.best_result))
def main(): # Delimiter is ',' or ' ', skip if nested inside parens (e.g. gpu(a=b,c=d)). DELIMITER = r'[, ](?!(?:[^(]*\([^)]*\))*[^()]*\))' configs = re.split(DELIMITER, FLAGS.config) skps = _path.find_skps(FLAGS.skps) if FLAGS.adb: adb = Adb(FLAGS.device_serial) model = adb.get_device_model() if model == 'Pixel C': from _hardware_pixel_c import HardwarePixelC hardware = HardwarePixelC(adb) else: from _hardware_android import HardwareAndroid print( "WARNING: %s: don't know how to monitor this hardware; results " "may be unreliable." % model, file=sys.stderr) hardware = HardwareAndroid(adb) else: hardware = Hardware() with hardware: if hardware.kick_in_time: print( "sleeping %i seconds to allow hardware settings to kick in..." % hardware.kick_in_time, file=sys.stderr) time.sleep(hardware.kick_in_time) run_benchmarks(configs, skps, hardware)
def main(): # Delimiter is ',' or ' ', skip if nested inside parens (e.g. gpu(a=b,c=d)). DELIMITER = r'[, ](?!(?:[^(]*\([^)]*\))*[^()]*\))' configs = re.split(DELIMITER, FLAGS.config) skps = _path.find_skps(FLAGS.skps) if FLAGS.adb: adb = Adb(FLAGS.device_serial) model = adb.get_device_model() if model == 'Pixel C': from _hardware_pixel_c import HardwarePixelC hardware = HardwarePixelC(adb) elif model == 'Nexus 6P': from _hardware_nexus_6p import HardwareNexus6P hardware = HardwareNexus6P(adb) else: from _hardware_android import HardwareAndroid print("WARNING: %s: don't know how to monitor this hardware; results " "may be unreliable." % model, file=sys.stderr) hardware = HardwareAndroid(adb) else: hardware = Hardware() with hardware: SKPBench.run_warmup(hardware.warmup_time) run_benchmarks(configs, skps, hardware)
def main(): # Delimiter is ',' or ' ', skip if nested inside parens (e.g. gpu(a=b,c=d)). DELIMITER = r'[, ](?!(?:[^(]*\([^)]*\))*[^()]*\))' configs = re.split(DELIMITER, FLAGS.config) skps = _path.find_skps(FLAGS.skps) if FLAGS.adb: adb = Adb(FLAGS.device_serial, FLAGS.adb_binary, echo=(FLAGS.verbosity >= 5)) model = adb.check('getprop ro.product.model').strip() if model == 'Pixel C': from _hardware_pixel_c import HardwarePixelC hardware = HardwarePixelC(adb) elif model == 'Pixel': from _hardware_pixel import HardwarePixel hardware = HardwarePixel(adb) elif model == 'Pixel 2': from _hardware_pixel2 import HardwarePixel2 hardware = HardwarePixel2(adb) elif model == 'Nexus 6P': from _hardware_nexus_6p import HardwareNexus6P hardware = HardwareNexus6P(adb) else: from _hardware_android import HardwareAndroid print("WARNING: %s: don't know how to monitor this hardware; results " "may be unreliable." % model, file=sys.stderr) hardware = HardwareAndroid(adb) else: hardware = Hardware() if FLAGS.resultsfile: with open(FLAGS.resultsfile, mode='a+') as resultsfile: run_benchmarks(configs, skps, hardware, resultsfile=resultsfile) else: run_benchmarks(configs, skps, hardware)
def main(): # Delimiter is ',' or ' ', skip if nested inside parens (e.g. gpu(a=b,c=d)). DELIMITER = r'[, ](?!(?:[^(]*\([^)]*\))*[^()]*\))' configs = re.split(DELIMITER, FLAGS.config) skps = _path.find_skps(FLAGS.skps) if FLAGS.adb: adb = Adb(FLAGS.device_serial, echo=(FLAGS.verbosity >= 5)) model = adb.check('getprop ro.product.model').strip() if model == 'Pixel C': from _hardware_pixel_c import HardwarePixelC hardware = HardwarePixelC(adb) elif model == 'Nexus 6P': from _hardware_nexus_6p import HardwareNexus6P hardware = HardwareNexus6P(adb) else: from _hardware_android import HardwareAndroid print( "WARNING: %s: don't know how to monitor this hardware; results " "may be unreliable." % model, file=sys.stderr) hardware = HardwareAndroid(adb) else: hardware = Hardware() with hardware: SKPBench.run_warmup(hardware.warmup_time, configs[0]) if FLAGS.resultsfile: with open(FLAGS.resultsfile, mode='a+') as resultsfile: run_benchmarks(configs, skps, hardware, resultsfile=resultsfile) else: run_benchmarks(configs, skps, hardware)
def main(): # Delimiter is ',' or ' ', skip if nested inside parens (e.g. gpu(a=b,c=d)). DELIMITER = r'[, ](?!(?:[^(]*\([^)]*\))*[^()]*\))' configs = re.split(DELIMITER, FLAGS.config) skps = _path.find_skps(FLAGS.skps) if FLAGS.adb: adb = Adb(FLAGS.device_serial) model = adb.get_device_model() if model == 'Pixel C': from _hardware_pixel_c import HardwarePixelC hardware = HardwarePixelC(adb) elif model == 'Nexus 6P': from _hardware_nexus_6p import HardwareNexus6P hardware = HardwareNexus6P(adb) else: from _hardware_android import HardwareAndroid print( "WARNING: %s: don't know how to monitor this hardware; results " "may be unreliable." % model, file=sys.stderr) hardware = HardwareAndroid(adb) else: hardware = Hardware() with hardware: SKPBench.run_warmup(hardware.warmup_time) run_benchmarks(configs, skps, hardware)
def main(): # Delimiter is ',' or ' ', skip if nested inside parens (e.g. gpu(a=b,c=d)). DELIMITER = r'[, ](?!(?:[^(]*\([^)]*\))*[^()]*\))' configs = re.split(DELIMITER, FLAGS.config) srcs = _path.find_skps(FLAGS.srcs) assert srcs if FLAGS.adb: adb = Adb(FLAGS.device_serial, FLAGS.adb_binary, echo=(FLAGS.verbosity >= 5)) from _hardware_android import HardwareAndroid model = adb.check('getprop ro.product.model').strip() if model == 'Pixel C': from _hardware_pixel_c import HardwarePixelC hardware = HardwarePixelC(adb) elif model == 'Pixel' or model == "Pixel XL": from _hardware_pixel import HardwarePixel hardware = HardwarePixel(adb) elif model == 'Pixel 2': from _hardware_pixel2 import HardwarePixel2 hardware = HardwarePixel2(adb) elif model == 'Nexus 6P': from _hardware_nexus_6p import HardwareNexus6P hardware = HardwareNexus6P(adb) else: print( "WARNING: %s: don't know how to monitor this hardware; results " "may be unreliable." % model, file=sys.stderr) hardware = HardwareAndroid(adb) if FLAGS.lock_clocks: hardware.__enter__() print( "Entered benchmarking mode, not running benchmarks. Reboot to restore." ) return if FLAGS.clock_speed: hardware.setDesiredClock(FLAGS.clock_speed) else: hardware = Hardware() if FLAGS.resultsfile: with open(FLAGS.resultsfile, mode='a+') as resultsfile: run_benchmarks(configs, srcs, hardware, resultsfile=resultsfile) else: run_benchmarks(configs, srcs, hardware)
def main(): # Delimiter is ',' or ' ', skip if nested inside parens (e.g. gpu(a=b,c=d)). DELIMITER = r'[, ](?!(?:[^(]*\([^)]*\))*[^()]*\))' configs = re.split(DELIMITER, FLAGS.config) srcs = _path.find_skps(FLAGS.srcs) assert srcs if FLAGS.adb: adb = Adb(FLAGS.device_serial, FLAGS.adb_binary, echo=(FLAGS.verbosity >= 5)) model = adb.check('getprop ro.product.model').strip() if model == 'Pixel C': from _hardware_pixel_c import HardwarePixelC hardware = HardwarePixelC(adb) elif model == 'Pixel': from _hardware_pixel import HardwarePixel hardware = HardwarePixel(adb) elif model == 'Pixel 2': from _hardware_pixel2 import HardwarePixel2 hardware = HardwarePixel2(adb) elif model == 'Nexus 6P': from _hardware_nexus_6p import HardwareNexus6P hardware = HardwareNexus6P(adb) elif FLAGS.force: from _hardware_android import HardwareAndroid print( "WARNING: %s: don't know how to monitor this hardware; results " "may be unreliable." % model, file=sys.stderr) hardware = HardwareAndroid(adb) else: raise Exception("%s: don't know how to monitor this hardware. " "Use --force to bypass this warning." % model) else: hardware = Hardware() if FLAGS.resultsfile: with open(FLAGS.resultsfile, mode='a+') as resultsfile: run_benchmarks(configs, srcs, hardware, resultsfile=resultsfile) else: run_benchmarks(configs, srcs, hardware)