Qiskit / qiskit-ibm-provider

Qiskit Provider for accessing the IBM Quantum Services: Online Systems and Simulators
https://qiskit.org/ecosystem/ibm-provider/
Apache License 2.0
77 stars 68 forks source link

Qubits are not reset correctly when running multiple circuits in the same job on a real backend #788

Closed sorin-bolos closed 8 months ago

sorin-bolos commented 9 months ago

Information

What is the current behavior?

I'm creating two circuits on one qubit each:

Run these circuits in a list on a single job on a real IBM backend (I used 'ibm-osaka', but It was reproduced on other systems)

job = backend.run([circ1, circ2], shots=100)

The resulting counts for the second circuit should be all "0" since it only does a measurement, but they are 50% "1" and 50% "0"

Total counts (for both circuits) are: [{'0': 100}, {'0': 52, '1': 48}]

This happens consistently on every job with this configuration. I tried adding the circuits in alternation [circuit1, circuit2, circuit1, circuit2] and the 50/50 measurement only happens at odd alternations. I also tried transpiling the circuits against the real backend to make sure the same qubit is used on both circuits. Same result.

Steps to reproduce the problem

Run the following circuit

from qiskit import QuantumCircuit, transpile
from qiskit_ibm_provider import IBMProvider

provider = IBMProvider()
backend = provider.get_backend('ibm_osaka')

circ1 = QuantumCircuit(1, 1)
circ1.x(0)
display(circ1.draw('mpl'))

circ2 = QuantumCircuit(1, 1)
circ2.measure(0, 0)
display(circ2.draw('mpl'))

job = backend.run([circ1, circ2], shots=100)
results = job.result()
counts = results.get_counts()
print("\nTotal counts are:", counts)

What is the expected behavior?

The returned counts should be [{'0': 100}, {'0': 100}]

Suggested solutions

kt474 commented 8 months ago

Issue has been resolved - https://github.com/Qiskit/qiskit-ibm-runtime/issues/1310#issuecomment-1889210897