2015-10-16 50 views
2

我剛剛在Windows 2.7.10環境下通過Anaconda安裝了numpy-1.10.1。令我驚訝的是,我發現它具有MKL開箱即用(參見下面的配置)。我用Gohlke的numpy + mkl-1.10.1安裝了「手動」Python 2.7.10安裝版本,運行a benchmark,它們顯示的數字相同。配置是相同的。在Anaconda默認numpy vs加速

我想知道Anaconda加速包爲numpy帶來了什麼?

阿納康達numpy的-1.10.1配置

>>> np.__config__.show() 
lapack_opt_info: 
    libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd', 'mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd'] 
    library_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/lib/intel64'] 
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)] 
    include_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/include'] 
blas_opt_info: 
    libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd'] 
    library_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/lib/intel64'] 
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)] 
    include_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/include'] 
openblas_lapack_info: 
    NOT AVAILABLE 
lapack_mkl_info: 
    libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd', 'mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd'] 
    library_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/lib/intel64'] 
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)] 
    include_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/include'] 
blas_mkl_info: 
    libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd'] 
    library_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/lib/intel64'] 
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)] 
    include_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/include'] 
mkl_info: 
    libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd'] 
    library_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/lib/intel64'] 
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)] 
    include_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/include'] 

(有趣的是,報告Link MKL to an installed Numpy in Anaconda?不同的配置。)

Gohlke numpy的-1.10.1 + MKL配置

>>> np.__config__.show() 
lapack_opt_info: 
    libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd', 'mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd'] 
    library_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/lib/intel64'] 
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)] 
    include_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/include'] 
blas_opt_info: 
    libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd'] 
    library_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/lib/intel64'] 
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)] 
    include_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/include'] 
openblas_lapack_info: 
    NOT AVAILABLE 
lapack_mkl_info: 
    libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd', 'mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd'] 
    library_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/lib/intel64'] 
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)] 
    include_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/include'] 
blas_mkl_info: 
    libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd'] 
    library_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/lib/intel64'] 
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)] 
    include_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/include'] 
mkl_info: 
    libraries = ['mkl_lapack95_lp64', 'mkl_blas95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'libiomp5md', 'libifportmd'] 
    library_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/lib/intel64'] 
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)] 
    include_dirs = ['C:/Program Files (x86)/Intel/Composer XE/mkl/include'] 
+0

你說這個? http://docs.continuum.io/accelerate/index ---頁面上的文檔可能解釋了它的功能。 –

+0

@pv。我只對numpy感興趣。您提到的頁面表示,加速包括MKL的numpy。但是我看到的是,即使沒有在Anaconda加速膨脹,MKL也是如此。除非有人在這裏解釋它,否則我將通過加速免費試用來運行基準測試。 – ilya

回答

1

使用基準測試腳本鏈接在這個問題上,我可以看到,加速的numpy和Anaconda的numpy提供了相同的性能。

Numpy with accelerate vs numpy in Anaconda

比較物在Python的2.7.10 64位進行上i7-4790K @ 4 GHz的32GB的RAM。由於加速目前將numpy降至1.9.3,我將其與1.9.3的numpy和1.10.1的numpy進行比較以供參考。

我得出結論,當只使用numpy時,加速不會帶來額外的性能。

爲了完整起見,這裏是numpy的-1.9.3的配置在加速:

>>> np.__config__.show() 
lapack_opt_info: 
    libraries = ['mkl_lapack95_lp64', 'mkl_core_dll', 'mkl_intel_lp64_dll', 'mkl_intel_thread_dll'] 
    library_dirs = ['C:\\aroot\\stage\\libs'] 
    define_macros = [('SCIPY_MKL_H', None)] 
    include_dirs = ['C:\\aroot\\stage\\include'] 
blas_opt_info: 
    libraries = ['mkl_core_dll', 'mkl_intel_lp64_dll', 'mkl_intel_thread_dll'] 
    library_dirs = ['C:\\aroot\\stage\\libs'] 
    define_macros = [('SCIPY_MKL_H', None)] 
    include_dirs = ['C:\\aroot\\stage\\include'] 
openblas_lapack_info: 
    NOT AVAILABLE 
lapack_mkl_info: 
    libraries = ['mkl_lapack95_lp64', 'mkl_core_dll', 'mkl_intel_lp64_dll', 'mkl_intel_thread_dll'] 
    library_dirs = ['C:\\aroot\\stage\\libs'] 
    define_macros = [('SCIPY_MKL_H', None)] 
    include_dirs = ['C:\\aroot\\stage\\include'] 
blas_mkl_info: 
    libraries = ['mkl_core_dll', 'mkl_intel_lp64_dll', 'mkl_intel_thread_dll'] 
    library_dirs = ['C:\\aroot\\stage\\libs'] 
    define_macros = [('SCIPY_MKL_H', None)] 
    include_dirs = ['C:\\aroot\\stage\\include'] 
mkl_info: 
    libraries = ['mkl_core_dll', 'mkl_intel_lp64_dll', 'mkl_intel_thread_dll'] 
    library_dirs = ['C:\\aroot\\stage\\libs'] 
    define_macros = [('SCIPY_MKL_H', None)] 
    include_dirs = ['C:\\aroot\\stage\\include']