Repository navigation
Description
Describe the issue:
I believe it's related to:
#17856 - numpy aborts on import due to OpenBLAS using too much memory
#19145 - Just importing numpy makes python process commit 3+GB of memory
I have a Python environment on Win10 x64, setup with conda and all packages installed from conda-forge and am struggling with very large memory commit when I import numpy:
import numpy as npThe commit memory (not allocated) jumps from few MB to 4.3 GB (PC has 12 cores). It is reproducible on multiple machines (different Win10 versions on Intel and AMD). Based on the experimenting with env variable each threads commits approximately 350 MB of memory.
Investigation
After a lot of searching, I found that the issue can be bypassed (but with a performance penalty) if I set OPENBLAS_NUM_THREADS=1 environment variable. A lot of threads is something I saw in the Process Explorer (SysInternals) and it led me to narrow down the issue to numpy and blas. The initial issue started with Spyder starting 4 processes committing a lot more of memory causing various apps to crash.
This doesn't happen with numpy version from pip nor MKL conda-forge package.
If I simply dump pip package it in the same env (not healthy but in light of testing) the issue is resolved. But other libraries can cause the same issue (tested only with Spyder).
Reproduce the code example:
Win10 x64, different version and conda using used latest, 3 years old and something in between.
Tested on Intel and AMD machines.
# Both numpy and python latest
conda create -n nptest python=3.11.4
conda activate nptest # activate new env
conda install conda-forge::numpy=1.25.2 "blas=*=openblas"import numpy as npCommit memory increased by 4 G.
### Error message:
_No response_
### Runtime information:
[{'numpy_version': '1.25.2',
'python': '3.11.4 | packaged by Anaconda, Inc. | (main, Jul 5 2023, '
'13:47:18) [MSC v.1916 64 bit (AMD64)]',
'uname': uname_result(system='Windows', node='TORNADO', release='10', version='10.0.19045', machine='AMD64')},
{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2'],
'not_found': ['AVX512F',
'AVX512CD',
'AVX512_SKX',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL']}}]
# packages in environment
#
# Name Version Build Channel
blas 2.118 openblas conda-forge
blas-devel 3.9.0 18_win64_openblas conda-forge
bzip2 1.0.8 he774522_0
ca-certificates 2023.7.22 h56e8100_0 conda-forge
libblas 3.9.0 18_win64_openblas conda-forge
libcblas 3.9.0 18_win64_openblas conda-forge
libffi 3.4.4 hd77b12b_0
libflang 5.0.0 h6538335_20180525 conda-forge
liblapack 3.9.0 18_win64_openblas conda-forge
liblapacke 3.9.0 18_win64_openblas conda-forge
libopenblas 0.3.24 pthreads_hc140b1d_0 conda-forge
llvm-meta 5.0.0 0 conda-forge
m2w64-gcc-libgfortran 5.3.0 6 conda-forge
m2w64-gcc-libs 5.3.0 7 conda-forge
m2w64-gcc-libs-core 5.3.0 7 conda-forge
m2w64-gmp 6.1.0 2 conda-forge
m2w64-libwinpthread-git 5.0.0.4634.697f757 2 conda-forge
msys2-conda-epoch 20160418 1 conda-forge
numpy 1.25.2 py311h0b4df5a_0 conda-forge
openblas 0.3.24 pthreads_h3721920_0 conda-forge
openmp 5.0.0 vc14_1 conda-forge
openssl 3.1.2 hcfcfb64_0 conda-forge
pip 23.2.1 py311haa95532_0
python 3.11.4 he1021f5_0
python_abi 3.11 2_cp311 conda-forge
setuptools 68.0.0 py311haa95532_0
sqlite 3.41.2 h2bbff1b_0
tk 8.6.12 h2bbff1b_0
tzdata 2023c h04d1e81_0
ucrt 10.0.22621.0 h57928b3_0 conda-forge
vc 14.2 h21ff451_1
vc14_runtime 14.36.32532 hfdfe4a8_17 conda-forge
vs2015_runtime 14.36.32532 h05e6639_17 conda-forge
wheel 0.38.4 py311haa95532_0
xz 5.4.2 h8cc25b3_0
zlib 1.2.13 h8cc25b3_0
Context for the issue:
No response
UPDATE:
- Linked another issue
- Added pinned versions
- Spelling and clarification
Activity
rgommers commentedon Sep 6, 2023
This indeed seems a duplicate of gh-19145. Any reason you see that that's not the same issue? If not, I propose we close this as a duplicate.
jakakonda commentedon Sep 6, 2023
I found #19145 after posting an issue and continued with the investigation. I initially started from #17856
I am happy to move my description there if needed and we can close this one as a dup.
rgommers commentedon Sep 6, 2023
Great, thanks for confirming. Yes, please move your comment there. I'll tag this one as a duplicate now and close it.