Skip to content

Commit

Permalink
Add overall transpilation time bench with scheduling (Qiskit/qiskit-m…
Browse files Browse the repository at this point in the history
…etapackage#1441)

Add a benchmark to track the overall time performance of circuit
scheduling, which would be near to that end users actually
experience when scheduling.

Follow-up PR of Qiskit/qiskit-metapackage#1421. As suggested in the original PR,
optimization level 0 and 1 are added so that it would not take so
much time while covering the places where people are doing
scheduling.

* Add overall transpilation time bench with scheduling

* Improve a bit
  • Loading branch information
itoko authored Mar 11, 2022
1 parent 3ba914f commit 7fcf98a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/benchmarks/transpiler_levels.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

from qiskit.compiler import transpile
from qiskit import QuantumCircuit
from qiskit.transpiler import InstructionDurations

from .backends.fake_melbourne import FakeMelbourne
from .utils import build_qv_model_circuit
Expand Down Expand Up @@ -155,6 +156,14 @@ def setup(self, _):
large_qasm_path = os.path.join(self.qasm_path, 'test_eoh_qasm.qasm')
self.large_qasm = QuantumCircuit.from_qasm_file(large_qasm_path)
self.melbourne = FakeMelbourne()
self.durations = InstructionDurations([
("u1", None, 0),
("id", None, 160),
("u2", None, 160),
("u3", None, 320),
("cx", None, 800),
("measure", None, 3200),
], dt=1e-9)

def time_quantum_volume_transpile_50_x_20(self, transpiler_level):
transpile(self.qv_50_x_20, basis_gates=self.basis_gates,
Expand Down Expand Up @@ -197,3 +206,12 @@ def time_transpile_qv_14_x_14(self, transpiler_level):
def track_depth_transpile_qv_14_x_14(self, transpiler_level):
return transpile(self.qv_14_x_14, self.melbourne, seed_transpiler=0,
optimization_level=transpiler_level).depth()

def time_schedule_qv_14_x_14(self, transpiler_level):
transpile(self.qv_14_x_14, self.melbourne, seed_transpiler=0,
optimization_level=transpiler_level,
scheduling_method="alap",
instruction_durations=self.durations)

# limit optimization levels to reduce time
time_schedule_qv_14_x_14.params = [0, 1]

0 comments on commit 7fcf98a

Please sign in to comment.