-
Notifications
You must be signed in to change notification settings - Fork 28
/
quickstart.py
68 lines (60 loc) · 2.5 KB
/
quickstart.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import argparse
from multiprocessing import Process
from npbench.infrastructure import (Benchmark, generate_framework, LineCount,
Test, utilities as util)
def run_benchmark(benchname, fname, preset, validate, repeat, timeout):
frmwrk = generate_framework(fname)
numpy = generate_framework("numpy")
bench = Benchmark(benchname)
lcount = LineCount(bench, frmwrk, numpy)
lcount.count()
test = Test(bench, frmwrk, numpy)
test.run(preset, validate, repeat, timeout)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-p",
"--preset",
choices=['S', 'M', 'L', 'paper'],
nargs="?",
default='S')
parser.add_argument("-m", "--mode", type=str, nargs="?", default="main")
parser.add_argument("-v",
"--validate",
type=util.str2bool,
nargs="?",
default=True)
parser.add_argument("-r", "--repeat", type=int, nargs="?", default=10)
parser.add_argument("-t", "--timeout", type=float, nargs="?", default=10.0)
parser.add_argument("-d", "--dace", type=util.str2bool, nargs="?", default=True)
args = vars(parser.parse_args())
benchmarks = [
'adi', 'arc_distance', 'atax', 'azimint_naive', 'bicg', 'cavity_flow',
'cholesky2', 'compute', 'doitgen', 'floyd_warshall', 'gemm', 'gemver',
'gesummv', 'go_fast', 'hdiff', 'jacobi_2d', 'lenet', 'syr2k', 'trmm',
'vadv'
]
frameworks = ["numpy", "numba"]
if args['dace']:
frameworks.append("dace_cpu")
for benchname in benchmarks:
for fname in frameworks:
p = Process(
target=run_benchmark,
args=(benchname, fname, args["preset"],
args["validate"], args["repeat"], args["timeout"])
)
p.start()
p.join()
# numpy = generate_framework("numpy")
# numba = generate_framework("numba")
# for benchname in benchmarks:
# bench = Benchmark(benchname)
# for frmwrk in [numpy, numba]:
# lcount = LineCount(bench, frmwrk, numpy)
# lcount.count()
# test = Test(bench, frmwrk, numpy)
# try:
# test.run(args["preset"], args["validate"], args["repeat"],
# args["timeout"])
# except:
# continue