Qiskit / qiskit-ibm-runtime

IBM Client for Qiskit Runtime
https://docs.quantum.ibm.com/api/qiskit-ibm-runtime
Apache License 2.0
149 stars 154 forks source link

Local simulator backend APIs do not match that of real processor backend objects #1676

Closed KPRoche closed 2 months ago

KPRoche commented 4 months ago

With the cloud simulators going away May 15, the Migration Guides encourage users to switch to local testing:

Quantum simulators should be used to help develop and test programs before fine-tuning them and sending them to quantum hardware. Local simulators can do this with good performance and efficiency.

This is especially important for users like me which only have limited Open Plan access to the real processors, so making sure program flow works before accessing a real backend is critical. Unfortunately, the attrributes and methods of the local simulators objects do not match those of the real IBMbackend object; for instance, the FakeBackends do not have the backend.simulator attribute nor the backend.status() method, and Aer simulators do not have the simulator attribute.

Steps to reproduce In a python session load the QiskitRuntimeService and instantiate a connection to your account, then create a connection to a real backend, a fakebackend, and an aer simulator. The APIs do not match

from qiskit_ibm_runtime import QiskitRuntimeService
from qiskit_ibm_runtime.fake_provider import FakeManilaV2 from qiskit_aer import Aer, AerSimulator service = QiskitRuntimeService() realbackend = service.least_busy(operational=True, simulator=False) fakebackend = FakeManilaV2() aersimulator = AerSimulator.from_backend(realbackend)

realbackend.simulator False realbackend.status().operational True realbackend.status().pending_jobs 1 fakebackend.simulator Traceback (most recent call last): File "", line 1, in AttributeError: 'FakeManilaV2' object has no attribute 'simulator' fakebackend.status().operational Traceback (most recent call last): File "", line 1, in AttributeError: 'FakeManilaV2' object has no attribute 'status' aersimulator.simulator Traceback (most recent call last): File "", line 1, in AttributeError: 'AerSimulator' object has no attribute 'simulator' aersimulator.status().operational True aersimulator.status().pending_jobs 0

What happens: The fake backend throws an error if you attempt to access the simulator attribute or attempt to use the status() method. The Aer simulator does return results from the status() method, but does not have the simulator attribute These are just a few examples Expected behavior If the local testing backends are supposed to be used for code development before programatically accessing the real IBM Quantum devices, they should return responses for all the attributes and methods of the IBMBackend object

Suggested solutions Fill in the missing attributes and methods so local testing backend objects match the IBMBackend objects

Additional Information

yaelbh commented 4 months ago

This reminds me of a similar issue that I once opened. I don't know how much of that old issue is still relevant.

KPRoche commented 4 months ago

This reminds me of a similar issue that I once opened. I don't know how much of that old issue is still relevant.

Some of it definitely is still relevant. I only pulled out a sample of the differences between the objects

jyu00 commented 2 months ago

Duplicate of #1605