blas
MatLab error: cannot open with static TLS
That’s bug no 961964 of MATLAB known since R2012b (8.0). MATLAB dynamically loads some libs with static TLS (thread local storage, e.g. see gcc compiler flag -ftls-model). Loading too many such libs => no space left. Until now mathwork’s only workaround is to load the important(!) libs first by using them early (they suggest to … Read more
Find out if/which BLAS library is used by Numpy
numpy.show_config() doesn’t always give reliable information. For example, if I apt-get install python-numpy on Ubuntu 14.04, the output of np.show_config() looks like this: blas_info: libraries = [‘blas’] library_dirs = [‘/usr/lib’] language = f77 lapack_info: libraries = [‘lapack’] library_dirs = [‘/usr/lib’] language = f77 atlas_threads_info: NOT AVAILABLE blas_opt_info: libraries = [‘blas’] library_dirs = [‘/usr/lib’] language = … Read more
Numpy Pure Functions for performance, caching
These functions already exist in scipy. The sigmoid function is available as scipy.special.expit. In [36]: from scipy.special import expit Compare expit to the vectorized sigmoid function: In [38]: x = np.linspace(-6, 6, 1001) In [39]: %timeit y = sigmoid(x) 100 loops, best of 3: 2.4 ms per loop In [40]: %timeit y = expit(x) 10000 … Read more
Benchmarking (python vs. c++ using BLAS) and (numpy)
UPDATE (30.07.2014): I re-run the the benchmark on our new HPC. Both the hardware as well as the software stack changed from the setup in the original answer. I put the results in a google spreadsheet (contains also the results from the original answer). Hardware Our HPC has two different nodes one with Intel Sandy … Read more
calling dot products and linear algebra operations in Cython?
Calling BLAS bundled with Scipy is “fairly” straightforward, here’s one example for calling DGEMM to compute matrix multiplication: https://gist.github.com/pv/5437087 Note that BLAS and LAPACK expect all arrays to be Fortran-contiguous (modulo the lda/b/c parameters), hence order=”F” and double[::1,:] which are required for correct functioning. Computing inverses can be similarly done by applying the LAPACK function … Read more
multithreaded blas in python/numpy
I already posted this in another thread but I think it fits better in this one: UPDATE (30.07.2014): I re-run the the benchmark on our new HPC. Both the hardware as well as the software stack changed from the setup in the original answer. I put the results in a google spreadsheet (contains also the … Read more
How to check BLAS/LAPACK linkage in NumPy and SciPy?
The method numpy.show_config() (or numpy.__config__.show()) outputs information about linkage gathered at build time. My output looks like this. I think it means I am using the BLAS/LAPACK that ships with Mac OS. >>> import numpy as np >>> np.show_config() lapack_opt_info: extra_link_args = [‘-Wl,-framework’, ‘-Wl,Accelerate’] extra_compile_args = [‘-msse3’] define_macros = [(‘NO_ATLAS_INFO’, 3)] blas_opt_info: extra_link_args = [‘-Wl,-framework’, … Read more
Link ATLAS/MKL to an installed Numpy
Assuming you’re running some flavour of linux, here’s one way you could do it: Find out what BLAS library numpy is currently linked against using ldd. For versions of numpy older than v1.10: $ ldd /<path_to_site-packages>/numpy/core/_dotblas.so For example, if I install numpy via apt-get, it links to … libblas.so.3 => /usr/lib/libblas.so.3 (0x00007fed81de8000) … If _dotblas.so … Read more
Compiling numpy with OpenBLAS integration
I just compiled numpy inside a virtualenv with OpenBLAS integration, and it seems to be working OK. This was my process: Compile OpenBLAS: $ git clone https://github.com/xianyi/OpenBLAS $ cd OpenBLAS && make FC=gfortran $ sudo make PREFIX=/opt/OpenBLAS install If you don’t have admin rights you could set PREFIX= to a directory where you have write … Read more