-
Notifications
You must be signed in to change notification settings - Fork 131
WIP: add skip transpile to t1 #1454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,7 +98,7 @@ def __init__( | |
# Set experiment options | ||
self.set_experiment_options(delays=delays) | ||
|
||
def circuits(self) -> List[QuantumCircuit]: | ||
def circuits(self, qnum=0) -> List[QuantumCircuit]: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know this is much faster but You can consider another approach of creating a pass manager that only performs virtual -> physical index mapping. Which must be lightweight compared with the default level0 pass manager (to reduce overhead you can directly run Unfortunately this code is not as performant as the proposed code change because of the initialization overhead of passes and pass manager instance. However this doesn't cause API break. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think there's anything forbidden by this idea in inheritance because the circuit call still behaves the same. You can absolutely add parameters to an inherited function. But this is also backwards compatibl. I also don't know why |
||
""" | ||
Return a list of experiment circuits | ||
|
||
|
@@ -109,18 +109,33 @@ def circuits(self) -> List[QuantumCircuit]: | |
|
||
circuits = [] | ||
for delay in self.experiment_options.delays: | ||
circ = QuantumCircuit(1, 1) | ||
circ.x(0) | ||
circ.barrier(0) | ||
circ.delay(timing.round_delay(time=delay), 0, timing.delay_unit) | ||
circ.barrier(0) | ||
circ.measure(0, 0) | ||
circ = QuantumCircuit(qnum+1, 1) | ||
circ.x(qnum) | ||
circ.barrier(qnum) | ||
circ.delay(timing.round_delay(time=delay), qnum, timing.delay_unit) | ||
circ.barrier(qnum) | ||
circ.measure(qnum, 0) | ||
|
||
circ.metadata = {"xval": timing.delay_time(time=delay)} | ||
|
||
circuits.append(circ) | ||
|
||
return circuits | ||
|
||
def _transpiled_circuits(self) -> List[QuantumCircuit]: | ||
"""Return a list of experiment circuits, transpiled. | ||
|
||
Override to skip transpilaion if not needed | ||
""" | ||
if self._backend: | ||
#get basis gates | ||
basis_gates = self._backend.configuration().basis_gates | ||
|
||
if 'x' in basis_gates: | ||
return self.circuits(self.physical_qubits[0]) | ||
|
||
return super()._transpiled_circuits() | ||
|
||
|
||
def _metadata(self): | ||
metadata = super()._metadata() | ||
|
Uh oh!
There was an error while loading. Please reload this page.