-
Notifications
You must be signed in to change notification settings - Fork 156
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
Fake backends correctly report themselves as simulators #2005
base: main
Are you sure you want to change the base?
Conversation
While working on #2000, I've noticed something that makes me understand that we have to be careful. In certain respects fake backends are to be treated as devices and not simulators. See this line: qiskit-ibm-runtime/qiskit_ibm_runtime/base_primitive.py Lines 175 to 176 in 9f2dad5
--> We want fake backends to undergo ISA checks, but not simulators. So, it seems that we have three types of backends:
In any case, this PR has to make sure that ISA checks will continue for fake backends. Check if additional fixes are required, except for ISA. Also, possibly such a change (tagging fake backends as simulators) requires some kind of pre-announcement / deprecation etc. |
To distinguish between devices and simulators, consider checking if the backend is an qiskit-ibm-runtime/qiskit_ibm_runtime/base_primitive.py Lines 178 to 179 in 9f2dad5
|
Why not? The simulators have a set of basis gates as well that must be satisfied, e.g. look at the basis gates for the aer simulator |
Excellent question. I don't remember exactly why it was done this way, but my first guess is that the cloud-based simulators didn't return correct information for the ISA checks to work. |
In this case, I think this is low hanging fruit given that the fake backends are indeed wrappers of the Aer simuilator at the end of the day. Anything that breaks on top is just abusing the current incorrectness of the setting. |
Maybe giving some transpiler context can be useful in this discussion. I am not so familiar with the Aer simulator, but I can say that a plain instance of I like to see backends as target + run. Following this classification, we have the following categories:
The differences in target mean that, in practice, a However, from the pure As for the isa check, I think that both the "real" and the "simulator" target could be isa-checkable (you'd have to adjust the |
Summary
Since time began, FakeBackends have been reporting themselves as not being simulators because their configuration files come from real systems. This forces people who use these systems for testing to use less than ideal coding practices, e.g. looking for
fake
in a name string, to identify these instances, and go from there.This PR makes each backend report that they are indeed simulators, i.e.
backend.configuration().simulator = True
. This makes using these fake backends easier in downstream packages.Details and comments
Fixes #