Steps to compile MxNet 1.8.0 release candidate 3 with windows 10, x64, intel MKL, Cuda 10.1 & visual

Steps to compile MxNet 1.8.0 release candidate 3 with windows 10, x64, intel MKL, Cuda 10.1 & visual studio 2019
I ran into issues compiling 1.7.0 with the nvcc compiler that appears to be fixed in 1.8.0

#Downloading mxnet sources
Make a folder C:\Projects\MxNet-180
navigate into this folder with Git Bash. 
run: git clone https://github.com/apache/incubator-mxnet.git --recursive
run: cd incubator-mxnet
run: git checkout 64f737cdd59fe88d2c5b479f25d011c5156b6a8a --recurse-submodules    (this is the 1.8.0-RC3 commit)

#OpenCV
https://sourceforge.net/projects/opencvlibrary/files/4.5.1/opencv-4.5.1-vc14_vc15.exe/download
Run the .exe to extract the files and place them in C:\Projects\MxNet-180\dependencies
Make sure C:\Projects\MxNet-180\dependencies\opencv\build\x64\vc15\bin is in your Path environment variable

#Get the intel oneAPI base toolkit (for MKL)
https://software.intel.com/content/www/us/en/develop/tools/oneapi/base-toolkit/download.html
set the environment variabele MKL_ROOT = C:\Program Files (x86)\Intel\oneAPI\mkl\2021.1.1 (or whatever version you have)

#Get Cuda 10.1
https://developer.nvidia.com/cuda-10.1-download-archive-update2?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exenetwork

#Get cmake 3.19.4

#Get CUDNN cudnn-10.1-windows10-x64-v8.0.5.39
https://developer.nvidia.com/rdp/cudnn-download
extract the zip in C:\Projects\MxNet-180\dependencies\cudnn\
such that this path exist: C:\Projects\MxNet-180\dependencies\cudnn\cudnn-10.1-windows10-x64-v8.0.5.39\cuda\bin

#Add to Path
Make a new user environment variable MXNET_HOME = C:\Projects\MxNet-180\incubator-mxnet
Add the following paths to the PATH environment variable
C:\Projects\MxNet-180\dependencies\cudnn\cudnn-10.1-windows10-x64-v8.0.5.39\cuda\bin;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin
C:\Program Files (x86)\Intel\oneAPI\mkl\2021.1.1\redist\intel64;
%MXNET_HOME%\build\Release;
C:\Projects\MxNet-180\dependencies\opencv\build\x64\vc15\bin;
C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1.1\windows\redist\intel64_win\compiler;

Go to C:\Projects\MxNet-180\incubator-mxnet
run: mkdir build
run: cd build
run: cmake -G "Visual Studio 16 2019" -T cuda=10.1,host=x64 -DUSE_BLAS=mkl -DUSE_CUDA=1 -DUSE_CUDNN=1 -DUSE_NVRTC=1 -DUSE_OPENCV=1 -DUSE_OPENMP=1 -DUSE_LAPACK=1 -DUSE_DIST_KVSTORE=0 -DUSE_CPP_PACKAGE=1 -DCMAKE_CUDA_COMPILER="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/bin/nvcc.exe" -DCUDNN_INCLUDE=C:\Projects\MxNet-180\dependencies\cudnn\cudnn-10.1-windows10-x64-v8.0.5.39\cuda\include -DCUDNN_LIBRARY=C:\Projects\MxNet-180\dependencies\cudnn\cudnn-10.1-windows10-x64-v8.0.5.39\cuda\lib\x64\cudnn.lib "C:\Projects\MxNet-180\incubator-mxnet"

Open mxnet.sln in visual studio
Select Release and x64 config
Go to mxnet_61 project properties --> CUDA C/C++ --> additional include directories
Add these as additional include directories (maybe change windows sdk version and the visual studio release (Professional/Community...)):
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\winrt
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\cppwinrt\winrt
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\include

Make sure C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29333\bin\Hostx64\x64 is in your path environment variable. We need this for cl.exe.

Compile and wait ~5 hours

Op.h generator failed, but libmxnet.dll was created. Run this script manually:
Make sure python3 is installed on your system. 
go to C:\Projects\MxNet-180\incubator-mxnet\cpp-package\scripts
Copy these dll's to the cpp-package\scripts folder:
    mkl_rt.1.dll
    cudnn64_8.dll
    opencv_world451.dll
    cufft_64_10.dll
run: python OpWrapperGenerator.py ../../build/Release/libmxnet.dll
 

猜你喜欢

转载自blog.csdn.net/eidolon_foot/article/details/114043429