-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add run_options option and support for processing level 1 data to BackendSamplerV2 #13357
Conversation
One or more of the following people are relevant to this code:
|
These changes were needed to get the qiskit-experiments tests to pass in this PR that moves all circuit execution from
|
Pull Request Test Coverage Report for Build 11599154700Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
…erV2 This change adds support to the `BackendSamplerV2` class so that it will pass through the `meas_level`, `meas_return`, and `noise_model` options passed to it through to the underlying `BackendV2`'s `run()` method. For the sake of compatibility with backends that might not expect those options, it does not pass default values for them (like the previously defined options for the class) if the default `None` value is not overridden. Additionally, to support `meas_level=1`, the results processing code checks the `meas_level` option and handles `meas_level=1` data appropriately, rather than always assuming the returned data is level 2.
a0761a8
to
58bbf65
Compare
Qiskit/qiskit-ibm-runtime#1990 tries to make use of this change to translate between the IBM Quantum SamplerV2 options and common |
Is it possible to add some tests using |
There is not much support built in for testing with |
run_options is a dict passed on to backend.run as it is for SamplerV2 in qiskit-aer.
All of the backend primitives use the same helper function for calling `backend.run` and this function has been clearing metadata because the estimator primitives can add large objects to the metadata that payload large for running the circuits on a remote service. In some cases, it is helpful to have the circuit metadata make it to the `backend.run` call. Since the concern about large metadata entries should not affect the sampler case, an option is added here to skip clearing the metadata and `BackendSamplerV2` is updated to use this option.
I added a simple test and also addressed the other points I had commented on in the way that works best for my case, but we can revisit them if those changes are a problem. |
Is this still on track for |
On my end, I think it is ready for review, so it would be great if it could still make 1.3. |
Thank you for adding tests. It looks good overall. You don't have to add a test with a real device, but I would like to confirm that it works fine with real devices. Have you tested it yet? |
My main interest is in using |
Thank you for sharing a result with a real device. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This change adds support to the
BackendSamplerV2
class so that it will accept arun_options
dict option and pass its content through to the underlyingBackendV2
'srun()
method.Additionally, to support
meas_level=1
, the results processing code checks for ameas_level
option inside ofrun_options
and handlesmeas_level=1
data appropriately when it is set, rather than always assuming the returned data is level 2.Finally, the behavior of
BackendSamplerV2
was changed so that it does clear theQuantumCircuit.metadata
of its input circuits before passing them on tobackend.run
like it did previously.