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

Respect max_experiments in QuantumInstance BackendV1 path #6391

Merged
merged 11 commits into from
May 14, 2021

Conversation

mtreinish
Copy link
Member

Summary

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).

Details and comments

@mtreinish mtreinish added stable backport potential The bug might be minimal and/or import enough to be port to stable Changelog: Bugfix Include in the "Fixed" section of the changelog labels May 10, 2021
@mtreinish mtreinish requested review from manoelmarques, woodsp-ibm and a team as code owners May 10, 2021 19:14
In Qiskit#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).
@mtreinish mtreinish force-pushed the fix-circuits-algorithms branch from 9cd7b8d to a961c90 Compare May 10, 2021 19:14
Comment on lines +463 to +464
if is_local_backend(backend):
max_circuits_per_job = sys.maxsize
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just copied this from the qobj path, but I don't think this is actually correct. We should probably defer to the max_experiments value in the configuration because a local backend might not accept the max list size circuits for a single job.

manoelmarques
manoelmarques previously approved these changes May 10, 2021
@mtreinish mtreinish requested a review from manoelmarques May 13, 2021 15:49
@kdk kdk added the automerge label May 13, 2021
@mergify mergify bot merged commit 9d4bb91 into Qiskit:main May 14, 2021
mergify bot pushed a commit that referenced this pull request May 14, 2021
* 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 <[email protected]>
Co-authored-by: Manoel Marques <[email protected]>
(cherry picked from commit 9d4bb91)

# Conflicts:
#	qiskit/utils/run_circuits.py
#	test/python/algorithms/test_backendv1.py
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.
@mtreinish mtreinish deleted the fix-circuits-algorithms branch May 14, 2021 16:53
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 <[email protected]>
Co-authored-by: Manoel Marques <[email protected]>
(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 <[email protected]>
ElePT pushed a commit to ElePT/qiskit that referenced this pull request Jun 27, 2023
* Respect max_experiments in QuantumInstance BackendV1 path

In Qiskit#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 <[email protected]>
Co-authored-by: Manoel Marques <[email protected]>
ElePT pushed a commit to ElePT/qiskit-algorithms-test that referenced this pull request Jul 17, 2023
…kit#6391)

* Respect max_experiments in QuantumInstance BackendV1 path

In Qiskit/qiskit#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 <[email protected]>
Co-authored-by: Manoel Marques <[email protected]>
ElePT pushed a commit to ElePT/qiskit-algorithms that referenced this pull request Jul 27, 2023
…kit#6391)

* Respect max_experiments in QuantumInstance BackendV1 path

In Qiskit/qiskit#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 <[email protected]>
Co-authored-by: Manoel Marques <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants