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

Fix from backend of V2 primitives to use existing AerSimulator #2173

Merged
merged 8 commits into from
Jul 8, 2024

Conversation

doichanj
Copy link
Collaborator

@doichanj doichanj commented Jun 12, 2024

Summary

This PR fixes EstimatorV2.from_backend and SamplerV2.from_backend to use pre-defined AerSimulator for simulation

Details and comments

With this fix, user can define specific simulator object with backend options instead of passing options for V2 primitives.

for example, following script can use AerSimulator with statevector simulation and with noise model

sim = AerSimulator(method="statevector", noise_model=noise_model)
estimator = EstimatorV2.from_backend(sim)

This PR fixes from_backend that initialized backend object by calling AerSimulator.from_backend but when input backend is AerSimulator just copy it.

@doichanj doichanj added Changelog: Bugfix Include in the Fixed section of the changelog stable-backport-potential The issue or PR might be minimal and/or import enough to backport to stable labels Jun 12, 2024
@@ -130,6 +133,7 @@ def _run_pub(self, pub: EstimatorPub) -> PubResult:
result = self._backend.run(
circuit, parameter_binds=[parameter_binds], **self.options.run_options
).result()
print(result)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is for debugging?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to delete this one

@doichanj doichanj added this to the Aer 0.15.0 milestone Jun 25, 2024
@doichanj doichanj merged commit 9fe6be7 into Qiskit:main Jul 8, 2024
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the Fixed section of the changelog stable-backport-potential The issue or PR might be minimal and/or import enough to backport to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants