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 for PrimitivesV2 #2078

Closed
1ucian0 opened this issue Feb 29, 2024 · 7 comments
Closed

Support for PrimitivesV2 #2078

1ucian0 opened this issue Feb 29, 2024 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@1ucian0
Copy link
Member

1ucian0 commented Feb 29, 2024

The primitives in qiskit_aer/primitives implement qiskit_aer.primitives.sampler.Sampler and qiskit_aer.primitives.estimator.Estimator that are subclassing qiskit.primitives.base.base_sampler.BaseSamplerV1 and qiskit.primitives.base.base_estimator.BaseEstimatorV1. With the introduction of BaseSamplerV2 and BaseEstimatorV2, it would be great to have qiskit_aer.primitives.sampler.SamplerV2 and and qiskit_aer.primitives.estimator.EstimatorV2.

@1ucian0 1ucian0 added the enhancement New feature or request label Feb 29, 2024
@ikkoham
Copy link
Collaborator

ikkoham commented Feb 29, 2024

I implemented EstimatorV2Converter Qiskit/qiskit#11899. It may be useful for EstimatorV2.
Unfortunately, it is not possible to implement SamplerV2Converter because result data are completely different.
But, there are no advantages for SamplerV2 because simulator specific improvement does not exist. BackendSamplerV2 + AerSimulator is good choice.

@kevinsung
Copy link

In qiskit-ibm-runtime 0.22, there will be a "local testing mode". So if we add SamplerV2 here in Aer, it seems there will be two ways to do the same thing:

  • Use SamplerV2 from Aer
  • Use SamplerV2 from qiskit-ibm-runtime, with an Aer backend.

In general, should we recommend one over the other? I'm thinking from a documentation perspective.

@kevinsung
Copy link

Ah, one difference I noticed is that EstimatorV2 might support approximation=True to get a result without statistical sampling error.

@kielpins-qctrl
Copy link

kielpins-qctrl commented Mar 25, 2024

@ikkoham

But, there are no advantages for SamplerV2 because simulator specific improvement does not exist.

I primarily use Aer as a way to test code for circuit design before deploying to QPUs. Since the recent changes in qiskit-ibm-runtime behaviour, I must use SamplerV2 on IBM QPUs in order to retrieve bitstrings. Analysis of the results requires a consistent interface, so without SamplerV2 and its associated Result format, Aer is not usable for me.

@garrison
Copy link
Member

I primarily use Aer as a way to test code for circuit design before deploying to QPUs. Since the recent changes in qiskit-ibm-runtime behaviour, I must use SamplerV2 on IBM QPUs in order to retrieve bitstrings.

You might want to look at the guide to using SamplerV2 from qiskit-ibm-runtime in local mode, with AerSimulator as backend, after upgrading to qiskit-ibm-runtime 0.22.0 or later: https://docs.quantum.ibm.com/api/migration-guides/local-simulators#aersimulator

@kielpins-qctrl
Copy link

@garrison Thanks for flagging this. I was able to successfully run that migration guide. However, the circuit metadata is still absent from the result object, in the same way that I reported for fake backends. Due to this inconsistency with results from real QPUs, I'm no longer able to mock QPU runs with AerSimulator for testing.

@doichanj doichanj self-assigned this Mar 26, 2024
@ikkoham
Copy link
Collaborator

ikkoham commented Mar 26, 2024

EstimatorV2 here #2088

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants