-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
38 lines (31 loc) · 976 Bytes
/
main.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
"""Script to run the benchmarks."""
# pylint: disable=invalid-name
import sys
from benchmarks.benchmark import Benchmark
from benchmarks.efficient_su2 import run_efficientsu2
from benchmarks.featuremap import run_featuremap
from benchmarks.maxcut import run_maxcut
if len(sys.argv) < 2:
print('Please specify a benchmark to run. Available: efficientsu2 featuremap maxcut')
sys.exit()
task = sys.argv[1]
if task == 'plot':
if len(sys.argv) < 3:
print('To plot please specify the filename as second argument.')
sys.exit()
fname = sys.argv[2]
if len(sys.argv) > 3:
saveas = sys.argv[3]
else:
saveas = None
if task == 'efficientsu2':
run_efficientsu2()
elif task == 'featuremap':
run_featuremap()
elif task == 'maxcut':
run_maxcut()
elif task == 'plot':
benchmark = Benchmark([0], None, None)
benchmark.plot(fname, saveas=saveas, show=True)
else:
raise ValueError(f'Invalid argument: {task}')