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

Update fake backend and fake provider to use versioned interface #6286

Merged

Conversation

mtreinish
Copy link
Member

Summary

As was reported in #6280 the algorithms path doesn't work on minimal
examples of the Backend and Jobs interface and instead only works in
practice on ibmq, aer, or basic aer backends. Part of the reason for
this was that all the testing of algorithms is done exclusively on those
providers and there wasn't a minimal example to test against that
doesn't have legacy overhead (like qobj, etc). This commit updates the
fake providers and fake backends to use the latest version of the
provider, backend, and job interfaces and to be strictly compatible (ie
no qobj support). Besides exercising the new interface version it also
enables us to test the eventual fix for #6280 when it's available.

Details and comments

As was reported in Qiskit#6280 the algorithms path doesn't work on minimal
examples of the Backend and Jobs interface and instead only works in
practice on ibmq, aer, or basic aer backends. Part of the reason for
this was that all the testing of algorithms is done exclusively on those
providers and there wasn't a minimal example to test against that
doesn't have legacy overhead (like qobj, etc). This commit updates the
fake providers and fake backends to use the latest version of the
provider, backend, and job interfaces and to be strictly compatible (ie
no qobj support). Besides exercising the new interface version it also
enables us to test the eventual fix for Qiskit#6280 when it's available.
@mtreinish mtreinish requested review from chriseclectic, jyu00 and a team as code owners April 22, 2021 16:39
@jyu00
Copy link
Contributor

jyu00 commented Apr 22, 2021

The code looks good. However, FakeBackend is widely used (even in Qiskit textbook and tutorials), so dropping Qobj support without warning is a bit risky. It certainly shouldn't be in a patch release even though it's "fake".

@mtreinish
Copy link
Member Author

mtreinish commented Apr 22, 2021

The code looks good. However, FakeBackend is widely used (even in Qiskit textbook and tutorials), so dropping Qobj support without warning is a bit risky. It certainly shouldn't be in a patch release even though it's "fake".

I wasn't proposing this to be backported or included in a patch release, I agree this isn't valid for that. The tension here is that there actually isn't any backend available for local testing that rejects qobj currently, which only makes issues like #6280 more likely. This felt like the right place to do it since these are the test backends.

It's also worth noting that we do run the tutorials here and none of them failed with this. The textbook might be a different, but I believe they're still using execute which will be seamless. It honestly would be quite odd if the textbook or tutorials were manually constructing a qobjs.

@jyu00
Copy link
Contributor

jyu00 commented Apr 23, 2021

When I searched for qiskit textbook fake, this was the second result: https://qiskit.org/textbook/ch-appendix/qiskit.html which does use qobj. But if you don't plan on making this a patch release then there should be plenty of time for the textbook to be updated.

jyu00
jyu00 previously approved these changes Apr 23, 2021
@mtreinish mtreinish added automerge Changelog: API Change Include in the "Changed" section of the changelog labels Apr 29, 2021
@mergify mergify bot merged commit 6f9784c into Qiskit:main Apr 29, 2021
@mtreinish mtreinish deleted the update-fake-provider-to-versioned-interface branch April 30, 2021 15:12
mtreinish added a commit that referenced this pull request May 3, 2021
2 of the tests added in #6299 depend on the fake backends in
qiskit.test.mock being strict BackendV1 backends (that reject qobj) and
also having other aspects of the interface implemented (mainly run
kwargs). However the change which updated the fake backends to use
BackendV1 (#6286) is not backportable as it's an API change, so these
tests are runnable in stable/0.17. This commit just removes these tests
because even if we could get them running without #6286 we wouldn't be
actually testing the v1 interface (which is their purpose).
mergify bot added a commit that referenced this pull request May 3, 2021
…andle QasmQobj (backport #6299) (#6343)

* Add support on QuantumInstance/run_circuits for Backends that don't handle QasmQobj (#6299)

* Support BackendV1

* Add error mitigation logic.
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Fix run_circuits calls

* add unit tests

* Update qiskit/utils/run_circuits.py

Add check for providers that don't support it.

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* Add error mitigation test

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit a0ed7ff)

* Remove tests that depend on BackendV1 fake backends

2 of the tests added in #6299 depend on the fake backends in
qiskit.test.mock being strict BackendV1 backends (that reject qobj) and
also having other aspects of the interface implemented (mainly run
kwargs). However the change which updated the fake backends to use
BackendV1 (#6286) is not backportable as it's an API change, so these
tests are runnable in stable/0.17. This commit just removes these tests
because even if we could get them running without #6286 we wouldn't be
actually testing the v1 interface (which is their purpose).

* Fix lint

Co-authored-by: Manoel Marques <Manoel.Marques@ibm.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
mtreinish added a commit to mtreinish/qiskit-core that referenced this pull request May 14, 2021
This commit fixes the merge conflicts from backporting Qiskit#6391 to
stable/0.17. The tests added in Qiskit#6391 are just removed because they
can't actually run without Qiskit#6286 which isn't backportable.
1ucian0 pushed a commit that referenced this pull request May 17, 2021
…6391) (#6414)

* Respect max_experiments in QuantumInstance BackendV1 path (#6391)

* Respect max_experiments in QuantumInstance BackendV1 path

In #6299 support was fixed for strict BackendV1 backends that only take
QuantumCircuit objects (instead of qobj) for the input. That was fixed
by adding a parallel path when running with a new backend. However that
parallel path wasn't identical and was missing the support the qobj path
had for splitting an algorithm run into multiple jobs if the backend if
the number of circuits was greater than the max_experiments set in the
backend. This would result on some providers' backends, such as ionq and
aqt, both of which have max_experiments set to 1. This commit fixes this
issue by splitting the circuits list into smaller sublists when the
len(circuits) > max_experiments (or the old env var, which we should
change the name of at some point).

* Fix issues with results and split circuits path

* Fix copy paste issue

* Update qiskit/utils/run_circuits.py

* Add release notes

* Fix whitespace

Co-authored-by: Kevin Krsulich <kevin.krsulich@ibm.com>
Co-authored-by: Manoel Marques <Manoel.Marques@ibm.com>
(cherry picked from commit 9d4bb91)

# Conflicts:
#	qiskit/utils/run_circuits.py
#	test/python/algorithms/test_backendv1.py

* Fix merge conflicts

This commit fixes the merge conflicts from backporting #6391 to
stable/0.17. The tests added in #6391 are just removed because they
can't actually run without #6286 which isn't backportable.

* Fix lint

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
ElePT pushed a commit to ElePT/qiskit-ibm-provider that referenced this pull request Oct 9, 2023
…kit/qiskit#6286)

* Update fake backend and fake provider to use versioned interface

As was reported in Qiskit/qiskit#6280 the algorithms path doesn't work on minimal
examples of the Backend and Jobs interface and instead only works in
practice on ibmq, aer, or basic aer backends. Part of the reason for
this was that all the testing of algorithms is done exclusively on those
providers and there wasn't a minimal example to test against that
doesn't have legacy overhead (like qobj, etc). This commit updates the
fake providers and fake backends to use the latest version of the
provider, backend, and job interfaces and to be strictly compatible (ie
no qobj support). Besides exercising the new interface version it also
enables us to test the eventual fix for Qiskit/qiskit#6280 when it's available.

* Fix lint

* Add legacy fake backends using BaseBackend
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: API Change Include in the "Changed" section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants