Skip to content

Commit 9cbe14b

Browse files
mtreinishkdkmanoelmarques
authored
Respect max_experiments in QuantumInstance BackendV1 path (Qiskit#6391)
* 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]>
1 parent 4c79ef3 commit 9cbe14b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/python/algorithms/test_backendv1.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,20 @@ def test_run_circuit_oracle(self):
8080
result = grover.amplify(problem)
8181
self.assertIn(result.top_measurement, ["11"])
8282

83+
def test_run_circuit_oracle_single_experiment_backend(self):
84+
"""Test execution with a quantum circuit oracle"""
85+
oracle = QuantumCircuit(2)
86+
oracle.cz(0, 1)
87+
problem = AmplificationProblem(oracle, is_good_state=["11"])
88+
backend = self._provider.get_backend("fake_yorktown")
89+
backend._configuration.max_experiments = 1
90+
qi = QuantumInstance(
91+
self._provider.get_backend("fake_yorktown"), seed_simulator=12, seed_transpiler=32
92+
)
93+
grover = Grover(quantum_instance=qi)
94+
result = grover.amplify(problem)
95+
self.assertIn(result.top_measurement, ["11"])
96+
8397
def test_measurement_error_mitigation_with_vqe(self):
8498
"""measurement error mitigation test with vqe"""
8599
try:

0 commit comments

Comments
 (0)