# Which qiskit backend is faster in execution of the quantum circuit prepared?

I have a quantum circuit of 40 qubits with mutliple gate operations being applied to many of the qubits. Currently I am using qasm simulator which for shots=1 took 10 hour of time. Is there any other backend which can execute my circuit faster or is there any other process through which I can speed up my execution?

• You actually simulate 40 qubits on your local machine? That is pretty impressive... Apr 8 '21 at 15:50
• I have 16gb ram and i7 10th gen processor. It worked somehow. Apr 8 '21 at 15:57
• Your computer is probably using swap memory: it's using your harddrive as RAM to store the statevector. A HDD is many orders of magnitude slower than RAM, so this is why it took so long to do that single shot. Apr 8 '21 at 23:02

I can think of several ways to work with that many qubits.

First, via the simulators of Aer, by using the matrix product state simulation method for example.
The main idea is to write the statevector so that, as written in the tutorial, "the size of the overall structure remains ‘small’ for circuits that do not have ‘many’ two-qubit gates. This allows much more efficient operations in circuits with relatively ‘low’ entanglement."

from qiskit.providers.aer import AerSimulator
# Select the AerSimulator from the Aer provider
simulator = AerSimulator(method='matrix_product_state')


There are other simulation methods possible, see all of them here

Another solution would be to explore all the recent simulators of the cloud, all explained here, I advisee you to read all of this, you might find your happiness. You can see that for simulator_mps, simulator_extended_stabilizer and simulator_stabilizer you can use more qubits than the recurrent 32 of the "classical" qasm_simulator, with some conditions on each as you can see.
Just bear in mind that since they are simulators on the cloud, it might take a little more time that the local simulator, but I think it would still be gained time in comparison to what you actually have.

Hope that with this, your circuit will run just fine! Good luck :)

• This is a good answer. Just noting that the stabilizer and extended stabilizer methods are available also locally, by setting the method parameter of AerSimulator to stabilizer and extended_stabilizer. Apr 9 '21 at 11:09
• @YaelBen-Haim indeed I'll add it to the answer, thanks for the comment!
– Lena
Apr 9 '21 at 12:19

I am confident that you cannot simulate 40 qubits full-statevector on your 16GB RAM. For a 40 qubit simulation, you would require a RAM of 16TB, not GB. So I would strongly suggest checking your circuit.

I cannot speak for how Qiskit works under the hood, but usually, all simulators sample from the underlying statevector, and there is no way to store the statevector of a 40 qubit circuit in 16GB RAM.

IBM offers their qasm simulator through the cloud, which can do up to 32 qubits. You may want to try that if you are looking to speed things up.

• There is a rich world of simulation algorithms, working with a variety of data structures, not necessarily the statevector. For example, the memory required by the matrix product state simulator depends on the level of entanglement in the circuit; if it is low then many qubits are possible, much more than 40. The stabilizer (Clifford) simulator is polynomial in the number of qubits, but is limited to a very strict family of circuits. Apr 9 '21 at 11:14
• @YaelBen-Haim Yes, that is illuminating information for me, thank you :) Apr 9 '21 at 17:41