Open
Description
Describe the bug
Job never finishes when using EstimatorV2 with a parametrized circuit, custom gates and pulse calibrations.
Steps to reproduce
This is a simple example to reproduce this error:
from qiskit import QuantumCircuit, pulse, transpile
from qiskit.circuit import Gate, Parameter
from qiskit.pulse.library import Gaussian
from qiskit_ibm_runtime import QiskitRuntimeService, EstimatorV2 as Estimator
from qiskit.quantum_info import SparsePauliOp
service = QiskitRuntimeService(channel="ibm_quantum")
backend = service.least_busy(operational=True, simulator=False)
estimator = Estimator(mode=backend)
print(backend)
Second block:
parameters = [Parameter(f'{i}') for i in range(3)]
circ = QuantumCircuit(1, 1)
custom_gate = Gate('my_custom_gate', 1, [parameters[0], parameters[1], parameters[2]])
circ.append(custom_gate, [0])
circ.measure(0, 0)
circ.draw('mpl')
def pulse_builder(a,b,c):
with pulse.build(backend, name='custom') as my_schedule:
pulse.play(Gaussian(duration=a, amp=b, sigma=c), pulse.drive_channel(0))
return my_schedule
circ.add_calibration('my_custom_gate', [0], pulse_builder(parameters[0], parameters[1], parameters[2]), [parameters[0], parameters[1], parameters[2]])
circ = transpile(circ)
circ.draw('mpl', idle_wires=False)
Last block:
hamiltonian = SparsePauliOp.from_list(
[("Y", -0.3980), ("Z", -0.0113), ("X", 0.1810)]
)
Params = [64,0.2,8]
pub = (circ, [hamiltonian], [Params])
result = estimator.run([pub]).result()
Expected behavior
This should return a result and not remain in the 'running' state 'forever'. I waited for several minutes until I cancelled the job. This job should only take a couple of seconds.
Suggested solutions
Additional Information
This problem does not occur if I use the SamplerV2 instead of the EstimatorV2.
This does not throw a python error.
- qiskit-ibm-runtime version:
- 0.25.0
- Python version:
- 3.10.14
- Operating system:
- Windows 11 Pro, Version 23H2