-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Memory usage grows quickly with circuit depth #6991
Comments
This is another report, in Qiskit Slack workspace, of what seems to be the same as above https://qiskit.slack.com/archives/CJG2E9LQP/p1630389855041400 I will also note I started to investigate a problem report with a chemistry problem where the process is simply killed after a while (as I assume it runs out of memory) before it even does a single energy evaluation with VQE. Its a 12 qubit problem and while it works with statevector and Aer simulator with snapshot instruction, it does not, and is killed, when using qasm/aer_simulator (whether BasicAer or Aer). The former will run one circuit though, versus multiple circuits for qasm. I feel sure we were able to do this in the past, as 12 qubits corresponds to LiH in minimal basis with no reductions, but its been a while. If I find out any more information regarding the process being killed, and its directly relevant, I'll update things here accordingly. The report again was from Qiskit Slack https://qiskit.slack.com/archives/CB6C24TPB/p1631104246170900 |
Also see #5895 |
A fix for |
I'm going to close this issue as complete for the same reasons as #5895 (#5895 (comment)) as the memory consumption should be greatly reduced now. If I'm missing something or you feel there is more to discuss on this, please feel free to reopen this issue. |
Information
qiskit 0.29.0
qiskit-aer 0.8.2
qiskit-aqua 0.9.4
qiskit-ibmq-provider 0.16.0
qiskit-ignis 0.6.0
qiskit-machine-learning 0.2.1
qiskit-terra 0.18.1
Python 3.7.11 :: Intel Corporation
CentOS Linux 7
What is the current behavior?
The memory requirements grown unexpectedly (unreasonably?) quickly with the circuit depth. As the circuit depth is varied, the qubit count stays fixed. I assume this issue is due to some inefficiency in transpiler, since according to the trace the function that runs out of memory is
QuantumInstance.traspile
. This is undesirable as many use cases (e.g.QuantumKernel
class) require evaluating very large numbers of circuits.Steps to reproduce the problem
To run:
Output:
mprof
trace:Here the black line corresponds to
reps=2
, blue line toreps=6
and red line toreps=10
(crashed, presumably due to running out of memory; I confirmed that the memory was the issue by watchinghtop
, though for some reason it the end of the run right before crash does not show up on the trace)What is the expected behavior?
Memory requirements stay reasonable.
Suggested solutions
A potential solution could be batching of circuits. For example, if simulator receives 10^6 circuits, they are transpiled and evaluated in chunks of 10^3, with intermediate results saved and circuits discarded.
The text was updated successfully, but these errors were encountered: