Open balewski opened 2 years ago
I don't know if this is the cause to your problem. But note that calling run
sends the circuits to the device, and your program continues in parallel to the execution on the device. So, when you call qubit_duration
, it is possible that the execution on the device hasn't terminated yet (actually it's probably still waiting in the queue). You have to call job.result()
in order to stop your program until the device finishes, or monitor the job.
Hi Yael, this is the minimal example https://bitbucket.org/balewski/quantummind/src/master/2018/tickets/run_ticket4.py
It waited an hour for lima to complete the execution of the circuit. This is what I see, please help Jan
On Jun 7, 2022, at 12:02 AM, Yael Ben-Haim @.***> wrote:
I don't know if this is the cause to your problem. But note that calling run sends the circuits to the device, and your program continues in parallel to the execution on the device. So, when you call qubit_duration, it is possible that the execution on the device hasn't terminated yet (actually it's probably still waiting in the queue). You have to call job.result() in order to stop your program until the device finishes, or monitor the job.
— Reply to this email directly, view it on GitHub https://github.com/Qiskit/qiskit-terra/issues/8180, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAMOFBRVVZOLVOKUBWSYMDVN3XXFANCNFSM5YBLOLEQ. You are receiving this because you authored the thread.
I'm not familiar with qubit_duration
. I suggest to ask in the public Slack channels, for example https://join.slack.com/share/enQtMzYzOTcwOTA2OTQyOC03NWZmMzRmYmRmNjljOGFjNGVhYmFhNTkwOGZiZjMyMjI1MzI3ODA3OWFiOWNiOWVmMjMzMDNhNjg1ZTg1OWQy
@balewski The suggestion from @yaelbh to ask in a Qiskit Slack channel is good. If there is a problem to report, I think it should be reported in https://github.com/Qiskit/qiskit-terra. I don't see anything in your examples that is specific to qiskit-experiments.
HI @balewski .qubit_duration
only work with "scheduled circuit". So you first need to schedule the circuit. That can be done by specifying scheduling_method
option in transpile
. Please change your code like
circT = qk.transpile(circ, backend=backend, optimization_level=3, scheduling_method="asap") # or "alap"
print(circT.qubit_duration(1))
and you can get the duration even before running the circuit.
thank you! I got it to work. Can you help me with few follow-up questions?
Q1: I see 2 scheduling option: ASAP & ALAP. If I run on the actual HW, say Jakarta, will my choice be honored? If yes, I'm expecting to obtain different results, regardless of different shots statistics, because the overlay between pulses driving different qubits will be different, hence the crosstalk will change. Is this reasonable?
Q2: for a real HW at IBMQ, why the default ALAP is better than ASAP?
Q3: For the circuit transpiled below in the ASAP mode, Qiskit reports the same duration for all 3 used qubits (which is equal to the delay of the ancilla qubit). = = = duration of drive per qubit 3 31760 1 31760 4 31760 = = = It seems the last delays on q1 of Delay(320[dt]), and on q4 of Delay(2592[dt]) are included in reported time. This seems to contradict the documentation, which says: ... excluding delays... https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.qubit_duration.html https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.qubit_duration.html What do I miss? I'd like to know for how the total of ns any pulse was applied for given qubit, so excluding all delays, even if they are in cycles inside the circuit (the one below is too simple for that).
Q3: how can I extract from the backend the value of 'dt' in seconds, so I can convert duration to SI units?
Thanks Jan
Informations
Qiskit Experiments version:
$ pip list |grep qiskit qiskit 0.36.2 qiskit-aer 0.10.4 qiskit-aqua 0.9.2 qiskit-experiments 0.3.1 qiskit-ibmq-provider 0.19.1 qiskit-ignis 0.7.1 qiskit-terra 0.20.2
Python version: Python 3.9.2
Operating system: Ubuntu
What is the current behavior?
I'd like to know the total time given qubit was driven when circuit was executed on real HW (ibmq_quito).
I have constructed a circuit, transpiled, submitted the job, and asked job for the circuit after the submission - I still get no output. How can I trigger the scheduler to attach the info I want?
This are key lines form my code:
circ=... circT = qk.transpile(circ, backend=backend, optimization_level=3) job = backend.run(circTL,shots=1000) circSL=job.circuits() print('submitted JID=',job.job_id(),backend ') print(circSL[1].qubit_duration(1))
The result is: ... submitted JID= 629ebde5a38471bafc4529b4 ibmq_quito ... Traceback (most recent call last): File "/home/balewski/2022_QPIXL_ver1/qiskit_examples/production/./submit_ibmq_job.py", line 98, in
print(circSL[2].qubit_duration(1))
File "/home/balewski/.local/lib/python3.9/site-packages/qiskit/circuit/quantumcircuit.py", line 4575, in qubit_duration
return self.qubit_stop_time(qubits) - self.qubit_start_time(qubits)
File "/home/balewski/.local/lib/python3.9/site-packages/qiskit/circuit/quantumcircuit.py", line 4639, in qubit_stop_time
raise CircuitError(
qiskit.circuit.exceptions.CircuitError: 'qubit_stop_time undefined. Circuit must be scheduled first.'
Steps to reproduce the problem
I could provide a demonstrator
What is the expected behavior?
get the total length of few usec
Suggested solutions