4

I noticed that when I run a numpy function like numpy.dot, 4 cores of my machine will get busy doing the work. This means that, somehow, numpy automatically understands that it can parallelize some computations. However, I actually have 8 cores on my machine, so I would like to tell numpy to use all of them. Do you know how to do that?

I've followed the instrutions in Limit number of threads in numpy, but they didn't work.

I report the output of numpy.show_config() below:

lapack_opt_info:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/home/anfri/anaconda2/lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['/home/anfri/anaconda2/include']

blas_opt_info:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/home/anfri/anaconda2/lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['/home/anfri/anaconda2/include']

lapack_mkl_info:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/home/anfri/anaconda2/lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['/home/anfri/anaconda2/include']

blas_mkl_info:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/home/anfri/anaconda2/lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['/home/anfri/anaconda2/include']
Francesco Cariaggi
  • 688
  • 2
  • 9
  • 23
  • 4
    Possible duplicate of [Limit number of threads in numpy](https://stackoverflow.com/questions/30791550/limit-number-of-threads-in-numpy) – sascha May 15 '18 at 10:11
  • 1
    Can you include the exact steps you've tried? Depending on your OS and IDE it may take restarting python in a new shell for those settings to take effect. – user2699 May 15 '18 at 12:44
  • I have Ubuntu 17.10 and I'm using jupyter notebook to run Python code. I've tried setting those environment variables both from within Python code and from the terminal. I've also tried to restart the IPython kernel after setting the variables from the terminal, but it didn't work – Francesco Cariaggi May 15 '18 at 12:54

0 Answers0