Saturday, 29 September 2018

Install cpp package of mxnet on windows 10, with cuda and opencv

    Compile and install cpp-package of mxnet on windows 10 is a little bit tricky when I writing this post.

     The install page of mxnet tell us almost everything we need to know, but there are something left behind haven't wrote into the pages yet, today I would like to write down the pitfalls I met and share with you how do I solved them.

Pitfalls

1. Remember to download the mingw dll from the openBLAS download page, put those dll into some place could be found by the system, else you wouldn't be able to generate op.h for cpp-package.

2. Install Anaconda(recommended) or the python package on the mxnet install page on your , machines and register the path(the path with python.exe), else you wouldn't be able to generate op.h for cpp-package.

3. Compile the project without cpp-package first, else you may not able to generate op.h.

Cmake command for reference, change it to suit your own need

a : Run these command first

cmake -G "Visual Studio 14 2015 Win64" ^
-DCUDA_USE_STATIC_CUDA_RUNTIME=ON ^
-DENABLE_CUDA_RTC=ON ^
-DMKLDNN_VERBOSE=ON ^
-DUSE_CUDA=ON ^
-DUSE_CUDNN=ON ^
-DUSE_F16C=ON ^
-DUSE_GPERFTOOLS=ON ^
-DUSE_JEMALLOC=OFF ^
-DUSE_LAPACK=ON ^
-DUSE_MKLDNN=ON ^
-DUSE_MKLML_MKL=ON ^
-DUSE_MKL_IF_AVAILABLE=ON ^
-DUSE_MXNET_LIB_NAMING=ON ^
-DUSE_OPENCV=ON ^
-DUSE_OPENMP=ON ^
-DUSE_PROFILER=ON ^
-DUSE_SSE=ON ^
-DWITH_EXAMPLE=ON ^
-DWITH_TEST=ON ^
-DCMAKE_INSTALL_PREFIX=install ..

cmake --build . --config Release

b : Run these command, with cpp package on

cmake -G "Visual Studio 14 2015 Win64" ^
-DCUDA_USE_STATIC_CUDA_RUNTIME=ON ^
-DENABLE_CUDA_RTC=ON ^
-DMKLDNN_VERBOSE=ON ^
-DUSE_CUDA=ON ^
-DUSE_CUDNN=ON ^
-DUSE_F16C=ON ^
-DUSE_GPERFTOOLS=ON ^
-DUSE_CPP_PACKAGE=ON ^
-DUSE_LAPACK=ON ^
-DUSE_MKLDNN=ON ^
-DUSE_MKLML_MKL=ON ^
-DUSE_MKL_IF_AVAILABLE=ON ^
-DUSE_MXNET_LIB_NAMING=ON ^
-DUSE_OPENCV=ON ^
-DUSE_OPENMP=ON ^
-DUSE_PROFILER=ON ^
-DUSE_SSE=ON ^
-DWITH_EXAMPLE=ON ^
-DWITH_TEST=ON ^
-DCMAKE_INSTALL_PREFIX=install ..

cmake --build . --config Release --target INSTALL

4. After you compile and install the libs, you may find out you missed some headers in the install
path, I missed nnvm and mxnet-cpp. What I did is copy the folders to the install folder.

    Hope these could help someone who is pulling their head when compile cpp-package of mxnet on windows 10.

No comments:

Post a Comment