Link MKL to an installed Numpy in Anaconda?

旧城冷巷雨未停 提交于 2019-12-07 10:10:26

问题


>>> numpy.__config__.show()
atlas_threads_info:
  NOT AVAILABLE
blas_opt_info:
    libraries = ['f77blas', 'cblas', 'atlas']
    library_dirs = ['/home/admin/anaconda/lib']
    define_macros = [('ATLAS_INFO', '"\\"3.8.4\\""')]
    language = c
atlas_blas_threads_info:
  NOT AVAILABLE
openblas_info:
  NOT AVAILABLE
lapack_opt_info:
    libraries = ['lapack', 'f77blas', 'cblas', 'atlas']
    library_dirs = ['/home/admin/anaconda/lib']
    define_macros = [('ATLAS_INFO', '"\\"3.8.4\\""')]
    language = f77
openblas_lapack_info:
  NOT AVAILABLE
atlas_info:
    libraries = ['lapack', 'f77blas', 'cblas', 'atlas']
    library_dirs = ['/home/admin/anaconda/lib']
    define_macros = [('ATLAS_INFO', '"\\"3.8.4\\""')]
    language = f77
lapack_mkl_info:
  NOT AVAILABLE
blas_mkl_info:
  NOT AVAILABLE
atlas_blas_info:
    libraries = ['f77blas', 'cblas', 'atlas']
    library_dirs = ['/home/admin/anaconda/lib']
    define_macros = [('ATLAS_INFO', '"\\"3.8.4\\""')]
    language = c
mkl_info:
  NOT AVAILABLE

This is numpy.config.show()

And this numpy is based on Anaconda.

in /home/admin/anaconda/lib/python2.7/site-packages/numpy

And meanwhile, I have installed MKL in /opt/intel/mkl.

Also it seems that, I can use MKL, when I used Theano with this Anaconda and this numpy.

Thank you~


回答1:


To do this, you'll have to get the Numpy source code and create a site.cfg file in the main folder that tells Numpy where to look for the MKL libraries. Use the site.cfg.example file as a guide; there's a section in there on MKL that should tell you the exact lines you need.

Once you have a site.cfg file, run python setup.py config. This will spit out the configuration info (it looks like the output of numpy.config.show()). You should see the paths to your MKL libraries in there (if not, you'll have to play around with the site.cfg file until you do).

Then, you can build and install with python setup.py build and python setup.py install. You may want to uninstall your old Numpy first.

I have a blog post on installing Numpy with OpenBLAS. While your situation is a little different, a lot of steps are similar I think.



来源:https://stackoverflow.com/questions/29392390/link-mkl-to-an-installed-numpy-in-anaconda

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!