-
Notifications
You must be signed in to change notification settings - Fork 28
/
run_benchmark.py
57 lines (53 loc) · 2.14 KB
/
run_benchmark.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
import argparse
from npbench.infrastructure import (Benchmark, generate_framework, LineCount,
Test, utilities as util)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-b",
"--benchmark",
type=str,
nargs="?",
required=True)
parser.add_argument("-f",
"--framework",
type=str,
nargs="?",
default="numpy")
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=200.0)
parser.add_argument("-s",
"--save-strict-sdfg",
type=util.str2bool,
nargs="?",
default=False)
parser.add_argument("-l",
"--load-strict-sdfg",
type=util.str2bool,
nargs="?",
default=False)
args = vars(parser.parse_args())
# print(args)
bench = Benchmark(args["benchmark"])
frmwrk = generate_framework(args["framework"],
save_strict=args["save_strict_sdfg"],
load_strict=args["load_strict_sdfg"])
numpy = generate_framework("numpy")
lcount = LineCount(bench, frmwrk, numpy)
lcount.count()
test = Test(bench, frmwrk, numpy)
test.run(args["preset"], args["validate"], args["repeat"], args["timeout"])