I would like to know (and ideally select) which blas implementation is used by numpy
.
On my system I have openblas
and blis
installed system wide. For numpy I created a new virtual environment and compiled numpy from source. Then I open python, import numpy and run numpy.show_config()
, as suggested in answer.
blas_mkl_info:
NOT AVAILABLE
blis_info:
libraries = ['blis', 'blis']
library_dirs = ['/usr/lib64']
define_macros = [('HAVE_CBLAS', None)]
include_dirs = ['/usr/local/include', '/usr/include', '/home/wichmann/pythontests/blis_numpy/include']
language = c
blas_opt_info:
libraries = ['blis', 'blis']
library_dirs = ['/usr/lib64']
define_macros = [('HAVE_CBLAS', None)]
include_dirs = ['/usr/local/include', '/usr/include', '/home/wichmann/pythontests/blis_numpy/include']
language = c
lapack_mkl_info:
NOT AVAILABLE
openblas_lapack_info:
libraries = ['openblas', 'openblas']
library_dirs = ['/usr/lib64']
language = c
define_macros = [('HAVE_CBLAS', None)]
lapack_opt_info:
libraries = ['openblas', 'openblas']
library_dirs = ['/usr/lib64']
language = c
define_macros = [('HAVE_CBLAS', None)]
However, this only shows against which blas implementations numpy was linked and not which are used during runtime. I also dug a bit deeper and used ldd
, to no avail. In my virtual environment for blis_numpy/lib/python3.8/site-packages/numpy-1.19.0.dev0+8b81727-py3.8-linux-x86_64.egg/numpy/linalg/_umath_linalg.cpython-38-x86_64-linux-gnu.so
I get
linux-vdso.so.1 (0x00007ffc68bce000)
libopenblas.so.0 => /lib64/libopenblas.so.0 (0x00007fd678cc5000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd678ca3000)
libc.so.6 => /lib64/libc.so.6 (0x00007fd678ad9000)
libm.so.6 => /lib64/libm.so.6 (0x00007fd678993000)
libgfortran.so.5 => /lib64/libgfortran.so.5 (0x00007fd6786cb000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd67afe1000)
libquadmath.so.0 => /lib64/libquadmath.so.0 (0x00007fd678681000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fd678664000)
and for blis_numpy/lib/python3.8/site-packages/numpy-1.19.0.dev0+8b81727-py3.8-linux-x86_64.egg/numpy/core/_multiarray_umath.cpython-38-x86_64-linux-gnu.so
I get
linux-vdso.so.1 (0x00007ffff2da9000)
libblis.so.2 => /lib64/libblis.so.2 (0x00007fd4b62b3000)
libm.so.6 => /lib64/libm.so.6 (0x00007fd4b616d000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd4b614b000)
libc.so.6 => /lib64/libc.so.6 (0x00007fd4b5f81000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd4b73d3000)
librt.so.1 => /lib64/librt.so.1 (0x00007fd4b5f76000)
So will numpy use openblas
or blis
? Or both, depending on the function used? Mostly I am interested in which path numpy.linalg.eigvalsh
takes, as I have the hope that one implementation or the other might be a bit faster.