Open eldar-mustafayev opened 2 years ago
Hello @eldar-mustafayev
Thanks for reporting :) The plugin reports memory used in MB. I just tried it with your snippet (thanks for providing it btw!)
Here are the results:
bash $> sqlite3 .pymon
sqlite> select TOTAL_TIME, USER_TIME, KERNEL_TIME, MEM_USAGE, CPU_USAGE, ITEM, ITEM_PATH from TEST_METRICS where ITEM_PATH = 'pkg1.test_mb';
TOTAL_TIME|USER_TIME|KERNEL_TIME|MEM_USAGE|CPU_USAGE|ITEM|ITEM_PATH
0.00799322128295898|0.018202272|0.004366944|13.4453125|2.82354450115326|test_extension|pkg1.test_mb
As you can see, your function consumes 13MB. This includes: namespaces, imports and datas. I think you just got confused with the unit size for memory report.
I let you close, unless I misunderstood your problem or something else lies beneath this issue :)
Hi @js-dieu. Thanks for the reply. Actually it's quite interesting, because I am still getting a result lower than 1 MB. What do you think about that? What am I doing wrong?
(venv) [root@vultr ~]# sqlite3 .test
SQLite version 3.36.0 2021-06-18 18:36:39
Enter ".help" for usage hints.
sqlite> select TOTAL_TIME, USER_TIME, KERNEL_TIME, MEM_USAGE, CPU_USAGE, ITEM, ITEM_PATH from TEST_METRICS where ITEM_PATH = 'pkg1.test_mb';
0.209692239761353|0.16|0.02|0.53125|0.858400865024167|test_extension|pkg1.test_mb
Hello @eldar-mustafayev
Something lies in your environment and yet ... it remains unexplained :) Can you print the output of the following lines (in the environment you use to obtain such results!)
import numpy as np
np.show_config()
Also, if you can make a strace of the pytest run (with only that test) it would be for sure usefull...
Hello @js-dieu . Thanks for help, I printed logs you asked for. Hope, this will be helpful. :)
Pytest trace:
(venv) [root@vultr ~]# export PYTHONPATH="$(pwd)/module" && pytest module/pkg1/test_mb.py --db .test
============================= test session starts ==============================
platform linux -- Python 3.8.6, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
rootdir: /root/project, configfile: pyproject.toml
plugins: xdist-2.3.0, typeguard-2.12.1, asyncio-0.15.1, forked-1.3.0, monitor-1.6.2, parallel-0.1.0, json-report-1.2.4, cov-2.11.0, metadata-1.11.0
collected 1 item
module/pkg1/test_mb.py . [100%]
Numpy configs:
blas_info:
libraries = ['cblas', 'blas', 'cblas', 'blas']
library_dirs = ['/root/miniconda3/envs/venv/lib']
include_dirs = ['/root/miniconda3/envs/venv/include']
language = c
define_macros = [('HAVE_CBLAS', None)]
blas_opt_info:
define_macros = [('NO_ATLAS_INFO', 1), ('HAVE_CBLAS', None)]
libraries = ['cblas', 'blas', 'cblas', 'blas']
library_dirs = ['/root/miniconda3/envs/venv/lib']
include_dirs = ['/root/miniconda3/envs/venv/include']
language = c
lapack_info:
libraries = ['lapack', 'blas', 'lapack', 'blas']
library_dirs = ['/root/miniconda3/envs/venv/lib']
language = f77
lapack_opt_info:
libraries = ['lapack', 'blas', 'lapack', 'blas', 'cblas', 'blas', 'cblas', 'blas']
library_dirs = ['/root/miniconda3/envs/venv/lib']
language = c
define_macros = [('NO_ATLAS_INFO', 1), ('HAVE_CBLAS', None)]
include_dirs = ['/root/miniconda3/envs/venv/include']
Supported SIMD extensions in this NumPy install:
baseline = SSE,SSE2,SSE3
found = SSSE3,SSE41,POPCNT,SSE42,AVX,F16C,FMA3,AVX2,AVX512F,AVX512CD,AVX512_SKX
not found = AVX512_KNL,AVX512_KNM,AVX512_CLX,AVX512_CNL,AVX512_ICL
Thanks for reporting @eldar-mustafayev
However, I was refering to strace
program which can trace all sys calls from an executable, not the log of pytest. Can you do the necessary ?
Sorry for late response. I hope this will help to identify the problem: trace.txt
The bug In the function below the plugin calculated that memory usage is less than one MB. However, when I print the actual size of the array it is between 7 and 8 MB. I assume it is related to the
memory_profiler
, because I experienced similar result when using it.Desktop: