This is an automated email from the ASF dual-hosted git repository. lausen pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push: new 3140c55 Include all mkldnn headers in CD builds (#18355) 3140c55 is described below commit 3140c55e05e998682f4efd3f57a86d7a6322f142 Author: Leonard Lausen <lau...@amazon.com> AuthorDate: Mon May 18 22:43:30 2020 -0700 Include all mkldnn headers in CD builds (#18355) * Fix cmake mkldnn install target. Previously mkldnn headers are installed to CMAKE_INSTALL_INCLUDEDIR instead of CMAKE_INSTALL_INCLUDEDIR/mkldnn * Fix pypi_package.sh pip/setup.py for mkldnn builds --- CMakeLists.txt | 37 +++++++++++++++++-------------------- cd/python/pypi/pypi_package.sh | 6 +++--- tools/pip/setup.py | 2 +- 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 44d886a..790f31b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -254,24 +254,26 @@ if(USE_MKLDNN) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /EHsc /Gy /MT") endif() - set(MKLDNN_BUILD_TESTS OFF CACHE INTERNAL "" FORCE) - set(MKLDNN_BUILD_EXAMPLES OFF CACHE INTERNAL "" FORCE) - set(MKLDNN_ARCH_OPT_FLAGS "" CACHE INTERNAL "" FORCE) - set(MKLDNN_ENABLE_JIT_PROFILING OFF CACHE INTERNAL "" FORCE) - set(MKLDNN_LIBRARY_TYPE STATIC CACHE INTERNAL "" FORCE) - set(DNNL_ENABLE_CONCURRENT_EXEC ON CACHE INTERNAL "" FORCE) - - if(NOT USE_OPENMP) + function(load_mkldnn) + set(MKLDNN_BUILD_TESTS OFF CACHE INTERNAL "" FORCE) + set(MKLDNN_BUILD_EXAMPLES OFF CACHE INTERNAL "" FORCE) + set(MKLDNN_ARCH_OPT_FLAGS "" CACHE INTERNAL "" FORCE) + set(MKLDNN_ENABLE_JIT_PROFILING OFF CACHE INTERNAL "" FORCE) + set(MKLDNN_LIBRARY_TYPE STATIC CACHE INTERNAL "" FORCE) + set(DNNL_ENABLE_CONCURRENT_EXEC ON CACHE INTERNAL "" FORCE) + + if(NOT USE_OPENMP) set(MKLDNN_CPU_RUNTIME SEQ CACHE INTERNAL "" FORCE) - endif() - - add_subdirectory(3rdparty/mkldnn) + endif() + set(CMAKE_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/mkldnn") + add_subdirectory(3rdparty/mkldnn) + endfunction() + load_mkldnn() include_directories(3rdparty/mkldnn/include) include_directories(${PROJECT_BINARY_DIR}/3rdparty/mkldnn/include) add_definitions(-DMXNET_USE_MKLDNN=1) list(APPEND mxnet_LINKER_LIBS dnnl) - set(INSTALL_MKLDNN ON) endif() # Allow Cuda compiles outside of src tree to find things in 'src' and 'include' @@ -852,22 +854,17 @@ if(MSVC AND USE_MXNET_LIB_NAMING) endif() +# NOTE: Public headers will be installed into ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}, see +# https://cmake.org/cmake/help/v3.13/variable/CMAKE_INSTALL_PREFIX.html +# https://cmake.org/cmake/help/v3.13/module/GNUInstallDirs.html include(GNUInstallDirs) install(TARGETS ${MXNET_INSTALL_TARGETS} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) - -# NOTE: Public headers will be installed into ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}, see -# https://cmake.org/cmake/help/v3.0/variable/CMAKE_INSTALL_PREFIX.html -# https://cmake.org/cmake/help/v3.0/module/GNUInstallDirs.html - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/dlpack/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/dmlc-core/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -if(USE_MKLDNN) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/mkldnn/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -endif() install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/mshadow/mshadow/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mshadow) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/mxnet/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mxnet) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/tvm/nnvm/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/cd/python/pypi/pypi_package.sh b/cd/python/pypi/pypi_package.sh index f9a0b1e..a456084 100755 --- a/cd/python/pypi/pypi_package.sh +++ b/cd/python/pypi/pypi_package.sh @@ -28,9 +28,9 @@ export mxnet_variant=${1:?"Please specify the mxnet variant"} # and CD unpacks it to a directory called cd_misc # Nov. 2019 Update: With v1.1, MKL-DNN is renaming to DNNL. Hence changing the prefix of file name. if [ -f "cd_misc/dnnl_version.h" ]; then - mkdir -p 3rdparty/mkldnn/build/install/include - cp cd_misc/dnnl_version.h 3rdparty/mkldnn/build/install/include/. - cp cd_misc/dnnl_config.h 3rdparty/mkldnn/build/install/include/. + mkdir -p 3rdparty/mkldnn/include + cp cd_misc/dnnl_version.h 3rdparty/mkldnn/include/. + cp cd_misc/dnnl_config.h 3rdparty/mkldnn/include/. fi # Create wheel workspace diff --git a/tools/pip/setup.py b/tools/pip/setup.py index 3d44cc8a..616100e 100644 --- a/tools/pip/setup.py +++ b/tools/pip/setup.py @@ -150,7 +150,7 @@ short_description += ' This version uses {0}.'.format(' and '.join(libraries)) package_data = {'mxnet': [os.path.join('mxnet', os.path.basename(LIB_PATH[0]))], 'dmlc_tracker': []} if variant != 'NATIVE': - shutil.copytree(os.path.join(CURRENT_DIR, 'mxnet-build/3rdparty/mkldnn/build/install/include'), + shutil.copytree(os.path.join(CURRENT_DIR, 'mxnet-build/3rdparty/mkldnn/include'), os.path.join(CURRENT_DIR, 'mxnet/include/mkldnn')) if platform.system() == 'Linux': libdir, mxdir = os.path.dirname(LIB_PATH[0]), os.path.join(CURRENT_DIR, 'mxnet')