diff --git a/3rdparty/mshadow b/3rdparty/mshadow index 6e94643bdf1d..1d79ecfdb4c9 160000 --- a/3rdparty/mshadow +++ b/3rdparty/mshadow @@ -1 +1 @@ -Subproject commit 6e94643bdf1d51a505b147f28c358fb71070b8fd +Subproject commit 1d79ecfdb4c9234537e1bf5148f44a1af54501ec diff --git a/ci/build_windows.py b/ci/build_windows.py index e8658995b68e..7ec24395e22e 100755 --- a/ci/build_windows.py +++ b/ci/build_windows.py @@ -44,6 +44,8 @@ class BuildFlavour(Enum): WIN_CPU = 'WIN_CPU' WIN_CPU_MKLDNN = 'WIN_CPU_MKLDNN' + WIN_CPU_MKLDNN_MKL = 'WIN_CPU_MKLDNN_MKL' + WIN_CPU_MKL = 'WIN_CPU_MKL' WIN_GPU = 'WIN_GPU' WIN_GPU_MKLDNN = 'WIN_GPU_MKLDNN' @@ -72,8 +74,34 @@ class BuildFlavour(Enum): '-DUSE_LAPACK=1 ' '-DUSE_DIST_KVSTORE=0 ' '-DUSE_MKL_IF_AVAILABLE=1 ' + '-DUSE_MKLDNN=1 ' '-DCMAKE_BUILD_TYPE=Release') + , 'WIN_CPU_MKLDNN_MKL': ('-DUSE_CUDA=0 ' + '-DUSE_CUDNN=0 ' + '-DUSE_NVRTC=0 ' + '-DUSE_OPENCV=1 ' + '-DUSE_OPENMP=1 ' + '-DUSE_PROFILER=1 ' + '-DUSE_BLAS=mkl ' + '-DUSE_LAPACK=1 ' + '-DUSE_DIST_KVSTORE=0 ' + '-DUSE_MKL_IF_AVAILABLE=1 ' + '-DUSE_MKLDNN=1 ' + '-DCMAKE_BUILD_TYPE=Release') + + , 'WIN_CPU_MKL': ('-DUSE_CUDA=0 ' + '-DUSE_CUDNN=0 ' + '-DUSE_NVRTC=0 ' + '-DUSE_OPENCV=1 ' + '-DUSE_OPENMP=1 ' + '-DUSE_PROFILER=1 ' + '-DUSE_BLAS=mkl ' + '-DUSE_LAPACK=1 ' + '-DUSE_DIST_KVSTORE=0 ' + '-DUSE_MKL_IF_AVAILABLE=1 ' + '-DUSE_MKLDNN=0 ' + '-DCMAKE_BUILD_TYPE=Release') , 'WIN_GPU': ('-DUSE_CUDA=1 ' '-DUSE_CUDNN=1 ' '-DUSE_NVRTC=1 ' @@ -218,6 +246,8 @@ def main(): os.environ["OpenCV_DIR"] = "C:\\Program Files\\OpenCV-v3.4.1\\build" if 'CUDA_PATH' not in os.environ: os.environ["CUDA_PATH"] = "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v9.2" + if 'MKL_ROOT' not in os.environ: + os.environ["MKL_ROOT"] = "C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries\\windows\\mkl" windows_build(args) elif system == 'Linux' or system == 'Darwin': diff --git a/ci/jenkins/Jenkins_steps.groovy b/ci/jenkins/Jenkins_steps.groovy index 2c86cf740a80..34784610a7bc 100644 --- a/ci/jenkins/Jenkins_steps.groovy +++ b/ci/jenkins/Jenkins_steps.groovy @@ -515,6 +515,48 @@ def compile_windows_cpu() { }] } +def compile_windows_cpu_mkldnn() { + return ['Build CPU MKLDNN windows':{ + node(NODE_WINDOWS_CPU) { + ws('workspace/build-cpu-mkldnn') { + timeout(time: max_time, unit: 'MINUTES') { + utils.init_git_win() + powershell 'py -3 ci/build_windows.py -f WIN_CPU_MKLDNN' + stash includes: 'windows_package.7z', name: 'windows_package_cpu_mkldnn' + } + } + } + }] +} + +def compile_windows_cpu_mkldnn_mkl() { + return ['Build CPU MKLDNN MKL windows':{ + node(NODE_WINDOWS_CPU) { + ws('workspace/build-cpu-mkldnn-mkl') { + timeout(time: max_time, unit: 'MINUTES') { + utils.init_git_win() + powershell 'py -3 ci/build_windows.py -f WIN_CPU_MKLDNN_MKL' + stash includes: 'windows_package.7z', name: 'windows_package_cpu_mkldnn_mkl' + } + } + } + }] +} + +def compile_windows_cpu_mkl() { + return ['Build CPU MKL windows':{ + node(NODE_WINDOWS_CPU) { + ws('workspace/build-cpu-mkl') { + timeout(time: max_time, unit: 'MINUTES') { + utils.init_git_win() + powershell 'py -3 ci/build_windows.py -f WIN_CPU_MKL' + stash includes: 'windows_package.7z', name: 'windows_package_cpu_mkl' + } + } + } + }] +} + def compile_windows_gpu() { return ['Build GPU windows':{ node(NODE_WINDOWS_CPU) { diff --git a/ci/jenkins/Jenkinsfile_windows_cpu b/ci/jenkins/Jenkinsfile_windows_cpu index 5bc40d625930..4475796771d1 100644 --- a/ci/jenkins/Jenkinsfile_windows_cpu +++ b/ci/jenkins/Jenkinsfile_windows_cpu @@ -34,7 +34,10 @@ utils.assign_node_labels(utility: 'utility', windows_cpu: 'mxnetwindows-cpu') utils.main_wrapper( core_logic: { utils.parallel_stage('Build', [ - custom_steps.compile_windows_cpu() + custom_steps.compile_windows_cpu(), + custom_steps.compile_windows_cpu_mkldnn(), + custom_steps.compile_windows_cpu_mkldnn_mkl(), + custom_steps.compile_windows_cpu_mkl() ]) utils.parallel_stage('Tests', [ diff --git a/cmake/ChooseBlas.cmake b/cmake/ChooseBlas.cmake index 5f4af2d89c91..e16594794ae8 100644 --- a/cmake/ChooseBlas.cmake +++ b/cmake/ChooseBlas.cmake @@ -18,14 +18,14 @@ set(BLAS "Open" CACHE STRING "Selected BLAS library") set_property(CACHE BLAS PROPERTY STRINGS "Atlas;Open;MKL") -if(USE_MKL_IF_AVAILABLE) - if(NOT MKL_FOUND) - find_package(MKL) - endif() - if(MKL_FOUND) - if(USE_MKLDNN) - set(BLAS "open") - else() +if(DEFINED USE_BLAS) + set(BLAS "${USE_BLAS}") +else() + if(USE_MKL_IF_AVAILABLE) + if(NOT MKL_FOUND) + find_package(MKL) + endif() + if(MKL_FOUND) set(BLAS "MKL") endif() endif() diff --git a/cmake/Modules/FindMKL.cmake b/cmake/Modules/FindMKL.cmake index 70405566d8ae..51fca23c1161 100644 --- a/cmake/Modules/FindMKL.cmake +++ b/cmake/Modules/FindMKL.cmake @@ -43,55 +43,6 @@ endif() # ---[ Root folders set(INTEL_ROOT "/opt/intel" CACHE PATH "Folder contains intel libs") -if(USE_MKLDNN) - - find_path(MKL_ROOT include/mkl_blas.h - PATHS $ENV{MKL_ROOT} - ${INTEL_ROOT}/mklml - ${DIRECT_DEPENDENCY_ROOTS} - DOC "Folder contains MKL" - ) - - # ---[ Find include dir - find_path(MKL_INCLUDE_DIR mkl_blas.h PATHS ${MKL_ROOT} PATH_SUFFIXES include) - set(__looked_for MKL_INCLUDE_DIR) - - # ---[ Find libraries - if(CMAKE_SIZEOF_VOID_P EQUAL 4) - set(__path_suffixes lib lib/ia32) - else() - set(__path_suffixes lib lib/intel64) - endif() - - set(__mkl_libs "") - - if(WIN32) - list(APPEND __mkl_libs mklml_intel) - else() - list(APPEND __mkl_libs mklml_gnu) - endif() - list(APPEND __mkl_libs mkldnn) - - foreach (__lib ${__mkl_libs}) - set(__mkl_lib "${__lib}") - string(TOUPPER ${__mkl_lib} __mkl_lib_upper) - - if(MKL_USE_STATIC_LIBS) - set(__mkl_lib "lib${__mkl_lib}.a") - endif() - - find_library(${__mkl_lib_upper}_LIBRARY - NAMES ${__mkl_lib} - PATHS ${MKL_ROOT} "${MKL_INCLUDE_DIR}/.." - PATH_SUFFIXES ${__path_suffixes} - DOC "The path to Intel(R) MKL ${__mkl_lib} library") - mark_as_advanced(${__mkl_lib_upper}_LIBRARY) - - list(APPEND __looked_for ${__mkl_lib_upper}_LIBRARY) - list(APPEND MKL_LIBRARIES ${${__mkl_lib_upper}_LIBRARY}) - endforeach() - -else(USE_MKLDNN) # ---[ Options mxnet_option(MKL_USE_SINGLE_DYNAMIC_LIBRARY "Use single dynamic library interface" ON) @@ -193,7 +144,7 @@ else(USE_MKLDNN) list(APPEND MKL_LIBRARIES ${MKL_RTL_LIBRARY}) endif() -endif(USE_MKLDNN) + include(FindPackageHandleStandardArgs) find_package_handle_standard_args(MKL DEFAULT_MSG ${__looked_for})