I want to measure the gate time on the IONQ devices.
And the code is as follows,
import pennylane as qml
from pennylane_ionq import ops
import time
dev = qml.device("ionq.qpu", backend="harmony", wires=2)
@qml.qnode(dev)
def circuit():
time_start=time.time()
qml.CNOT(wires=[0, 1])
time_end=time.time()
print('time cost',time_end-time_start,'s')
return qml.counts()
result = circuit()
print(result)
But I think in this way, I can only get the program excution time. Is there any method that I can get the cnot gate time on the IONQ devices? Any help will be appreciated.
Thanks for your question! You are correct in thinking that this isn’t capturing the information you are looking for.
Timing this section of the code will actually record how long it takes PennyLane to execute this particular line, which adds the CNOT to the program that will ultimately be sent to the device. It is completed before any request is sent to the hardware at all, and is unrelated to hardware execution time.
Unfortunately, there’s no way to isolate the execution of the CNOT gate in PennyLane. The python code defines the commands being sent to hardware, but those commands are translated to a format that the IonQ backend understands before being passed along, and the translation doesn’t include timing at specific parts of the circuit - only the gates and measurements to be applied.
Additionally, if you have an API key to access the hardware, you can access their most recent benchmarking data for a given device, including 2-qubit gate durations, on the IonQ website here.