[PYTHON] How to install mkl numpy

The Math Kernel Library (mkl), a high-performance matrix library made by Intel, is now available for free. I will explain how to make this available from numpy. The target is Linux (I am Ubuntu 14.04).

MKL installation

Click "click here now to register and download" on the following site. https://software.intel.com/en-us/articles/free_mkl Enter your name, email address, company name, etc. You will receive a registration email, which you can follow to download. There is no Mac version. It's about 1GB. Make a note of the registration key that you will need during installation. I downloaded l_mkl_11.3.0.109.tgz

Extract the downloaded file. There is `ʻinstall.shin it, so execute it. The installation destination is / opt / intel`` by default, and you will be prompted to enter the registration key on the way, so enter it. (

If you don't want to use interactive, modify the following part of the silent.cfg file in the unzipped directory.

ACCEPT_EULA=accept
ACTIVATION_SERIAL_NUMBER=XXXX-XXXXXXXX
ACTIVATION_TYPE=serial_number

You can install it from the command line only by running ʻinstall.sh -s silent.cfg`.

Put LD_LIBRARY_PATH in / opt / intel / mkl / lib / intel64.

numpy installation

For the settings when installing numpy, go to ~ / .numpy-site.cfg. The template for this file is in the source. https://github.com/numpy/numpy/blob/master/site.cfg.example Modify the file and keep it in your home directory. The contents are as follows.

[mkl]
library_dirs = /opt/intel/mkl/lib/intel64/
include_dirs = /opt/intel/mkl/include
mkl_libs = mkl_rt
lapack_libs =

For details, refer to the following site. https://software.intel.com/en-us/articles/numpyscipy-with-intel-mkl

In this state, pip install --no-binary: all: numpy will install numpy using mkl without permission. If numpy is originally included, uninstall it once.

Operation check

You can see which matrix library you are using by looking at numpy.show_config (). If you run Chainer as an example, it seems that it is running at about 1.5 times faster than OpenBLAS.

$ python
>>> import numpy
>>> numpy.show_config()
lapack_opt_info:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/opt/intel/mkl/lib/intel64/']
    define_macros = [('SCIPY_MKL_H', None)]
    include_dirs = ['/opt/intel/mkl/include']
blas_opt_info:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/opt/intel/mkl/lib/intel64/']
    define_macros = [('SCIPY_MKL_H', None)]
    include_dirs = ['/opt/intel/mkl/include']
openblas_lapack_info:
  NOT AVAILABLE
lapack_mkl_info:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/opt/intel/mkl/lib/intel64/']
    define_macros = [('SCIPY_MKL_H', None)]
    include_dirs = ['/opt/intel/mkl/include']
blas_mkl_info:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/opt/intel/mkl/lib/intel64/']
    define_macros = [('SCIPY_MKL_H', None)]
    include_dirs = ['/opt/intel/mkl/include']
mkl_info:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/opt/intel/mkl/lib/intel64/']
    define_macros = [('SCIPY_MKL_H', None)]
    include_dirs = ['/opt/intel/mkl/include']

Recommended Posts

How to install mkl numpy
How to install Python
How to install pip
How to install archlinux
How to install BayesOpt
How to use numpy
How to install Nbextensions
How to install Prover9
How to operate NumPy
How to install NumPy on Raspberry Pi
How to install pip, numpy in Autodesk MAYA
How to install Python [Windows]
Tabpy 1.0 (2020-01 version) How to install
How to install Pelican blog
How to install python using anaconda
How to install mysql-connector-python on mac
How to install and use Tesseract-OCR
How to install python-pip with ubuntu20.04LTS
How to install graph-tool on macOS
How to install wkhtmltopdf (Amazon Linux2)
How to install VMware-Tools on Linux
How to install pycrypto on Windows
How to install OpenCV on Mac
How to install MBDyn (Linux Ubuntu)
How to install PyPy on CentOS
How to install TensorFlow on CentOS 7
How to install and configure blackbird
How to install CUDA and nvidia-driver
How to install and use Graphviz
How to install mysql-connector with pip3
How to install Maven on CentOS
How to install Go on Ubuntu
How to install music 21 on windows
How to install Anaconda with pyenv
How to install aws-session-manager-plugin on Manajro Linux
How to install drobertadams / toggl-cli on Mac
How to install and use pandas_datareader [Python]
python3 How to install an external module
[Kivy] How to install Kivy on Windows [Python]
How to install CatBoost [as of January 2020]
How to install DLIB with 2020 / CUDA enabled
How to install a package using a repository
How to install packages on Alpine Linux
How to install Anisble on Amazon Linux 2
How to install richzhang / colorization on Windows 10
How to install your own (root) CA
How to install Windows Subsystem For Linux
How to install Apache (httpd) on CentOS7
How to install php7.4 on Linux (Ubuntu)
How to install Eclipse GlassFish 5.1.0 on CentOS 7
How to install Apache (httpd) on CentOS8
How to install zsh (with .zshrc customization)
How to install fabric and basic usage
Install Numpy + atlas
How to install cx_Oracle on macOS Sierra
How to install python3 with docker centos
[2020 version] How to install Python3 on AWS EC2
How to speed up scikit-learn like conda Numpy
How to install Python for pharmaceutical company researchers
How to install OpenGM on OSX with macports
How to install Camunda Modeler on Manjaro Linux