You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: it use more than 600MB, when i just import numpy #28565
I import numpy, just using it in a simple way, or not using it at all. At the beginning, the program only occupies around 20MB of memory, but after a while, the memory usage suddenly spikes to around 600MB, occasionally.
help!
This is presumably some openblas warmup, although I wouldn't be surprised if openblas is nice about it (does it use that much memory even if it isn't free/you have massively more?).
Also as the question may already say: This would be heavily dependent on the system (e.g. scale with the number of cores and likely more. Openblas has 20 threads there, but your "minimal system" likely does not run with so many cores.)
CC @mattip I feel you messed with settings before in libscipy_openblas to keep this under control a bit (and may know more anyway).
@melissawm yes, it's related. But here it is clear that we are using the openblas that is packaged with NumPy, while in the other issue, I think it is likely the BLAS wasn't shipped with NumPy, so NumPy has no control at all.
Activity
charris commentedon Mar 21, 2025
What cpu do you have?
cmyf123 commentedon Mar 21, 2025
eendebakpt commentedon Mar 21, 2025
How did you measure the memory usage? And does the issue also occur if you remove the numpy import?
seberg commentedon Mar 21, 2025
This is presumably some openblas warmup, although I wouldn't be surprised if openblas is nice about it (does it use that much memory even if it isn't free/you have massively more?).
Also as the question may already say: This would be heavily dependent on the system (e.g. scale with the number of cores and likely more. Openblas has 20 threads there, but your "minimal system" likely does not run with so many cores.)
CC @mattip I feel you messed with settings before in
libscipy_openblasto keep this under control a bit (and may know more anyway).melissawm commentedon Mar 21, 2025
Could this be related to #19145?
seberg commentedon Mar 21, 2025
@melissawm yes, it's related. But here it is clear that we are using the openblas that is packaged with NumPy, while in the other issue, I think it is likely the BLAS wasn't shipped with NumPy, so NumPy has no control at all.
mattip commentedon Mar 23, 2025
OpenBLAS reservces memory per thread at startup. You can set the envirnment variable
OPENBLAS_NUM_THREADSto a low number before starting pythonor use threadpoolctl to restrict the number of threads used, which will reduce the memory usage. Please let us know if this helps.
ngoldbaum commentedon Mar 28, 2025
Please let us know if @mattip's suggestions don't help.