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

Cannot submit list of circuits via AzureQuantumBackend.run #224

Open
guenp opened this issue Jan 27, 2022 · 4 comments
Open

Cannot submit list of circuits via AzureQuantumBackend.run #224

guenp opened this issue Jan 27, 2022 · 4 comments
Labels
azure-quantum enhancement New feature or request python Pull requests that update Python code qiskit A Qiskit issue

Comments

@guenp
Copy link
Contributor

guenp commented Jan 27, 2022

Currently, to submit multiple circuits, users have to submit each circuit individually, e.g.

jobs = []
for circuit in circuits:
    jobs.append(backend.run(circuit, shots=N))

results = []
for job in jobs:
    results.append(job.result())

Iterative algorithms require being able to submit a batch of circuits at the same time. There are several Qiskit libraries that depend on support for backend.run(circuits: List[QuantumCircuit]), such as qiskit-experiments and qiskit-aqua. See also: https://qiskit.org/documentation/stubs/qiskit.providers.ibmq.managed.IBMQJobManager.html#qiskit.providers.ibmq.managed.IBMQJobManager

This would require being able to submit multiple circuits and get a single job ID back to fetch the results, similar to the IBMQ experience. However, this is currently not something our service supports; Azure Quantum's Backend currently only accepts a single circuit or a list of circuits of length one, see this line: ionq.py#L70.

For instance, Tomography uses the backend.run() method under the hood which returns a single job: base_experiment.py#L345.

@guenp guenp added enhancement New feature or request help wanted Extra attention is needed azure-quantum qiskit A Qiskit issue python Pull requests that update Python code labels Jan 27, 2022
@guenp
Copy link
Contributor Author

guenp commented Jan 30, 2022

It is currently not possible to use e.g. VQEProgram because backend.run(circuit) currently only accepts a single circuit, not a list of circuits:
error_screen

@anpaz
Copy link
Member

anpaz commented Mar 26, 2022

@guenp
Adding support for job batching is a great idea, and it's on our road-map, but to be perfectly clear it is not a pre-requisite for qiskit-experiments, QAOA or VQE.

We were recently debugging the submission of StateTomography in qiskit-experiments and found that the problem was not a lack of support for job batching as the qiskit-experiment module takes care of submitting all the necessary jobs and keep track of their state; the problem was that the experiments depend on the circuit metadata to be part of the job's result object. This is fixed in #278; with this StateTomography is working correctly (albeit a couple of submission warnings for unsupported parameters).

With the change in place I've also tested the QAOA and VQE examples in qiskit-tutorials and they also ran successfully.

So, I'm thinking we should close this enhancement since the main scenarios you were trying to cover are working correctly. Thoughts?

@anpaz anpaz removed the help wanted Extra attention is needed label Mar 26, 2022
@guenp
Copy link
Contributor Author

guenp commented Mar 28, 2022

Great, glad to hear that the workaround already exists in qiskit! I'll close this issue then.

@guenp guenp closed this as completed Mar 28, 2022
@guenp
Copy link
Contributor Author

guenp commented Apr 6, 2022

After some more investigation as per @anpaz's comment above, we figured out that what is missing in the above example is not batch job support, but metadata on the submitted Jobs. This is addressed in this PR #278.
However, there is clearly value for submitting multiple circuits as part of a single Job and this is not completely addressed in the above PR, so am reopening this issue for now so we can continue the discussion. I will also rename it to more accurately describe the problem.

@guenp guenp reopened this Apr 6, 2022
@guenp guenp changed the title Qiskit integration currently does not support batch jobs Cannot submit list of circuits via AzureQuantumBackend.run Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure-quantum enhancement New feature or request python Pull requests that update Python code qiskit A Qiskit issue
Projects
None yet
Development

No branches or pull requests

2 participants