-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.py
59 lines (50 loc) · 3.15 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""Launches the circuit benchmark script for user given arguments."""
import argparse
from benchmarks.scripts import circuit_benchmark
THREADING_LINK = "https://numba.pydata.org/numba-doc/latest/user/threading-layer.html#selecting-a-named-threading-layer"
parser = argparse.ArgumentParser()
parser.add_argument("--nqubits", default=20, type=int,
help="Number of qubits in the circuit.")
parser.add_argument("--backend", default="qibojit", type=str,
help="Qibo backend to use for simulation.")
parser.add_argument("--platform", default=None, type=str,
help="Qibo platform to use for simulation.")
parser.add_argument("--circuit", default="qft", type=str,
help="Type of circuit to use. See README for the list of "
"available circuits.")
parser.add_argument("--circuit-options", default=None, type=str,
help="String with options for circuit creation. "
"It should have the form 'arg1=value1,arg2=value2,...'. "
"See README for the list of arguments that are "
"available for each circuit.")
parser.add_argument("--nreps", default=1, type=int,
help="Number of repetitions of the circuit execution. "
"Dry run is not included.")
parser.add_argument("--nshots", default=None, type=int,
help="Number of measurement shots. If used the time "
"required to measure frequencies (no samples) is "
"measured and logged. If it is ``None`` no "
"measurements are performed.")
parser.add_argument("--transfer", action="store_true",
help="If used the final state array is converted to numpy. "
"If the simulation device is GPU this requires a "
"transfer from GPU memory to CPU.")
parser.add_argument("--precision", default="double", type=str,
help="Numerical precision of the simulation. "
"Choose between 'double' and 'single'.")
parser.add_argument("--memory", default=None, type=int,
help="Limit the GPU memory usage when using Tensorflow "
"based backends. The memory limit should be given "
"in MB. Tensorflow reserves the full available memory "
"by default.")
parser.add_argument("--threading", default=None, type=str,
help="Switches the numba threading layer when using the "
"qibojit backend on CPU. See {} for a list of "
"available threading layers.".format(THREADING_LINK))
parser.add_argument("--filename", default=None, type=str,
help="Directory of file to save the logs in json format. "
"If not given the logs will only be printed and not saved.")
if __name__ == "__main__":
args = vars(parser.parse_args())
args["circuit_name"] = args.pop("circuit")
circuit_benchmark(**args)