From 08940a7b25c3fb419e0945e4de87c5bb77b260b5 Mon Sep 17 00:00:00 2001 From: zhangzhaoju Date: Thu, 8 Jul 2021 08:24:33 +0800 Subject: [PATCH] Disable AVX while Enable ASAN solve build errors while change BUILD_PATH --- build.sh | 6 +++--- cmake/package.cmake | 10 ++++++---- cmake/package_script.cmake | 4 ++-- cmake/package_win.cmake | 2 ++ mindspore/ccsrc/CMakeLists.txt | 2 +- setup.py | 3 ++- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/build.sh b/build.sh index 32a5bcafe1e..a8b6987c217 100755 --- a/build.sh +++ b/build.sh @@ -459,7 +459,7 @@ build_mindspore() fi echo "${CMAKE_ARGS}" if [[ "X$INC_BUILD" = "Xoff" ]]; then - cmake ${CMAKE_ARGS} ../.. + cmake ${CMAKE_ARGS} ${BASEPATH} fi if [[ -n "$VERBOSE" ]]; then CMAKE_VERBOSE="--verbose" @@ -849,8 +849,8 @@ else echo "acl mode, skipping deploy phase" rm -rf ${BASEPATH}/output/_CPack_Packages/ else - cp -rf ${BUILD_PATH}/package/mindspore/lib ${BUILD_PATH}/../mindspore - cp -rf ${BUILD_PATH}/package/mindspore/*.so ${BUILD_PATH}/../mindspore + cp -rf ${BUILD_PATH}/package/mindspore/lib ${BASEPATH}/mindspore + cp -rf ${BUILD_PATH}/package/mindspore/*.so ${BASEPATH}/mindspore fi fi echo "---------------- MindSpore: build end ----------------" diff --git a/cmake/package.cmake b/cmake/package.cmake index bcc095b85dd..417b4813dd8 100644 --- a/cmake/package.cmake +++ b/cmake/package.cmake @@ -8,8 +8,10 @@ set(CPACK_GENERATOR "External") set(CPACK_CMAKE_GENERATOR "Ninja") set(CPACK_EXTERNAL_PACKAGE_SCRIPT ${CMAKE_SOURCE_DIR}/cmake/package_script.cmake) set(CPACK_EXTERNAL_ENABLE_STAGING true) -set(CPACK_TEMPORARY_PACKAGE_FILE_NAME ${CMAKE_SOURCE_DIR}/build/package/mindspore) -set(CPACK_TEMPORARY_INSTALL_DIRECTORY ${CMAKE_SOURCE_DIR}/build/package/mindspore) +set(CPACK_TEMPORARY_PACKAGE_FILE_NAME ${BUILD_PATH}/package/mindspore) +set(CPACK_TEMPORARY_INSTALL_DIRECTORY ${BUILD_PATH}/package/mindspore) +set(CPACK_PACK_ROOT_DIR ${BUILD_PATH}/package/) +set(CPACK_CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR}) if(ENABLE_GE) set(CPACK_MS_BACKEND "ge") set(CPACK_MS_TARGET "ascend or cpu") @@ -210,7 +212,7 @@ if(NOT ENABLE_GE) install( FILES ${CMAKE_BINARY_DIR}/graphengine/metadef/graph/libgraph.so - ${CMAKE_SOURCE_DIR}/build/graphengine/c_sec/lib/libc_sec.so + ${BUILD_PATH}/graphengine/c_sec/lib/libc_sec.so DESTINATION ${INSTALL_LIB_DIR} COMPONENT mindspore ) @@ -274,7 +276,7 @@ install( ) if((ENABLE_D OR ENABLE_GPU) AND ENABLE_AKG) - set (AKG_PATH ${CMAKE_SOURCE_DIR}/build/mindspore/akg) + set (AKG_PATH ${BUILD_PATH}/mindspore/akg) file(REMOVE_RECURSE ${AKG_PATH}/_akg) file(MAKE_DIRECTORY ${AKG_PATH}/_akg) file(TOUCH ${AKG_PATH}/_akg/__init__.py) diff --git a/cmake/package_script.cmake b/cmake/package_script.cmake index 67596df7a9a..edef651b414 100644 --- a/cmake/package_script.cmake +++ b/cmake/package_script.cmake @@ -19,8 +19,8 @@ endif() set(GIT ${GIT_EXECUTABLE}) # set path -set(MS_ROOT_DIR ${CPACK_PACKAGE_DIRECTORY}/../../) -set(MS_PACK_ROOT_DIR ${MS_ROOT_DIR}/build/package) +set(MS_ROOT_DIR ${CPACK_CMAKE_SOURCE_DIR}) +set(MS_PACK_ROOT_DIR ${CPACK_PACK_ROOT_DIR}) # set package file name if(CMAKE_SYSTEM_NAME MATCHES "Linux") diff --git a/cmake/package_win.cmake b/cmake/package_win.cmake index 038fcf7f391..bbed4e0ff07 100644 --- a/cmake/package_win.cmake +++ b/cmake/package_win.cmake @@ -10,6 +10,8 @@ set(CPACK_EXTERNAL_PACKAGE_SCRIPT ${CMAKE_SOURCE_DIR}/cmake/package_script.cmake set(CPACK_EXTERNAL_ENABLE_STAGING true) set(CPACK_TEMPORARY_PACKAGE_FILE_NAME ${CMAKE_SOURCE_DIR}/build/package/mindspore) set(CPACK_TEMPORARY_INSTALL_DIRECTORY ${CMAKE_SOURCE_DIR}/build/package/mindspore) +set(CPACK_PACK_ROOT_DIR ${BUILD_PATH}/package/) +set(CPACK_CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR}) if(ENABLE_GPU) set(CPACK_MS_BACKEND "ms") diff --git a/mindspore/ccsrc/CMakeLists.txt b/mindspore/ccsrc/CMakeLists.txt index 143fea769e3..6f2cc9b6b70 100644 --- a/mindspore/ccsrc/CMakeLists.txt +++ b/mindspore/ccsrc/CMakeLists.txt @@ -17,7 +17,7 @@ if(ENABLE_CPU) if(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "aarch64") set(PLATFORM_ARM64 "on") set(X86_64_SIMD "off") - elseif("${X86_64_SIMD}" STREQUAL "off") + elseif("${X86_64_SIMD}" STREQUAL "off" AND NOT ${ENABLE_ASAN}) set(X86_64_SIMD "avx") endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR}/backend/kernel_compiler/cpu) diff --git a/setup.py b/setup.py index 35a484be3f0..b7c4612a823 100644 --- a/setup.py +++ b/setup.py @@ -27,9 +27,10 @@ backend_policy = os.getenv('BACKEND_POLICY') device_target = os.getenv('BACKEND_TARGET') commit_id = os.getenv('COMMIT_ID').replace("\n", "") package_name = os.getenv('MS_PACKAGE_NAME').replace("\n", "") +build_path = os.getenv('BUILD_PATH') pwd = os.path.dirname(os.path.realpath(__file__)) -pkg_dir = os.path.join(pwd, 'build/package') +pkg_dir = os.path.join(build_path, 'package') def _read_file(filename):