I'm running QAOA with a large number of qubits (64 qubits), and I'm having some issue getting the job to progress. I've tried a few different simulators, but I'm not sure how to tune the settings to make this run.

I tried aer_simulator_matrix_product_state, since my problem involves fewer than 100 qubits. (I'm not sure how to tell if it involves non-weakly-entangled states- maybe someone can help me with that?).

However, the following line hangs and doesn't show any sign of progress, even for a single shot:

execute(qc, backend, shots=1).result().get_counts()

What could be causing this to hang for even a single shot? I tried allocating more memory via the options below. Is there anything else I can change?


backend = Aer.get_backend('aer_simulator_matrix_product_state') 


qaoa = QAOA(sampler=BackendSampler(backend, options={'max_memory_mb':10000000}), optimizer=NELDER_MEAD(maxiter=maxiter), reps=p) 

meo = MinimumEigenOptimizer(qaoa) 

result = meo.solve(qp) 

Two related links:

Memory Requirements for Qiskit Aer Simulator

How much memory is required to simulate a 48-qubit circuit?


3 Answers 3


The MPS simulator has a parameter 'mps_log_data' that when set to 'True' stores the bond dimensions, after every operation, into the result.metadata. The bond dimensions represent the entanglement between every two consecutive qubits. The simulator will become exponentially slower as the bond dimensions grow. The bond dimensions are abbreviated as 'BD' in the output. Here is a simple example:

from qiskit_ibm_provider import IBMProvider
from qiskit import QuantumCircuit
import numpy as np

provider = IBMProvider()
backend = provider.get_backend("simulator_mps")
qc = QuantumCircuit(4, 4)
for i in range(1, 3):
job = backend.run(qc, mps_log_data=True)

For more information, see https://qiskit.org/documentation/tutorials/simulators/7_matrix_product_state_method.html.

  • $\begingroup$ Wow that's super useful. Let me try that and get back to you. Thanks. $\endgroup$
    – somewhere
    Commented May 28, 2023 at 17:11
  1. I see that you're using execute, which I think is deprecated. This implies that you may be using an old version.
  2. The number of shots is not relevant. If all the measurements in your circuit are at the end, then the circuit is simulated once for all the shots, and sampled in the end.
  3. If there's a lot of entanglement in your 64Q circuit then the MPS simulator will not be able to simulate it.
  • $\begingroup$ How can I tell if there is a lot of entanglement? Is it just based on the number of multi-qubit gates? Or the non-locality of the corresponding unitary operators? What is a proper way to quantify this in a circuit setting? $\endgroup$
    – somewhere
    Commented May 27, 2023 at 18:13

It is based on the multi-qubit gates. The MPS internal structure is linear, so that multi-qubit gates between gates that are not adjacent will add a swap, which is also a multi-qubit gate. When you look at the metadata, you will see that the numbers inside BD=[] will grow as the circuit becomes deeper. The numbers represent the sizes of internal matrices, so obviously, when the numbers increase, the simulator becomes inefficient.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.