Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Testing numpy and scipy setups
#!/usr/bin/env python
import numpy
import sys
import timeit
try:
import numpy.core._dotblas
print 'FAST BLAS'
except ImportError:
print 'slow blas'
print "version:", numpy.__version__
print "maxint:", sys.maxint
print
x = numpy.random.random((1000,1000))
setup = "import numpy; x = numpy.random.random((1000,1000))"
count = 5
t = timeit.Timer("numpy.dot(x, x.T)", setup=setup)
print "dot:", t.timeit(count)/count, "sec"
#!/usr/bin/env python
import timeit
setup = "import numpy;\
import scipy.linalg as linalg;\
x = numpy.random.random((1000,1000));\
z = numpy.dot(x, x.T)"
count = 5
t = timeit.Timer("linalg.cholesky(z, lower=True)", setup=setup)
print "cholesky:", t.timeit(count)/count, "sec"
t = timeit.Timer("linalg.svd(z)", setup=setup)
print "svd:", t.timeit(count)/count, "sec"
@tndoan
tndoan commented Apr 12, 2014

Hi,

I have installed BLAS library to speed up Numpy and Scipy. Using your script test_numpy.py, it prompts that

FAST BLAS
version: 1.8.1
maxint: 9223372036854775807

dot: 0.110041189194 sec

But when I check the system monitor, I observe that there is only one process to handle the dot operator. Are there any problem with my configuration? Would you please help me?

Here is my configuration of Numpy

atlas_threads_info:
  NOT AVAILABLE
blas_opt_info:
    libraries = ['f77blas', 'cblas', 'atlas']
    library_dirs = ['/usr/lib/atlas-base']
    define_macros = [('ATLAS_INFO', '"\\"3.10.1\\""')]
    language = c
    include_dirs = ['/usr/include/atlas']
atlas_blas_threads_info:
  NOT AVAILABLE
openblas_info:
  NOT AVAILABLE
lapack_opt_info:
    libraries = ['lapack', 'f77blas', 'cblas', 'atlas']
    library_dirs = ['/usr/lib/atlas-base/atlas', '/usr/lib/atlas-base']
    define_macros = [('ATLAS_INFO', '"\\"3.10.1\\""')]
    language = f77
    include_dirs = ['/usr/include/atlas']
atlas_info:
    libraries = ['lapack', 'f77blas', 'cblas', 'atlas']
    library_dirs = ['/usr/lib/atlas-base/atlas', '/usr/lib/atlas-base']
    define_macros = [('ATLAS_INFO', '"\\"3.10.1\\""')]
    language = f77
    include_dirs = ['/usr/include/atlas']
lapack_mkl_info:
  NOT AVAILABLE
blas_mkl_info:
  NOT AVAILABLE
atlas_blas_info:
    libraries = ['f77blas', 'cblas', 'atlas']
    library_dirs = ['/usr/lib/atlas-base']
    define_macros = [('ATLAS_INFO', '"\\"3.10.1\\""')]
    language = c
    include_dirs = ['/usr/include/atlas']
mkl_info:
  NOT AVAILABLE
@antoniomo

Note that in recent numpy versions (>1.10) it will always report SLOW BLAS due to the missing numpy.core._dotblas.

Here's a more updated way of checking if it's linked properly:
http://stackoverflow.com/questions/21671040/link-atlas-mkl-to-an-installed-numpy/21673585#21673585

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment