Open zywang12 opened 1 month ago
As you've also pointed out in the description, these are simulators and don't have a concept of gate durations. If you're looking for an emulation of a real device, you can use a fake backend. For example
from qiskit.circuit import QuantumCircuit
from qiskit import transpile
from qiskit_ibm_runtime.fake_provider import FakeSherbrooke
qc = QuantumCircuit(1)
# qc.id(0) # The value of node.op.duration is 0
# qc.barrier() # The value of node.op.duration is 0
qc.x(0) # The value of node.op.duration is None
qc.measure_all()# The value of node.op.duration is None
backend = FakeSherbrooke()
qc = transpile(qc, optimization_level=1, backend=backend, scheduling_method='asap')
It might be nice to add a suggestion to use a fake backend in the error message.
It would, but that might be a too specific error message, as not finding the duration of a gate could have other reasons... If there's a way to check whether a given target comes from a simulator we could add such a warning in the scheduling passes, but I don't know if it's possible to know that.
I see. Duration could miss due to other reasons.
We could potentially add a warning/error if the target durations are completely empty, in which case there's no way we can schedule a (non-empty) circuit 🤔
Environment
What is happening?
AerSimulator and QasmSimulator cannot transpile most gates (except for
barrier
andid
) when using the parameterscheduling_method='asap'
. The following error message is displayed:This is because the
node.op.duration
for these gates is set toNone
, whereasbarrier
andid
gates have a duration value of0
.How can we reproduce the issue?
What should happen?
Assigning default values to all gates would be better.
Any suggestions?
No response