1

I read that with multithreaded blas numpy.dot should use multiple cores. However, this is not the case for me. When I run the following script, I always see (via top command) only one core being used (even though many are available):

   import numpy as np
   print np.show_config()
   a = np.random.randint(5, size=(10000, 10000))
   b = np.random.randint(5, size=(10000, 10000))
   print np.dot(a, b)

This is the output from numpy.show_config():

atlas_threads_info:
    libraries = ['lapack', 'ptf77blas', 'ptcblas', 'atlas']
    library_dirs = ['/usr/lib64/atlas-sse3']
    define_macros = [('ATLAS_INFO', '"\\"3.8.4\\""')]
    language = f77
    include_dirs = ['/usr/include']
blas_opt_info:
    libraries = ['ptf77blas', 'ptcblas', 'atlas']
    library_dirs = ['/usr/lib64/atlas-sse3']
    define_macros = [('ATLAS_INFO', '"\\"3.8.4\\""')]
    language = c
    include_dirs = ['/usr/include']
atlas_blas_threads_info:
    libraries = ['ptf77blas', 'ptcblas', 'atlas']
    library_dirs = ['/usr/lib64/atlas-sse3']
    define_macros = [('ATLAS_INFO', '"\\"3.8.4\\""')]
    language = c
    include_dirs = ['/usr/include']
openblas_info:
  NOT AVAILABLE
lapack_opt_info:
    libraries = ['lapack', 'ptf77blas', 'ptcblas', 'atlas']
    library_dirs = ['/usr/lib64/atlas-sse3']
    define_macros = [('ATLAS_INFO', '"\\"3.8.4\\""')]
    language = f77
    include_dirs = ['/usr/include']
openblas_lapack_info:
  NOT AVAILABLE
lapack_mkl_info:
  NOT AVAILABLE
blas_mkl_info:
  NOT AVAILABLE
mkl_info:
  NOT AVAILABLE

Do you know what could be the problem here? I have been reading various posts about numpy with multithreaded blas and I am pretty stuck now. Also, I don't have sudo on the machine.

michal
  • 111
  • 2
  • 1
    In short because ATLAS is not by default configured for multiple cores. I don't know much about configuring ATLAS. (I spent all my time messing with that on working on getting away from it to use OpenBLAS -- which does use multiple cores.) – Frames Catherine White Feb 10 '15 at 04:45
  • How did you install ATLAS? Did you compile it yourself? – ali_m Feb 10 '15 at 11:54
  • @Oxinabox But don't ptf77blas and ptcblas mean multithread implementations of Blas? So should I install it locally with some flags denoting multithreading? Is it possible to do so without sudo? – michal Feb 11 '15 at 02:57
  • user123675: as I said, I know little of ATLAS. Is there any reason you are needing to both use Atlas, and have multithreaded dots? Why not move to OpenBlas, if you are desperate for speed? it is just better (google and you will see speed comparisons). -- As far as installing without sudo, I have only ever managed to get openBlas working when i didn't have sudo. took the best part of a day (cos i didn't know what i was doing, could do it faster now i think). Conversely, it took me 3 days to find that I couldn't get OpenBlas to work when using sudo powers. – Frames Catherine White Feb 11 '15 at 03:31
  • @ali_m no, they were already pre-installed by the server admins. I believe these should parallelize already (as they are listed in threads section), but for some reason they don't... – michal Feb 13 '15 at 05:34
  • That depends entirely on how the admins installed ATLAS. For example, the pre-built binary from the Ubuntu repositories is compiled for single threads only. – ali_m Feb 13 '15 at 13:43
  • It should be possible to compile OpenBLAS from source without admin rights as long as you put the compiled library in a non-system directory `~/lib/OpenBLAS` for example. You could follow [these instructions](http://stackoverflow.com/a/14391693/1461210). In the numpy `site.cfg` file you need to specify the correct location for `OpenBLAS/lib`. You will also need to specify a local installation for numpy, e.g. by working within a virtualenv or using `python setup.py install --user`. Finally you need to make sure that `OpenBLAS/lib` is in your `LD_LIBRARY_PATH` evironment variable. – ali_m Feb 13 '15 at 13:47

0 Answers0