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

Copy results to python data structure inmeasure_sampler is not parallelized #2021

Closed
hhorii opened this issue Jan 3, 2024 · 0 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@hhorii
Copy link
Collaborator

hhorii commented Jan 3, 2024

Informations

  • Qiskit Aer version:
  • Python version:
  • Operating system:

What is the current behavior?

measure_sampler has big sequential part though sampling is parallelized.

for (int_t i = all_samples.size() - 1; i >= 0; i--) {
creg.initialize(num_memory, num_registers);
// process memory bit measurements
for (const auto &pair : memory_map) {
creg.store_measure(reg_t({all_samples[i][pair.second]}),
reg_t({pair.first}), reg_t());
}
// process register bit measurements
for (const auto &pair : register_map) {
creg.store_measure(reg_t({all_samples[i][pair.second]}), reg_t(),
reg_t({pair.first}));
}
// process read out errors for memory and registers
for (const Operations::Op &roerror : roerror_ops)
creg.apply_roerror(roerror, rng);
// Save count data
if (save_creg_to_state)
state.creg() = creg;
else
result.save_count_data(creg, save_creg_memory_);
}

Steps to reproduce the problem

from qiskit_aer import AerSimulator
from qiskit.circuit.library import QuantumVolume
from qiskit import transpile

simulator = AerSimulator()
c = QuantumVolume(20)
c.h(c.qubits[:])
c.measure_all()

c = transpile(c, simulator)

for shots in [10, 100, 1000, 10000, 100000, 1000000, 10000000]:
    res = simulator.run(c, shots=shots).result()
    print("shots=", shots, res.metadata)

Most of execution time of shots==10000000 is serial execution.

What is the expected behavior?

Most of sampling should be parallelized.

Suggested solutions

Parallelize the above codes.

@hhorii hhorii added the bug Something isn't working label Jan 3, 2024
@doichanj doichanj self-assigned this Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants