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

primitives: multi-batches jobs fail on the offline simulators #203

Open
airwoodix opened this issue Nov 26, 2024 · 0 comments
Open

primitives: multi-batches jobs fail on the offline simulators #203

airwoodix opened this issue Nov 26, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@airwoodix
Copy link
Collaborator

Information

  • Qiskit AQT provider version: 1.8.1
  • Qiskit version: 1.2.4
  • Python version: 3.12

The script:

from qiskit import QuantumCircuit
from qiskit_aqt_provider.primitives import AQTSampler
from qiskit_aqt_provider import AQTProvider

provider = AQTProvider()
backend = provider.get_backend("offline_simulator_no_noise")

qc = QuantumCircuit(1)
qc.x(0)
qc.measure_all()

sampler = AQTSampler(backend)
result = sampler.run([qc] * 200).result()

fails with

 Traceback (most recent call last):
  File "<...>/qiskit-aqt-provider/offline_simulator_sampler_batch_cut.py", line 13, in <module>
    result = sampler.run([qc] * 100).result()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<...>/qiskit-aqt-provider/.direnv/python-3.12.1/lib/python3.12/site-packages/qiskit/primitives/primitive_job.py", line 51, in result
    return self._future.result()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/ewodey/.rye/py/[email protected]/install/lib/python3.12/concurrent/futures/_base.py", line 456, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/ewodey/.rye/py/[email protected]/install/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/ewodey/.rye/py/[email protected]/install/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<...>/qiskit-aqt-provider/.direnv/python-3.12.1/lib/python3.12/site-packages/qiskit/primitives/backend_sampler.py", line 162, in _call
    result, _metadata = _run_circuits(bound_circuits, self._backend, **run_options)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<...>/qiskit-aqt-provider/.direnv/python-3.12.1/lib/python3.12/site-packages/qiskit/primitives/backend_estimator.py", line 75, in _run_circuits
    result = [x.result() for x in jobs]
              ^^^^^^^^^^
  File "<...>/qiskit-aqt-provider/qiskit_aqt_provider/aqt_job.py", line 363, in result
    self.wait_for_final_state(
  File "<...>/qiskit-aqt-provider/.direnv/python-3.12.1/lib/python3.12/site-packages/qiskit/providers/job.py", line 119, in wait_for_final_state
    status = self.status()
             ^^^^^^^^^^^^^
  File "<...>/qiskit-aqt-provider/qiskit_aqt_provider/aqt_job.py", line 294, in status
    payload = self._backend.result(uuid.UUID(self.job_id()))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<...>/qiskit-aqt-provider/qiskit_aqt_provider/aqt_resource.py", line 518, in result
    raise api_models.UnknownJobError(str(job_id))
qiskit_aqt_provider.api_client.models.UnknownJobError: 'da732bba-bd01-4fbe-8a15-2cc9b7081974'

The problem disappears if running a batch with less than the maximum batch size of 50 circuits (AQTResource.max_circuits).

The issues only affects the online simulators. Remote resources work as expected (the 200 circuits are broken down into 4 batches of 50 circuits each and the results are successfully retrieved).

@airwoodix airwoodix added the bug Something isn't working label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant