[GitHub] zheng-da commented on a change in pull request #10613: Add Windows MKLDNN Building Instruction
zheng-da commented on a change in pull request #10613: Add Windows MKLDNN Building Instruction URL: https://github.com/apache/incubator-mxnet/pull/10613#discussion_r182801243 ## File path: MKL_README.md ## @@ -17,3 +17,106 @@ Installing and enabling the full MKL installation enables MKL support for all op 5. Run 'sudo python setup.py install' + +## Build/Install MXNet with a full MKL installation on Windows: + +To build and install MXNet yourself, you need the following dependencies. Install the required dependencies: + +1. If [Microsoft Visual Studio 2015](https://www.visualstudio.com/vs/older-downloads/) is not already installed, download and install it. You can download and install the free community edition. +2. Download and Install [CMake](https://cmake.org/) if it is not already installed. +3. Download and install [OpenCV](http://sourceforge.net/projects/opencvlibrary/files/opencv-win/3.0.0/opencv-3.0.0.exe/download). +4. Unzip the OpenCV package. +5. Set the environment variable ```OpenCV_DIR``` to point to the ```OpenCV 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 the ``PATH`` variable. +6. If you have Intel Math Kernel Library (MKL) installed, set ```MKL_ROOT``` to point to ```MKL``` directory that contains the ```include``` and ```lib```. Typically, you can find the directory in +```C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\mkl```. +7. If you don't have the Intel Math Kernel Library (MKL) installed, download and install [OpenBlas](http://sourceforge.net/projects/openblas/files/v0.2.14/). Note that you should also download ```mingw64.dll.zip`` along with openBLAS and add them to PATH. +8. Set the environment variable ```OpenBLAS_HOME``` to point to the ```OpenBLAS``` directory that contains the ```include``` and ```lib``` directories. Typically, you can find the directory in ```C:\Program files (x86)\OpenBLAS\```. + +After you have installed all of the required dependencies, build the MXNet source code: + +1. Download the MXNet source code from [GitHub](https://github.com/dmlc/mxnet). Don't forget to pull the submodules: +``` +git clone https://github.com/apache/incubator-mxnet.git ~/mxnet --recursive +``` + +2. Update mkldnn to the newest: +``` +cd 3rdparty/mkldnn/ && git checkout master && git pull +``` + +Or you can follow the [#216](https://github.com/intel/mkl-dnn/pull/216) to do some changes directly. + +3. Download [MKLML small library](https://github.com/intel/mkl-dnn/releases/download/v0.13/mklml_win_2018.0.2.20180127.zip): + +Extract it to `3rdparty/mkldnn/external` manually. + +4. Copy file `3rdparty/mkldnn/config_template.vcxproj` to incubator-mxnet root. Review comment: is it possible to do everything from step 2 to 4 in a single command line? once we update the mkldnn submodule, we won't need step 2. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] zheng-da commented on a change in pull request #10613: Add Windows MKLDNN Building Instruction
zheng-da commented on a change in pull request #10613: Add Windows MKLDNN Building Instruction URL: https://github.com/apache/incubator-mxnet/pull/10613#discussion_r182802321 ## File path: MKL_README.md ## @@ -17,3 +17,106 @@ Installing and enabling the full MKL installation enables MKL support for all op 5. Run 'sudo python setup.py install' + +## Build/Install MXNet with a full MKL installation on Windows: + +To build and install MXNet yourself, you need the following dependencies. Install the required dependencies: + +1. If [Microsoft Visual Studio 2015](https://www.visualstudio.com/vs/older-downloads/) is not already installed, download and install it. You can download and install the free community edition. +2. Download and Install [CMake](https://cmake.org/) if it is not already installed. +3. Download and install [OpenCV](http://sourceforge.net/projects/opencvlibrary/files/opencv-win/3.0.0/opencv-3.0.0.exe/download). +4. Unzip the OpenCV package. +5. Set the environment variable ```OpenCV_DIR``` to point to the ```OpenCV 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 the ``PATH`` variable. +6. If you have Intel Math Kernel Library (MKL) installed, set ```MKL_ROOT``` to point to ```MKL``` directory that contains the ```include``` and ```lib```. Typically, you can find the directory in +```C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\mkl```. +7. If you don't have the Intel Math Kernel Library (MKL) installed, download and install [OpenBlas](http://sourceforge.net/projects/openblas/files/v0.2.14/). Note that you should also download ```mingw64.dll.zip`` along with openBLAS and add them to PATH. +8. Set the environment variable ```OpenBLAS_HOME``` to point to the ```OpenBLAS``` directory that contains the ```include``` and ```lib``` directories. Typically, you can find the directory in ```C:\Program files (x86)\OpenBLAS\```. + +After you have installed all of the required dependencies, build the MXNet source code: + +1. Download the MXNet source code from [GitHub](https://github.com/dmlc/mxnet). Don't forget to pull the submodules: +``` +git clone https://github.com/apache/incubator-mxnet.git ~/mxnet --recursive +``` + +2. Update mkldnn to the newest: +``` +cd 3rdparty/mkldnn/ && git checkout master && git pull +``` + +Or you can follow the [#216](https://github.com/intel/mkl-dnn/pull/216) to do some changes directly. + +3. Download [MKLML small library](https://github.com/intel/mkl-dnn/releases/download/v0.13/mklml_win_2018.0.2.20180127.zip): + +Extract it to `3rdparty/mkldnn/external` manually. + +4. Copy file `3rdparty/mkldnn/config_template.vcxproj` to incubator-mxnet root. + +5. modify mxnet CMakeLists: + +disable cuda and cudnn if you don't have cuda library and enable MKLDNN + +``` +mxnet_option(USE_CUDA "Build with CUDA support" OFF) +mxnet_option(USE_CUDNN"Build with cudnn support" OFF) +mxnet_option(USE_MKLDNN "Use MKLDNN variant of MKL (if MKL found)" ON IF USE_MKL_IF_AVAILABLE) +mxnet_option(ENABLE_CUDA_RTC "Build with CUDA runtime compilation support" OFF) +``` + +add line `add_definitions(-DMXNET_USE_MKLDNN=1)` so that it can build with openblas. + +``` +if(USE_MKL_IF_AVAILABLE) + if(USE_MKLDNN) +add_subdirectory(3rdparty/mkldnn) +include_directories(3rdparty/mkldnn/include) +list(APPEND mxnet_LINKER_LIBS mkldnn) +add_definitions(-DMXNET_USE_MKLDNN=1) + endif() + find_package(MKL) +``` + +6. Modify `incubator-mxnet\src\operator\tensor\elemwise_sum.h`: + +Modify `Sum` in `line 40,73,80,88,94,97` to `Sum2` since it has conflicts with `Sum` in MKLDNN. + +7. Start a Visual Studio command prompt. +8. Use [CMake](https://cmake.org/) to create a Visual Studio solution in ```./build``` or some other directory. Make sure to specify the architecture in the +[CMake](https://cmake.org/) command: +``` +mkdir build +cd build +cmake -G "Visual Studio 14 Win64" .. +``` Review comment: what is step 7? can we not do it in a normal command prompt? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] zheng-da commented on a change in pull request #10613: Add Windows MKLDNN Building Instruction
zheng-da commented on a change in pull request #10613: Add Windows MKLDNN Building Instruction URL: https://github.com/apache/incubator-mxnet/pull/10613#discussion_r182801491 ## File path: MKL_README.md ## @@ -17,3 +17,106 @@ Installing and enabling the full MKL installation enables MKL support for all op 5. Run 'sudo python setup.py install' + +## Build/Install MXNet with a full MKL installation on Windows: + +To build and install MXNet yourself, you need the following dependencies. Install the required dependencies: + +1. If [Microsoft Visual Studio 2015](https://www.visualstudio.com/vs/older-downloads/) is not already installed, download and install it. You can download and install the free community edition. +2. Download and Install [CMake](https://cmake.org/) if it is not already installed. +3. Download and install [OpenCV](http://sourceforge.net/projects/opencvlibrary/files/opencv-win/3.0.0/opencv-3.0.0.exe/download). +4. Unzip the OpenCV package. +5. Set the environment variable ```OpenCV_DIR``` to point to the ```OpenCV 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 the ``PATH`` variable. +6. If you have Intel Math Kernel Library (MKL) installed, set ```MKL_ROOT``` to point to ```MKL``` directory that contains the ```include``` and ```lib```. Typically, you can find the directory in +```C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\mkl```. +7. If you don't have the Intel Math Kernel Library (MKL) installed, download and install [OpenBlas](http://sourceforge.net/projects/openblas/files/v0.2.14/). Note that you should also download ```mingw64.dll.zip`` along with openBLAS and add them to PATH. +8. Set the environment variable ```OpenBLAS_HOME``` to point to the ```OpenBLAS``` directory that contains the ```include``` and ```lib``` directories. Typically, you can find the directory in ```C:\Program files (x86)\OpenBLAS\```. + +After you have installed all of the required dependencies, build the MXNet source code: + +1. Download the MXNet source code from [GitHub](https://github.com/dmlc/mxnet). Don't forget to pull the submodules: +``` +git clone https://github.com/apache/incubator-mxnet.git ~/mxnet --recursive +``` + +2. Update mkldnn to the newest: +``` +cd 3rdparty/mkldnn/ && git checkout master && git pull +``` + +Or you can follow the [#216](https://github.com/intel/mkl-dnn/pull/216) to do some changes directly. + +3. Download [MKLML small library](https://github.com/intel/mkl-dnn/releases/download/v0.13/mklml_win_2018.0.2.20180127.zip): + +Extract it to `3rdparty/mkldnn/external` manually. + +4. Copy file `3rdparty/mkldnn/config_template.vcxproj` to incubator-mxnet root. + +5. modify mxnet CMakeLists: + +disable cuda and cudnn if you don't have cuda library and enable MKLDNN + +``` +mxnet_option(USE_CUDA "Build with CUDA support" OFF) +mxnet_option(USE_CUDNN"Build with cudnn support" OFF) +mxnet_option(USE_MKLDNN "Use MKLDNN variant of MKL (if MKL found)" ON IF USE_MKL_IF_AVAILABLE) +mxnet_option(ENABLE_CUDA_RTC "Build with CUDA runtime compilation support" OFF) +``` + +add line `add_definitions(-DMXNET_USE_MKLDNN=1)` so that it can build with openblas. + +``` +if(USE_MKL_IF_AVAILABLE) + if(USE_MKLDNN) +add_subdirectory(3rdparty/mkldnn) +include_directories(3rdparty/mkldnn/include) +list(APPEND mxnet_LINKER_LIBS mkldnn) +add_definitions(-DMXNET_USE_MKLDNN=1) + endif() + find_package(MKL) +``` + +6. Modify `incubator-mxnet\src\operator\tensor\elemwise_sum.h`: + +Modify `Sum` in `line 40,73,80,88,94,97` to `Sum2` since it has conflicts with `Sum` in MKLDNN. Review comment: is this a bug? if it is, can you submit a PR to fix it? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] zheng-da commented on a change in pull request #10613: Add Windows MKLDNN Building Instruction
zheng-da commented on a change in pull request #10613: Add Windows MKLDNN Building Instruction URL: https://github.com/apache/incubator-mxnet/pull/10613#discussion_r182802601 ## File path: MKL_README.md ## @@ -17,3 +17,106 @@ Installing and enabling the full MKL installation enables MKL support for all op 5. Run 'sudo python setup.py install' + +## Build/Install MXNet with a full MKL installation on Windows: + +To build and install MXNet yourself, you need the following dependencies. Install the required dependencies: + +1. If [Microsoft Visual Studio 2015](https://www.visualstudio.com/vs/older-downloads/) is not already installed, download and install it. You can download and install the free community edition. +2. Download and Install [CMake](https://cmake.org/) if it is not already installed. +3. Download and install [OpenCV](http://sourceforge.net/projects/opencvlibrary/files/opencv-win/3.0.0/opencv-3.0.0.exe/download). +4. Unzip the OpenCV package. +5. Set the environment variable ```OpenCV_DIR``` to point to the ```OpenCV 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 the ``PATH`` variable. +6. If you have Intel Math Kernel Library (MKL) installed, set ```MKL_ROOT``` to point to ```MKL``` directory that contains the ```include``` and ```lib```. Typically, you can find the directory in +```C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\mkl```. +7. If you don't have the Intel Math Kernel Library (MKL) installed, download and install [OpenBlas](http://sourceforge.net/projects/openblas/files/v0.2.14/). Note that you should also download ```mingw64.dll.zip`` along with openBLAS and add them to PATH. +8. Set the environment variable ```OpenBLAS_HOME``` to point to the ```OpenBLAS``` directory that contains the ```include``` and ```lib``` directories. Typically, you can find the directory in ```C:\Program files (x86)\OpenBLAS\```. + +After you have installed all of the required dependencies, build the MXNet source code: + +1. Download the MXNet source code from [GitHub](https://github.com/dmlc/mxnet). Don't forget to pull the submodules: +``` +git clone https://github.com/apache/incubator-mxnet.git ~/mxnet --recursive +``` + +2. Update mkldnn to the newest: +``` +cd 3rdparty/mkldnn/ && git checkout master && git pull +``` + +Or you can follow the [#216](https://github.com/intel/mkl-dnn/pull/216) to do some changes directly. + +3. Download [MKLML small library](https://github.com/intel/mkl-dnn/releases/download/v0.13/mklml_win_2018.0.2.20180127.zip): + +Extract it to `3rdparty/mkldnn/external` manually. + +4. Copy file `3rdparty/mkldnn/config_template.vcxproj` to incubator-mxnet root. + +5. modify mxnet CMakeLists: + +disable cuda and cudnn if you don't have cuda library and enable MKLDNN + +``` +mxnet_option(USE_CUDA "Build with CUDA support" OFF) +mxnet_option(USE_CUDNN"Build with cudnn support" OFF) +mxnet_option(USE_MKLDNN "Use MKLDNN variant of MKL (if MKL found)" ON IF USE_MKL_IF_AVAILABLE) +mxnet_option(ENABLE_CUDA_RTC "Build with CUDA runtime compilation support" OFF) +``` + +add line `add_definitions(-DMXNET_USE_MKLDNN=1)` so that it can build with openblas. + +``` +if(USE_MKL_IF_AVAILABLE) + if(USE_MKLDNN) +add_subdirectory(3rdparty/mkldnn) +include_directories(3rdparty/mkldnn/include) +list(APPEND mxnet_LINKER_LIBS mkldnn) +add_definitions(-DMXNET_USE_MKLDNN=1) + endif() + find_package(MKL) +``` + +6. Modify `incubator-mxnet\src\operator\tensor\elemwise_sum.h`: + +Modify `Sum` in `line 40,73,80,88,94,97` to `Sum2` since it has conflicts with `Sum` in MKLDNN. + +7. Start a Visual Studio command prompt. +8. Use [CMake](https://cmake.org/) to create a Visual Studio solution in ```./build``` or some other directory. Make sure to specify the architecture in the +[CMake](https://cmake.org/) command: +``` +mkdir build +cd build +cmake -G "Visual Studio 14 Win64" .. +``` + +Note that you should close the openmp since MSVC doesn't support openMP3.0. Enable MKLDNN with `MKLDNN_VERBOSE=1`. Review comment: do we need to turn off openmp in cmake? why do we enable MKLDNN_VERBOSE here? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] zheng-da commented on a change in pull request #10613: Add Windows MKLDNN Building Instruction
zheng-da commented on a change in pull request #10613: Add Windows MKLDNN Building Instruction URL: https://github.com/apache/incubator-mxnet/pull/10613#discussion_r18280 ## File path: MKL_README.md ## @@ -17,3 +17,106 @@ Installing and enabling the full MKL installation enables MKL support for all op 5. Run 'sudo python setup.py install' + +## Build/Install MXNet with a full MKL installation on Windows: + +To build and install MXNet yourself, you need the following dependencies. Install the required dependencies: + +1. If [Microsoft Visual Studio 2015](https://www.visualstudio.com/vs/older-downloads/) is not already installed, download and install it. You can download and install the free community edition. +2. Download and Install [CMake](https://cmake.org/) if it is not already installed. +3. Download and install [OpenCV](http://sourceforge.net/projects/opencvlibrary/files/opencv-win/3.0.0/opencv-3.0.0.exe/download). +4. Unzip the OpenCV package. +5. Set the environment variable ```OpenCV_DIR``` to point to the ```OpenCV 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 the ``PATH`` variable. +6. If you have Intel Math Kernel Library (MKL) installed, set ```MKL_ROOT``` to point to ```MKL``` directory that contains the ```include``` and ```lib```. Typically, you can find the directory in +```C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\mkl```. +7. If you don't have the Intel Math Kernel Library (MKL) installed, download and install [OpenBlas](http://sourceforge.net/projects/openblas/files/v0.2.14/). Note that you should also download ```mingw64.dll.zip`` along with openBLAS and add them to PATH. +8. Set the environment variable ```OpenBLAS_HOME``` to point to the ```OpenBLAS``` directory that contains the ```include``` and ```lib``` directories. Typically, you can find the directory in ```C:\Program files (x86)\OpenBLAS\```. + +After you have installed all of the required dependencies, build the MXNet source code: + +1. Download the MXNet source code from [GitHub](https://github.com/dmlc/mxnet). Don't forget to pull the submodules: +``` +git clone https://github.com/apache/incubator-mxnet.git ~/mxnet --recursive +``` + +2. Update mkldnn to the newest: +``` +cd 3rdparty/mkldnn/ && git checkout master && git pull +``` + +Or you can follow the [#216](https://github.com/intel/mkl-dnn/pull/216) to do some changes directly. + +3. Download [MKLML small library](https://github.com/intel/mkl-dnn/releases/download/v0.13/mklml_win_2018.0.2.20180127.zip): + +Extract it to `3rdparty/mkldnn/external` manually. + +4. Copy file `3rdparty/mkldnn/config_template.vcxproj` to incubator-mxnet root. + +5. modify mxnet CMakeLists: + +disable cuda and cudnn if you don't have cuda library and enable MKLDNN + +``` +mxnet_option(USE_CUDA "Build with CUDA support" OFF) +mxnet_option(USE_CUDNN"Build with cudnn support" OFF) +mxnet_option(USE_MKLDNN "Use MKLDNN variant of MKL (if MKL found)" ON IF USE_MKL_IF_AVAILABLE) +mxnet_option(ENABLE_CUDA_RTC "Build with CUDA runtime compilation support" OFF) +``` + +add line `add_definitions(-DMXNET_USE_MKLDNN=1)` so that it can build with openblas. + +``` +if(USE_MKL_IF_AVAILABLE) + if(USE_MKLDNN) +add_subdirectory(3rdparty/mkldnn) +include_directories(3rdparty/mkldnn/include) +list(APPEND mxnet_LINKER_LIBS mkldnn) +add_definitions(-DMXNET_USE_MKLDNN=1) + endif() + find_package(MKL) +``` Review comment: i'm not sure why we need to do this? If you want to turn some options off in cmake, you can do it in the command line. we definitely don't want users to modify CMakeLists.txt This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] zheng-da commented on a change in pull request #10613: Add Windows MKLDNN Building Instruction
zheng-da commented on a change in pull request #10613: Add Windows MKLDNN Building Instruction URL: https://github.com/apache/incubator-mxnet/pull/10613#discussion_r182798789 ## File path: MKL_README.md ## @@ -17,3 +17,106 @@ Installing and enabling the full MKL installation enables MKL support for all op 5. Run 'sudo python setup.py install' + +## Build/Install MXNet with a full MKL installation on Windows: + +To build and install MXNet yourself, you need the following dependencies. Install the required dependencies: + +1. If [Microsoft Visual Studio 2015](https://www.visualstudio.com/vs/older-downloads/) is not already installed, download and install it. You can download and install the free community edition. +2. Download and Install [CMake](https://cmake.org/) if it is not already installed. +3. Download and install [OpenCV](http://sourceforge.net/projects/opencvlibrary/files/opencv-win/3.0.0/opencv-3.0.0.exe/download). +4. Unzip the OpenCV package. +5. Set the environment variable ```OpenCV_DIR``` to point to the ```OpenCV 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 the ``PATH`` variable. +6. If you have Intel Math Kernel Library (MKL) installed, set ```MKL_ROOT``` to point to ```MKL``` directory that contains the ```include``` and ```lib```. Typically, you can find the directory in +```C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\mkl```. +7. If you don't have the Intel Math Kernel Library (MKL) installed, download and install [OpenBlas](http://sourceforge.net/projects/openblas/files/v0.2.14/). Note that you should also download ```mingw64.dll.zip`` along with openBLAS and add them to PATH. +8. Set the environment variable ```OpenBLAS_HOME``` to point to the ```OpenBLAS``` directory that contains the ```include``` and ```lib``` directories. Typically, you can find the directory in ```C:\Program files (x86)\OpenBLAS\```. + +After you have installed all of the required dependencies, build the MXNet source code: + +1. Download the MXNet source code from [GitHub](https://github.com/dmlc/mxnet). Don't forget to pull the submodules: +``` +git clone https://github.com/apache/incubator-mxnet.git ~/mxnet --recursive +``` + +2. Update mkldnn to the newest: +``` +cd 3rdparty/mkldnn/ && git checkout master && git pull +``` Review comment: This is because mxnet doesn't point to the latest commit in mkldnn master branch, right now? This is indeed awkward. Ideally, we don't want users to do it manually. but on the other hand, it's unclear if we should move to the latest commit in mkldnn repo right now. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services