iqm-benchmarks 1.11__py3-none-any.whl → 2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of iqm-benchmarks might be problematic. Click here for more details.
- iqm/benchmarks/__init__.py +1 -0
- iqm/benchmarks/benchmark_definition.py +15 -12
- iqm/benchmarks/benchmark_experiment.py +4 -4
- iqm/benchmarks/circuit_containers.py +221 -0
- iqm/benchmarks/compressive_gst/compressive_gst.py +11 -4
- iqm/benchmarks/entanglement/ghz.py +101 -89
- iqm/benchmarks/optimization/qscore.py +11 -8
- iqm/benchmarks/quantum_volume/clops.py +13 -32
- iqm/benchmarks/quantum_volume/quantum_volume.py +18 -19
- iqm/benchmarks/randomized_benchmarking/clifford_rb/clifford_rb.py +23 -14
- iqm/benchmarks/randomized_benchmarking/interleaved_rb/interleaved_rb.py +48 -30
- iqm/benchmarks/randomized_benchmarking/mirror_rb/mirror_rb.py +14 -31
- iqm/benchmarks/randomized_benchmarking/randomized_benchmarking_common.py +4 -3
- iqm/benchmarks/readout_mitigation.py +2 -1
- iqm/benchmarks/utils.py +2 -1
- {iqm_benchmarks-1.11.dist-info → iqm_benchmarks-2.0.dist-info}/METADATA +1 -1
- {iqm_benchmarks-1.11.dist-info → iqm_benchmarks-2.0.dist-info}/RECORD +21 -20
- mGST/qiskit_interface.py +1 -1
- {iqm_benchmarks-1.11.dist-info → iqm_benchmarks-2.0.dist-info}/LICENSE +0 -0
- {iqm_benchmarks-1.11.dist-info → iqm_benchmarks-2.0.dist-info}/WHEEL +0 -0
- {iqm_benchmarks-1.11.dist-info → iqm_benchmarks-2.0.dist-info}/top_level.txt +0 -0
iqm/benchmarks/__init__.py
CHANGED
|
@@ -25,6 +25,7 @@ from .benchmark_definition import (
|
|
|
25
25
|
BenchmarkObservationIdentifier,
|
|
26
26
|
BenchmarkRunResult,
|
|
27
27
|
)
|
|
28
|
+
from .circuit_containers import BenchmarkCircuit, CircuitGroup, Circuits
|
|
28
29
|
from .entanglement.ghz import GHZBenchmark, GHZConfiguration
|
|
29
30
|
from .quantum_volume.clops import CLOPSBenchmark, CLOPSConfiguration
|
|
30
31
|
from .quantum_volume.quantum_volume import QuantumVolumeBenchmark, QuantumVolumeConfiguration
|
|
@@ -21,7 +21,7 @@ import copy
|
|
|
21
21
|
from copy import deepcopy
|
|
22
22
|
from dataclasses import dataclass, field
|
|
23
23
|
import functools
|
|
24
|
-
from typing import Any, Dict, List, Optional, Union
|
|
24
|
+
from typing import Any, Callable, Dict, List, Optional, Union
|
|
25
25
|
import uuid
|
|
26
26
|
|
|
27
27
|
from matplotlib.figure import Figure
|
|
@@ -29,6 +29,7 @@ import matplotlib.pyplot as plt
|
|
|
29
29
|
import xarray as xr
|
|
30
30
|
|
|
31
31
|
from iqm.benchmarks.benchmark import BenchmarkConfigurationBase
|
|
32
|
+
from iqm.benchmarks.circuit_containers import BenchmarkCircuit, Circuits
|
|
32
33
|
from iqm.benchmarks.utils import get_iqm_backend, timeit
|
|
33
34
|
from iqm.qiskit_iqm.iqm_backend import IQMBackendBase
|
|
34
35
|
from iqm.qiskit_iqm.iqm_provider import IQMBackend, IQMFacadeBackend
|
|
@@ -81,6 +82,7 @@ class BenchmarkRunResult:
|
|
|
81
82
|
"""
|
|
82
83
|
|
|
83
84
|
dataset: xr.Dataset
|
|
85
|
+
circuits: Circuits
|
|
84
86
|
|
|
85
87
|
|
|
86
88
|
@dataclass
|
|
@@ -94,6 +96,7 @@ class BenchmarkAnalysisResult:
|
|
|
94
96
|
"""
|
|
95
97
|
|
|
96
98
|
dataset: xr.Dataset
|
|
99
|
+
circuits: Optional[Circuits] = field(default=None)
|
|
97
100
|
plots: dict[str, Figure] = field(default_factory=lambda: ({}))
|
|
98
101
|
observations: list[BenchmarkObservation] = field(default_factory=lambda: [])
|
|
99
102
|
|
|
@@ -122,14 +125,14 @@ class BenchmarkAnalysisResult:
|
|
|
122
125
|
Args:
|
|
123
126
|
run: A run for which analysis result is created.
|
|
124
127
|
"""
|
|
125
|
-
return cls(dataset=run.dataset)
|
|
128
|
+
return cls(dataset=run.dataset, circuits=Circuits)
|
|
126
129
|
|
|
127
130
|
|
|
128
|
-
def default_analysis_function(result:
|
|
131
|
+
def default_analysis_function(result: BenchmarkRunResult) -> BenchmarkAnalysisResult:
|
|
129
132
|
"""
|
|
130
133
|
The default analysis that only pass the result through.
|
|
131
134
|
"""
|
|
132
|
-
return result
|
|
135
|
+
return BenchmarkAnalysisResult.from_run_result(result)
|
|
133
136
|
|
|
134
137
|
|
|
135
138
|
def merge_datasets_dac(datasets: List[xr.Dataset]) -> xr.Dataset:
|
|
@@ -208,18 +211,19 @@ class Benchmark(ABC):
|
|
|
208
211
|
accept ``AnalysisResult`` as its input and return the final result.
|
|
209
212
|
"""
|
|
210
213
|
|
|
211
|
-
analysis_function = staticmethod(default_analysis_function)
|
|
214
|
+
analysis_function: Callable[[BenchmarkRunResult], BenchmarkAnalysisResult] = staticmethod(default_analysis_function)
|
|
212
215
|
default_options: dict[str, Any] | None = None
|
|
213
216
|
options: dict[str, Any] | None = None
|
|
214
|
-
# name: str = "unnamed_benchmark"
|
|
215
217
|
|
|
216
|
-
def __init__(self, backend: Union[str, IQMBackendBase], configuration:
|
|
218
|
+
def __init__(self, backend: Union[str, IQMBackendBase], configuration: BenchmarkConfigurationBase, **kwargs):
|
|
217
219
|
|
|
218
220
|
# Ported from BenchmarkBase # CHECK
|
|
219
221
|
self.configuration = configuration
|
|
220
222
|
self.serializable_configuration = deepcopy(self.configuration)
|
|
221
223
|
self.serializable_configuration.benchmark = self.name
|
|
222
224
|
|
|
225
|
+
self.circuits = Circuits()
|
|
226
|
+
|
|
223
227
|
if isinstance(backend, str):
|
|
224
228
|
self.backend = get_iqm_backend(backend)
|
|
225
229
|
else:
|
|
@@ -233,8 +237,8 @@ class Benchmark(ABC):
|
|
|
233
237
|
self.routing_method = self.configuration.routing_method
|
|
234
238
|
self.physical_layout = self.configuration.physical_layout
|
|
235
239
|
|
|
236
|
-
self.
|
|
237
|
-
self.
|
|
240
|
+
self.transpiled_circuits: BenchmarkCircuit
|
|
241
|
+
self.untranspiled_circuits: BenchmarkCircuit
|
|
238
242
|
|
|
239
243
|
# From exa_support MR
|
|
240
244
|
self.options = copy.copy(self.default_options) if self.default_options else {}
|
|
@@ -278,7 +282,7 @@ class Benchmark(ABC):
|
|
|
278
282
|
self.backend.run, calibration_set_id=calibration_set_id
|
|
279
283
|
) # type: ignore
|
|
280
284
|
dataset = self.execute(backend_for_execute)
|
|
281
|
-
run = BenchmarkRunResult(dataset)
|
|
285
|
+
run = BenchmarkRunResult(dataset, self.circuits)
|
|
282
286
|
self.runs.append(run)
|
|
283
287
|
return run
|
|
284
288
|
|
|
@@ -299,6 +303,5 @@ class Benchmark(ABC):
|
|
|
299
303
|
the ``analysis_function`` field.
|
|
300
304
|
"""
|
|
301
305
|
run = self.runs[run_index]
|
|
302
|
-
|
|
303
|
-
updated_result = self.analysis_function(result)
|
|
306
|
+
updated_result = self.analysis_function(run)
|
|
304
307
|
return updated_result
|
|
@@ -24,6 +24,7 @@ from time import strftime
|
|
|
24
24
|
from typing import List, Optional, OrderedDict, Union
|
|
25
25
|
|
|
26
26
|
from iqm.benchmarks.benchmark import BenchmarkBase, BenchmarkConfigurationBase
|
|
27
|
+
from iqm.benchmarks.logging_config import qcvv_logger
|
|
27
28
|
from iqm.benchmarks.utils import get_iqm_backend
|
|
28
29
|
from iqm.qiskit_iqm.iqm_backend import IQMBackendBase
|
|
29
30
|
|
|
@@ -52,15 +53,14 @@ class BenchmarkExperiment:
|
|
|
52
53
|
"""
|
|
53
54
|
self.timestamp = strftime("%Y%m%d-%H%M%S")
|
|
54
55
|
|
|
55
|
-
self.device_id = device_id if device_id is not None else backend
|
|
56
|
-
|
|
57
56
|
if isinstance(backend, str):
|
|
58
57
|
self.backend = get_iqm_backend(backend)
|
|
59
|
-
|
|
60
58
|
else:
|
|
61
59
|
assert isinstance(backend, IQMBackendBase)
|
|
62
60
|
self.backend = backend
|
|
63
61
|
|
|
62
|
+
self.device_id = device_id if device_id is not None else self.backend.name
|
|
63
|
+
|
|
64
64
|
benchmarks: OrderedDict[str, BenchmarkBase] = OrderedDict(
|
|
65
65
|
(config.benchmark.name(), config.benchmark(self.backend, config)) for config in benchmark_configurations
|
|
66
66
|
)
|
|
@@ -74,7 +74,7 @@ class BenchmarkExperiment:
|
|
|
74
74
|
"""Run the Benchmark experiment, and store the configuration, raw data, results and figures."""
|
|
75
75
|
|
|
76
76
|
for name, benchmark in self.benchmarks.items():
|
|
77
|
-
|
|
77
|
+
qcvv_logger.info("\nNow executing " + name)
|
|
78
78
|
# Create the directory for results
|
|
79
79
|
results_dir = f"Outputs/{self.device_id}/{self.timestamp}/{name}/"
|
|
80
80
|
Path(results_dir).mkdir(parents=True, exist_ok=True)
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# Copyright 2024 IQM Benchmarks developers
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
"""
|
|
16
|
+
This module contains classes to easily interact with quantum circuits
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from dataclasses import dataclass, field
|
|
20
|
+
from typing import List, Optional, TypeAlias
|
|
21
|
+
|
|
22
|
+
from qiskit.circuit import Qubit
|
|
23
|
+
|
|
24
|
+
from iqm.qiskit_iqm.iqm_circuit import IQMCircuit
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
QubitLayout: TypeAlias = tuple[Qubit, ...]
|
|
28
|
+
QubitLayouts: TypeAlias = tuple[QubitLayout, ...]
|
|
29
|
+
QubitLayoutIndices: TypeAlias = tuple[tuple[int, ...], ...]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# pylint: disable=protected-access
|
|
33
|
+
@dataclass
|
|
34
|
+
class CircuitGroup:
|
|
35
|
+
"""Group of `IQMCircuits`. It represents a list of circuits with a common purpose, typically executed in a batch.
|
|
36
|
+
|
|
37
|
+
Attributes:
|
|
38
|
+
circuits: List of `IQMCircuit`.
|
|
39
|
+
name: Name of the group.
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
circuits: List[IQMCircuit] = field(default_factory=list)
|
|
43
|
+
name: Optional[str] = field(default="")
|
|
44
|
+
|
|
45
|
+
@property
|
|
46
|
+
def qubit_layouts_by_index(self) -> QubitLayoutIndices:
|
|
47
|
+
"""The qubit layouts contained in all the circuits, where the qubits are represented by an integer.
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
All qubit layouts.
|
|
51
|
+
"""
|
|
52
|
+
return tuple(tuple(int(qubit._index) for qubit in layout) for layout in self.qubit_layouts)
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def qubit_layouts(self) -> QubitLayouts:
|
|
56
|
+
"""The qubit layouts contained in all the circuits, where the qubits are represented by an instance of `Qubit`.
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
All qubit layouts.
|
|
60
|
+
"""
|
|
61
|
+
qubit_layouts = tuple(map(lambda x: tuple(x._data.active_bits()[0]), self.circuits))
|
|
62
|
+
return qubit_layouts
|
|
63
|
+
|
|
64
|
+
@property
|
|
65
|
+
def qubits(self) -> set[Qubit]:
|
|
66
|
+
"""The set of active qubits in all of the circuits
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
A set of `Qubit`
|
|
70
|
+
"""
|
|
71
|
+
qubit_set = set()
|
|
72
|
+
for circuit in self.circuits:
|
|
73
|
+
for qubit in circuit._data.active_bits()[0]:
|
|
74
|
+
qubit_set.add(qubit)
|
|
75
|
+
return qubit_set
|
|
76
|
+
|
|
77
|
+
def __setitem__(self, key: str, value: IQMCircuit) -> None:
|
|
78
|
+
value.name = key
|
|
79
|
+
return self.add_circuit(value)
|
|
80
|
+
|
|
81
|
+
def add_circuit(self, circuit: IQMCircuit):
|
|
82
|
+
"""Adds a circuit to the internal list
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
circuit: Circuit to add.
|
|
86
|
+
"""
|
|
87
|
+
self.circuits.append(circuit)
|
|
88
|
+
|
|
89
|
+
@property
|
|
90
|
+
def circuit_names(self) -> list[str]:
|
|
91
|
+
"""Name of all the circuits contained in the group as a string
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
List of strings
|
|
95
|
+
"""
|
|
96
|
+
benchmark_circuit_names = list(map(lambda x: x.name, self.circuits))
|
|
97
|
+
return benchmark_circuit_names
|
|
98
|
+
|
|
99
|
+
def get_circuits_by_name(self, name: str) -> Optional[IQMCircuit]:
|
|
100
|
+
"""Returns a list of the internal circuits that share the same name
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
name: Name of the circuit to return as a string
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
The circuit with the desired name as a string, or None if they are not found.
|
|
107
|
+
"""
|
|
108
|
+
benchmark_circuit_names = filter(lambda x: x.name == name, self.circuits)
|
|
109
|
+
return next(benchmark_circuit_names, None)
|
|
110
|
+
|
|
111
|
+
def __getitem__(self, key: str) -> Optional[IQMCircuit]:
|
|
112
|
+
return self.get_circuits_by_name(key)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
@dataclass
|
|
116
|
+
class BenchmarkCircuit:
|
|
117
|
+
"""A class grouping a list of `CircuitGroup` into a single purpose. This can typically represent, for example,
|
|
118
|
+
all of the transpiled circuits that are executed.
|
|
119
|
+
|
|
120
|
+
Attributes:
|
|
121
|
+
name: Name of the `BenchmarkCircuit`.
|
|
122
|
+
circuit_groups: List of `CircuitGroup` contained inside
|
|
123
|
+
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
name: str
|
|
127
|
+
circuit_groups: List[CircuitGroup] = field(default_factory=list)
|
|
128
|
+
|
|
129
|
+
def get_circuit_group_by_name(self, name: str) -> Optional[CircuitGroup]:
|
|
130
|
+
"""Gets a `CircuitGroup` by name.
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
name: name of the group.
|
|
134
|
+
|
|
135
|
+
Returns:
|
|
136
|
+
The desired `CircuitGroup`, or None if it does not exist.
|
|
137
|
+
|
|
138
|
+
"""
|
|
139
|
+
benchmark_circuit_names = filter(lambda x: x.name == name, self.circuit_groups)
|
|
140
|
+
next_value = next(benchmark_circuit_names, None)
|
|
141
|
+
return next_value
|
|
142
|
+
|
|
143
|
+
@property
|
|
144
|
+
def groups(self) -> List[CircuitGroup]:
|
|
145
|
+
"""The circuit groups inside."""
|
|
146
|
+
return self.circuit_groups
|
|
147
|
+
|
|
148
|
+
@property
|
|
149
|
+
def group_names(self) -> List[str | None]:
|
|
150
|
+
"""Names of all the contained `CircuitGroup`."""
|
|
151
|
+
return list(map(lambda x: x.name, self.circuit_groups)) if len(self.circuit_groups) > 0 else []
|
|
152
|
+
|
|
153
|
+
@property
|
|
154
|
+
def qubit_indices(self) -> set[int]:
|
|
155
|
+
"""Set of all the qubits used in all the `CircuitGroup`, represented as an integer."""
|
|
156
|
+
qubit_set = set()
|
|
157
|
+
for circuit in self.circuit_groups:
|
|
158
|
+
for qubit_index in map(lambda x: x._index, circuit.qubits):
|
|
159
|
+
qubit_set.add(qubit_index)
|
|
160
|
+
return qubit_set
|
|
161
|
+
|
|
162
|
+
@property
|
|
163
|
+
def qubits(self) -> set[Qubit]:
|
|
164
|
+
"""Set of all the qubits used in all the `CircuitGroup`, represented as an instance of `Qubit`."""
|
|
165
|
+
qubit_set: set[Qubit] = set()
|
|
166
|
+
for qubit in map(lambda x: x.qubits, self.circuit_groups):
|
|
167
|
+
qubit_set = qubit_set.union(qubit)
|
|
168
|
+
return qubit_set
|
|
169
|
+
|
|
170
|
+
@property
|
|
171
|
+
def qubit_layouts_by_index(self) -> set[QubitLayoutIndices]:
|
|
172
|
+
"""Set of all the qubit layouts used, where the qubits are represented as an integer."""
|
|
173
|
+
layout_set = set()
|
|
174
|
+
for layout in map(lambda x: x.qubit_layouts_by_index, self.circuit_groups):
|
|
175
|
+
layout_set.add(layout)
|
|
176
|
+
return layout_set
|
|
177
|
+
|
|
178
|
+
@property
|
|
179
|
+
def qubit_layouts(self) -> set[QubitLayouts]:
|
|
180
|
+
"""Set of all the qubit layouts used, where the qubits are represented as an instance of `Qubit`."""
|
|
181
|
+
layout_set = set()
|
|
182
|
+
for layout in map(lambda x: x.qubit_layouts, self.circuit_groups):
|
|
183
|
+
layout_set.add(layout)
|
|
184
|
+
return layout_set
|
|
185
|
+
|
|
186
|
+
def __setitem__(self, key: str, value: CircuitGroup) -> None:
|
|
187
|
+
value.name = key
|
|
188
|
+
return self.circuit_groups.append(value)
|
|
189
|
+
|
|
190
|
+
def __getitem__(self, key: str) -> CircuitGroup | None:
|
|
191
|
+
return self.get_circuit_group_by_name(key)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
@dataclass
|
|
195
|
+
class Circuits:
|
|
196
|
+
"""Container for all the `BenchmarkCircuit` that are generated in a single benchmark execution.
|
|
197
|
+
|
|
198
|
+
Attributes:
|
|
199
|
+
benchmark_circuits: List of `BenchmarkCircuit` contained.
|
|
200
|
+
"""
|
|
201
|
+
|
|
202
|
+
benchmark_circuits: List[BenchmarkCircuit] = field(default_factory=list)
|
|
203
|
+
|
|
204
|
+
def __setitem__(self, key: str, value: BenchmarkCircuit) -> None:
|
|
205
|
+
value.name = key
|
|
206
|
+
return self.benchmark_circuits.append(value)
|
|
207
|
+
|
|
208
|
+
def __getitem__(self, key: str) -> BenchmarkCircuit | None:
|
|
209
|
+
return self.get_benchmark_circuits_by_name(key)
|
|
210
|
+
|
|
211
|
+
def get_benchmark_circuits_by_name(self, name: str) -> Optional[BenchmarkCircuit]:
|
|
212
|
+
"""Returned the `BenchmarkCircuit` by name.
|
|
213
|
+
|
|
214
|
+
Args:
|
|
215
|
+
name: Name of the requested `BenchmarkCircuit` as a string
|
|
216
|
+
|
|
217
|
+
Returns:
|
|
218
|
+
The requested `BenchmarkCircuit` if it exists, None otherwise
|
|
219
|
+
"""
|
|
220
|
+
benchmark_circuit_names = filter(lambda x: x.name == name, self.benchmark_circuits)
|
|
221
|
+
return next(benchmark_circuit_names, None)
|
|
@@ -30,12 +30,12 @@ The full benchmark executes the following steps:
|
|
|
30
30
|
from typing import Any, Dict, List, Tuple, Type, Union
|
|
31
31
|
|
|
32
32
|
import numpy as np
|
|
33
|
-
from qiskit import QuantumCircuit
|
|
34
33
|
from qiskit.circuit.library import CZGate, RGate
|
|
35
34
|
import xarray as xr
|
|
36
35
|
|
|
37
36
|
from iqm.benchmarks.benchmark import BenchmarkConfigurationBase
|
|
38
37
|
from iqm.benchmarks.benchmark_definition import Benchmark, add_counts_to_dataset
|
|
38
|
+
from iqm.benchmarks.circuit_containers import BenchmarkCircuit, CircuitGroup, Circuits
|
|
39
39
|
from iqm.benchmarks.compressive_gst.gst_analysis import mgst_analysis
|
|
40
40
|
from iqm.benchmarks.logging_config import qcvv_logger
|
|
41
41
|
from iqm.benchmarks.utils import (
|
|
@@ -45,6 +45,7 @@ from iqm.benchmarks.utils import (
|
|
|
45
45
|
submit_execute,
|
|
46
46
|
timeit,
|
|
47
47
|
)
|
|
48
|
+
from iqm.qiskit_iqm import IQMCircuit as QuantumCircuit
|
|
48
49
|
from iqm.qiskit_iqm.iqm_backend import IQMBackendBase
|
|
49
50
|
from mGST import additional_fns, qiskit_interface
|
|
50
51
|
from mGST.qiskit_interface import add_idle_gates, remove_idle_wires
|
|
@@ -156,8 +157,10 @@ class CompressiveGST(Benchmark):
|
|
|
156
157
|
drop_final_rz=False,
|
|
157
158
|
)
|
|
158
159
|
# Saving raw and transpiled circuits in a consistent format with other benchmarks
|
|
159
|
-
self.
|
|
160
|
-
self.
|
|
160
|
+
self.transpiled_circuits.circuit_groups.append(CircuitGroup(name=str(qubits), circuits=raw_qc_list))
|
|
161
|
+
self.untranspiled_circuits.circuit_groups.append(
|
|
162
|
+
CircuitGroup(name=str(qubits), circuits=transpiled_qc_list)
|
|
163
|
+
)
|
|
161
164
|
|
|
162
165
|
def add_configuration_to_dataset(self, dataset): # CHECK
|
|
163
166
|
"""
|
|
@@ -186,13 +189,16 @@ class CompressiveGST(Benchmark):
|
|
|
186
189
|
dataset = xr.Dataset()
|
|
187
190
|
qcvv_logger.info(f"Now generating {self.configuration.num_circuits} random GST circuits...")
|
|
188
191
|
|
|
192
|
+
self.circuits = Circuits()
|
|
193
|
+
self.transpiled_circuits = BenchmarkCircuit(name="transpiled_circuits")
|
|
194
|
+
self.untranspiled_circuits = BenchmarkCircuit(name="untranspiled_circuits")
|
|
189
195
|
# Generate circuits
|
|
190
196
|
self.generate_meas_circuits()
|
|
191
197
|
|
|
192
198
|
# Submit all
|
|
193
199
|
all_jobs: Dict = {}
|
|
194
200
|
for qubit_layout in self.qubit_layouts:
|
|
195
|
-
transpiled_circuit_dict = {tuple(qubit_layout): self.transpiled_circuits[str(qubit_layout)]}
|
|
201
|
+
transpiled_circuit_dict = {tuple(qubit_layout): self.transpiled_circuits[str(qubit_layout)].circuits}
|
|
196
202
|
all_jobs[str(qubit_layout)], _ = submit_execute(
|
|
197
203
|
transpiled_circuit_dict,
|
|
198
204
|
backend,
|
|
@@ -207,6 +213,7 @@ class CompressiveGST(Benchmark):
|
|
|
207
213
|
dataset, _ = add_counts_to_dataset(counts, str(qubit_layout), dataset)
|
|
208
214
|
|
|
209
215
|
self.add_configuration_to_dataset(dataset)
|
|
216
|
+
self.circuits.benchmark_circuits = [self.transpiled_circuits, self.untranspiled_circuits]
|
|
210
217
|
return dataset
|
|
211
218
|
|
|
212
219
|
|