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

Re-examine the threshold deciding which algorithm to use for sample_measure in MPS #944

Closed
merav-aharoni opened this issue Sep 21, 2020 · 2 comments · Fixed by #994
Closed
Labels
bug Something isn't working
Milestone

Comments

@merav-aharoni
Copy link
Contributor

Informations

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

What is the current behavior?

For a simple circuit creating an EPR state and measure 100 shots, a user measured time_taken is 42sec for 23 qubits, 88sec for 24qubits, 207sec for 25qubits, 510sec for 26qubits and 0.2sec for 27 qubits. Also 0.3sec for 28qubits .

Steps to reproduce the problem

import numpy as np
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import Aer, execute
from qiskit.providers.aer import QasmSimulator

simulator = Aer.get_backend('qasm_simulator')
backend_opts = {'method':"matrix_product_state"}
#backend_opts = {'method':"statevector"}
num_qubits = 25


qr = QuantumRegister(num_qubits)
cr = ClassicalRegister(num_qubits)
circ = QuantumCircuit(qr, cr)

circ.h(0)
for i in range(0, num_qubits-1):
    circ.cx(i, i+1)
circ.measure(qr, cr)
job_sim = execute([circ], QasmSimulator(), backend_options= backend_opts, shots=100 )
result = job_sim.result()
print("Time taken: {} sec".format(result.time_taken))
result.get_counts()

When we add the option:
'mps_sample_measure_qubits_opt':20, we get the expected performance.

What is the expected behavior?

The default value for this parameter should give the optimal performance.

Suggested solutions

Re-examine the default values for this parameter and also for mps_sample_measure_shots_opt.

@merav-aharoni merav-aharoni added the bug Something isn't working label Sep 21, 2020
@merav-aharoni
Copy link
Contributor Author

Also add documentation for these thresholds in qasm_simulator.py.

@chriseclectic chriseclectic added this to the Aer 0.7 milestone Sep 22, 2020
@merav-aharoni
Copy link
Contributor Author

merav-aharoni commented Oct 14, 2020

I am running experiments to define better thresholds to decide between the two algorithms for sample_measure. The experiments include 3 parameters: number of qubits, number of shots, max bond dimension.
Here are the results for bond dimension <= 2.
graph for sample_measure

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

Successfully merging a pull request may close this issue.

2 participants