Build with CMake under windows can't trigger USE_MKLDNN, which cause 'WIN CPU_MKLDNN'' can't be built and test in official CI in https://github.com/apache/incubator-mxnet/blob/master/ci/build_windows.py >> 'WIN_CPU_MKLDNN':
Target
We are working on redesign the build logic of MXNET with MKL/MKLDNN Logic. with @pengzhao-intel @TaoLv @@juliusshufan,
Description/Reproduce step:
from source on win10_64, MSVC 2015,
C:\mxnet_4\incubator-mxnet\build>cmake -G "Visual Studio 14 Win64" .. -DUSE_CUDA=0 -DUSE_CUDNN=0 -DUSE_OPENCV=1 -DUSE_OPENMP=1 -DUSE_BLAS=mkl -DUSE_LAPACK=1 -DUSE_PROFILER=1 -DUSE_DIST_KVSTORE=0 -DUSE_MKL_IF_AVAILABLE=1 -DUSE_MKLDNN=1 -DCMAKE_BUILD_TYPE=Release -DMKL_ROOT="C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.3.203\windows\mkl"
the first issue we meet is sames as #14335
The latest CMakeList.txt in mxnet source include the line
mxnet_option(USE_MKLDNN "Use MKLDNN variant of MKL (if MKL found)" ON IF USE_MKL_IF_AVAILABLE AND (NOT APPLE) AND (NOT MSVC) AND (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64") AND (NOT CMAKE_CROSSCOMPILING))
It includes errors
- NOT MSVC ,
which means if the compiler is MSVC (on windows), the flag USE_MKLDNN will not be turn on by default.
- CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64"
But under windows, the CMAKE_HOST_SYSTEM_PROCESSOR will return "AMD64"
-- CMAKE_CROSSCOMPILING FALSE
-- CMAKE_HOST_SYSTEM_PROCESSOR AMD64
-- CMAKE_SYSTEM_PROCESSOR AMD64
-- CMAKE_SYSTEM_NAME Windows
and further
3. mxnet_option( ) will overwrite the user define -DUSE_MKLDNN=1. as discussion in #14640
so those issues cause MKLDNN can't be switch on whatever.
suggest to change to
mxnet_option(USE_MKLDNN "Use MKLDNN" ON IF (NOT APPLE) AND (NOT CMAKE_CROSSCOMPILING) AND ((CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64") OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64")))