To make it convenient for customers, Intel introduced a new license called Intel® Simplified license that allows to redistribute not only dynamic libraries but also headers, examples and static libraries.
Installing and enabling the full MKL installation enables MKL support for all operators under the linalg namespace.
-
Download and install the latest full MKL version following instructions on the intel website.
-
Run 'make -j ${nproc} USE_BLAS=mkl'
-
Navigate into the python directory
-
Run 'sudo python setup.py install'
To build and install MXNet yourself, you need the following dependencies. Install the required dependencies:
- If Microsoft Visual Studio 2015 is not already installed, download and install it. You can download and install the free community edition.
- Download and Install CMake if it is not already installed.
- Download and install OpenCV.
- Unzip the OpenCV package.
- Set the environment variable
OpenCV_DIR
to point to theOpenCV build directory
(C:\opencv\build\x64\vc14
for example). Also, you need to add the OpenCV bin directory (C:\opencv\build\x64\vc14\bin
for example) to thePATH
variable. - If you have Intel Math Kernel Library (MKL) installed, set
MKL_ROOT
to point toMKL
directory that contains theinclude
andlib
. If you want to use MKL blas, you should set-DUSE_BLAS=mkl
when cmake. Typically, you can find the directory inC:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\mkl
. - If you don't have the Intel Math Kernel Library (MKL) installed, download and install OpenBLAS. Note that you should also download ```mingw64.dll.zip`` along with openBLAS and add them to PATH.
- Set the environment variable
OpenBLAS_HOME
to point to theOpenBLAS
directory that contains theinclude
andlib
directories. Typically, you can find the directory inC:\Program files (x86)\OpenBLAS\
.
After you have installed all of the required dependencies, build the MXNet source code:
- Download the MXNet source code from GitHub. Don't forget to pull the submodules:
git clone https://github.com/apache/incubator-mxnet.git --recursive
-
Copy file
3rdparty/mkldnn/config_template.vcxproj
to incubator-mxnet root. -
Start a Visual Studio command prompt.
-
Use CMake to create a Visual Studio solution in
./build
or some other directory. Make sure to specify the architecture in the CMake command:
mkdir build
cd build
cmake -G "Visual Studio 14 Win64" .. -DUSE_CUDA=0 -DUSE_CUDNN=0 -DUSE_NVRTC=0 -DUSE_OPENCV=1 -DUSE_OPENMP=1 -DUSE_PROFILER=1 -DUSE_BLAS=open -DUSE_LAPACK=1 -DUSE_DIST_KVSTORE=0 -DCUDA_ARCH_NAME=All -DUSE_MKLDNN=1 -DCMAKE_BUILD_TYPE=Release
-
In Visual Studio, open the solution file,
.sln
, and compile it. These commands produce a library calledlibmxnet.dll
in the./build/Release/
or./build/Debug
folder. Alsolibmkldnn.dll
with be in the./build/3rdparty/mkldnn/src/Release/
-
Make sure that all the dll files used above(such as
libmkldnn.dll
,libmklml.dll
,libiomp5.dll
,libopenblas.dll
, etc) are added to the system PATH. For convinence, you can put all of them to\windows\system32
. Or you will come acrossNot Found Dependencies
when loading mxnet.
- Install
Python
using windows installer available here. - Install
Numpy
using windows installer available here. - Next, we install Python package interface for MXNet. You can find the Python interface package for MXNet on GitHub.
cd python
python setup.py install
Done! We have installed MXNet with Python interface. Run below commands to verify our installation is successful.
# Open Python terminal
python
# You should be able to import mxnet library without any issues.
>>> import mxnet as mx;
>>> a = mx.nd.ones((2, 3));
>>> print ((a*2).asnumpy());
[[ 2. 2. 2.]
[ 2. 2. 2.]]
We actually did a small tensor computation using MXNet! You are all set with MKLDNN MXNet on your Windows machine.