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?
2 Answers
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 :)
- 2,695
- 6
- 25
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.
- 595
- 2
- 11