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

Improve performance of sampler experiment #1935

Merged
merged 8 commits into from
Sep 26, 2023

Conversation

ikkoham
Copy link
Collaborator

@ikkoham ikkoham commented Sep 12, 2023

Summary

Same idea with #1840

Details and comments

Benchmark code:

import numpy as np

from qiskit.circuit.library import EfficientSU2
from qiskit_aer.primitives import Sampler

rng = np.random.default_rng(15)

qc = EfficientSU2(3)
qc.measure_all()

num_circuits = 1000
sampler = Sampler()
parameter_values = rng.random((num_circuits, qc.num_parameters))
circuits = [qc] * num_circuits

%timeit sampler.run(circuits, parameter_values).result()

0.12.2: 716 ms ± 1.3 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
This PR: 534 ms ± 4.33 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

@ikkoham ikkoham marked this pull request as ready for review September 13, 2023 02:33
Copy link
Collaborator

@doichanj doichanj left a comment

Choose a reason for hiding this comment

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

I confirm this PR will improve performance with runtime parameter binding #1901

@doichanj doichanj added the performance Performance improvements label Sep 13, 2023
@doichanj doichanj added this to the Aer 0.13.0 milestone Sep 13, 2023
@doichanj doichanj merged commit 23488b9 into Qiskit:main Sep 26, 2023
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants