pytorch
45 строк · 1.3 Кб
1"""Basic runner for the instruction count microbenchmarks.
2
3The contents of this file are placeholders, and will be replaced by more
4expressive and robust components (e.g. better runner and result display
5components) in future iterations. However this allows us to excercise the
6underlying benchmark generation infrastructure in the mean time.
7"""
8import argparse9import sys10from typing import List11
12from applications import ci13from core.expand import materialize14from definitions.standard import BENCHMARKS15from execution.runner import Runner16from execution.work import WorkOrder17
18
19def main(argv: List[str]) -> None:20work_orders = tuple(21WorkOrder(label, autolabels, timer_args, timeout=600, retries=2)22for label, autolabels, timer_args in materialize(BENCHMARKS)23)24
25results = Runner(work_orders).run()26for work_order in work_orders:27print(28work_order.label,29work_order.autolabels,30work_order.timer_args.num_threads,31results[work_order].instructions,32)33
34
35if __name__ == "__main__":36modes = {37"debug": main,38"ci": ci.main,39}40
41parser = argparse.ArgumentParser()42parser.add_argument("--mode", type=str, choices=list(modes.keys()), default="debug")43
44args, remaining_args = parser.parse_known_args(sys.argv)45modes[args.mode](remaining_args[1:])46