3

I'm looking to do some work with NumPy on my Pi 3 B+, and I'm not sure what the deal is with optimization, blas, etc.

I installed libatlas using:

sudo apt-get install libatlas-base-dev

Following which I installed numpy:

pip3 install numpy

Note that my default python is python 3.5. When I run the python code:

import numpy as np
print (np.__config__.show())

I get the following output

atlas_info:
    include_dirs = ['/usr/include/atlas']
    language = f77
    libraries = ['lapack', 'f77blas', 'cblas', 'atlas', 'f77blas', 'cblas']
    define_macros = [('ATLAS_INFO', '"\\"3.10.3\\""')]
    library_dirs = ['/usr/lib/atlas-base/atlas', '/usr/lib/atlas-base']
atlas_3_10_info:
  NOT AVAILABLE
atlas_3_10_threads_info:
  NOT AVAILABLE
openblas_clapack_info:
  NOT AVAILABLE
atlas_3_10_blas_threads_info:
  NOT AVAILABLE
lapack_mkl_info:
  NOT AVAILABLE
atlas_blas_info:
    library_dirs = ['/usr/lib/atlas-base']
    include_dirs = ['/usr/include/atlas']
    language = c
    define_macros = [('HAVE_CBLAS', None), ('ATLAS_INFO', '"\\"3.10.3\\""')]
    libraries = ['f77blas', 'cblas', 'atlas', 'f77blas', 'cblas']
accelerate_info:
  NOT AVAILABLE
atlas_blas_threads_info:
  NOT AVAILABLE
atlas_3_10_blas_info:
  NOT AVAILABLE
atlas_threads_info:
  NOT AVAILABLE
blis_info:
  NOT AVAILABLE
openblas_info:
  NOT AVAILABLE
blas_mkl_info:
  NOT AVAILABLE
openblas_lapack_info:
  NOT AVAILABLE
blas_opt_info:
    library_dirs = ['/usr/lib/atlas-base']
    include_dirs = ['/usr/include/atlas']
    language = c
    define_macros = [('HAVE_CBLAS', None), ('ATLAS_INFO', '"\\"3.10.3\\""')]
    libraries = ['f77blas', 'cblas', 'atlas', 'f77blas', 'cblas']
lapack_opt_info:
    include_dirs = ['/usr/include/atlas']
    language = f77
    libraries = ['lapack', 'f77blas', 'cblas', 'atlas', 'f77blas', 'cblas']
    define_macros = [('ATLAS_INFO', '"\\"3.10.3\\""')]
    library_dirs = ['/usr/lib/atlas-base/atlas', '/usr/lib/atlas-base']
None

This looks to me like numpy is optimized with blas, and therefore for multi-core operation, however when I run a matrix multiplication program and run

top

The python process tops out at 100% cpu instead of 400% like I see on my 4-core laptop...

  • can definitely confirm lack of multi-thread on Raspberry Pi when running (say) dot products. Unfortunately, numpy's configuration output doesn't seem to tell you anything useful about multi-thread support even when run on an 8-core x86_64 that supports it. – scruss Aug 24 '18 at 21:18

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.