Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
KPRoche opened this issue May 14, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@KPRoche
Copy link

KPRoche commented May 14, 2024

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

  • qiskit-ibm-runtime version:
    1
  • Python version:
  • 3.9.18
  • Operating system:
    CentOS Stream 9
@KPRoche KPRoche added the bug Something isn't working label May 14, 2024
@yaelbh
Copy link

yaelbh commented May 15, 2024

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
Copy link
Author

KPRoche commented May 15, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants