From 42017a19e60af0a87782b39e2c416d8f8148fa14 Mon Sep 17 00:00:00 2001 From: lingyunli63 Date: Mon, 20 Jul 2020 09:28:34 +0800 Subject: [PATCH] enable compile gpu in akg --- CMakeLists.txt | 2 +- akg | 2 +- build.sh | 6 +++--- cmake/package.cmake | 2 +- mindspore/ccsrc/backend/kernel_compiler/common_utils.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c4da105cac2..8f12a512ce2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,7 @@ if (NOT Patch_FOUND) endif () message(PATCH_EXECUTABLE = ${Patch_EXECUTABLE}) -if (ENABLE_AKG AND ENABLE_D) +if (ENABLE_AKG AND (ENABLE_D OR ENABLE_GPU)) add_subdirectory("${CMAKE_SOURCE_DIR}/akg") endif() diff --git a/akg b/akg index f60af9df422..5237a9a08bf 160000 --- a/akg +++ b/akg @@ -1 +1 @@ -Subproject commit f60af9df4220bf3db5de2b224418953c0dc1f625 +Subproject commit 5237a9a08bfa03cc4c6be912a43d5efc0f4f153d diff --git a/build.sh b/build.sh index 63613a9e6bc..1eb75c1b3d6 100755 --- a/build.sh +++ b/build.sh @@ -276,7 +276,7 @@ checkopts "$@" echo "---------------- MindSpore: build start ----------------" mkdir -pv "${BUILD_PATH}/package/mindspore/lib" git submodule update --init graphengine -if [[ "X$ENABLE_AKG" = "Xon" ]] && [[ "X$ENABLE_D" = "Xon" ]]; then +if [[ "X$ENABLE_AKG" = "Xon" ]] && [[ "X$ENABLE_D" = "Xon" || "X$ENABLE_GPU" = "Xon" ]]; then git submodule update --init --recursive akg fi @@ -331,7 +331,7 @@ build_mindspore() CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_D=ON" fi if [[ "X$ENABLE_GPU" = "Xon" ]]; then - CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_GPU=ON -DCUDA_PATH=$CUDA_PATH -DCUDNN_PATH=$CUDNN_PATH -DMS_REQUIRE_CUDA_VERSION=${CUDA_VERSION}" + CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_GPU=ON -DUSE_CUDA=ON -DUSE_CUDNN=ON -DCUDA_PATH=$CUDA_PATH -DCUDNN_PATH=$CUDNN_PATH -DMS_REQUIRE_CUDA_VERSION=${CUDA_VERSION}" fi if [[ "X$ENABLE_CPU" = "Xon" ]]; then CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_CPU=ON" @@ -342,7 +342,7 @@ build_mindspore() if [[ "X$USE_GLOG" = "Xon" ]]; then CMAKE_ARGS="${CMAKE_ARGS} -DUSE_GLOG=ON" fi - if [[ "X$ENABLE_AKG" = "Xon" ]] && [[ "X$ENABLE_D" = "Xon" ]]; then + if [[ "X$ENABLE_AKG" = "Xon" ]] && [[ "X$ENABLE_D" = "Xon" || "X$ENABLE_GPU" = "Xon" ]]; then CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_AKG=ON" fi if [[ "X$ENABLE_SERVING" = "Xon" ]]; then diff --git a/cmake/package.cmake b/cmake/package.cmake index 7b3c2f7bb2e..9e98c782694 100644 --- a/cmake/package.cmake +++ b/cmake/package.cmake @@ -243,7 +243,7 @@ if (ENABLE_GPU) endif () endif () -if (ENABLE_D AND ENABLE_AKG) +if (ENABLE_AKG AND (ENABLE_D OR ENABLE_GPU)) set (AKG_PATH ${CMAKE_SOURCE_DIR}/build/mindspore/akg) install( DIRECTORY diff --git a/mindspore/ccsrc/backend/kernel_compiler/common_utils.h b/mindspore/ccsrc/backend/kernel_compiler/common_utils.h index 4f48d70b2cc..1c752474718 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/common_utils.h +++ b/mindspore/ccsrc/backend/kernel_compiler/common_utils.h @@ -40,7 +40,7 @@ constexpr auto kProcessorCuda = "cuda"; constexpr auto kJsonSuffix = ".json"; constexpr auto kInfoSuffix = ".info"; constexpr unsigned int AUTODIFF_COMPILE_OVERTIME = 600; -constexpr auto kAkgModule = "_akg"; +constexpr auto kAkgModule = "akg.ms"; constexpr auto kArgDataformat = "data_format"; const std::vector support_devices = {"aicore", "aicpu", "cuda"};