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

Support SamplerV2 #488

Closed
caleb-johnson opened this issue Feb 13, 2024 · 5 comments · Fixed by #507
Closed

Support SamplerV2 #488

caleb-johnson opened this issue Feb 13, 2024 · 5 comments · Fixed by #507
Assignees
Labels
cutting QPD-based circuit cutting code
Milestone

Comments

@caleb-johnson
Copy link
Collaborator

caleb-johnson commented Feb 13, 2024

The circuit cutting post-processing uses the SamplerResult objects output from SamplerV1 directly; however, SamplerV2 will return PrimitiveResult objects, so our post-processing should support both types of outputs from the two different sampler interfaces

https://github.com/Qiskit/qiskit/blob/61181ce0681129f9a1d5af43122484f8b6da1bbc/qiskit/primitives/base/base_sampler.py#L231

@garrison garrison added the cutting QPD-based circuit cutting code label Mar 6, 2024
@garrison
Copy link
Member

garrison commented Mar 12, 2024

Tracking issue from Qiskit Aer to support primitives V2: Qiskit/qiskit-aer#2078

EDIT: Actually, there's no reason to wait on Aer to add support for primitives V2, but we might want to wait on Aer before we adopt the new primitives entirely. I've opened #503 as a follow up to this issue for that reason.

@garrison
Copy link
Member

Actually (reversing course a second time), it seems like we do indeed need to wait for Aer to support SamplerV2 if we are to provide automated tests of this feature, because Qiskit's implemention throws an error: "StatevectorSampler cannot handle mid-circuit measurements". Unless, of course, we want to provide our own BaseSamplerV2 implementation based on our simulation.py -- but I think we are better off waiting on Aer.

@garrison
Copy link
Member

it seems like we do indeed need to wait for Aer to support SamplerV2 if we are to provide automated tests of this feature

Then again, we can provide a smoke test by only executing the circuits that do not contain any mid-circuit measurements. This might be worth doing, as long as we also manually test the code using Qiskit Runtime.

@garrison
Copy link
Member

An alternative would be to use BackendSamplerV2 together with AerSimulator, as suggested at Qiskit/qiskit-aer#2078. But this would mean waiting for Qiskit 1.1 (which is when BackendSamplerV2 will first appear in a release) and will also require a fix to Qiskit/qiskit#12043.

garrison added a commit that referenced this issue Mar 19, 2024
@garrison garrison mentioned this issue Mar 19, 2024
4 tasks
garrison added a commit that referenced this issue Mar 25, 2024
* Add support for `SamplerV2`

Fixes #488

* Use qiskit branch with fixed `BackendSamplerV2`

* Bump qiskit-aer version; restore qiskit version bounds

* Update pyproject.toml

* Update pyproject.toml

* Update pyproject.toml

* Bump nbmake minimum version

nbmake < 1.4.3 depends on pydantic < 2.0 (see
treebeardtech/nbmake#109), but
qiskit-ibm-runtime implicitly requires pydantic > 2.5
(see Qiskit/qiskit-ibm-runtime#1539).

* Revert "Update pyproject.toml"

This reverts commit b4de1c2.

* Update README, pyproject.toml

* Mark SamplerV2 branch as `pragma: no cover`

This annotation can be removed once qiskit 1.1 is released

* Updates

* Tweak release note
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cutting QPD-based circuit cutting code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants