From 9ea8c83641665b1018563b63c4f9b3fd73c7ed43 Mon Sep 17 00:00:00 2001 From: taoxiangdong Date: Thu, 15 Oct 2020 17:03:48 +0800 Subject: [PATCH 1/3] update cmake bugs --- CMakeLists.txt | 2 +- build.sh | 2 +- ge/CMakeLists.txt | 2 +- .../securec/0001-add-securec-cmake-script.patch | 16 ++++++++-------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c0928300..00fdece8 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ if (ENABLE_OPEN_SRC) # for CPU/GPU mode, find c_sec and slog from local prebuild if(NOT ENABLE_D AND NOT GE_ONLY) - set(GE_PREBUILD_PATH ${GE_SOURCE_DIR}/third_party/prebuild/${CMAKE_HOST_SYSTEM_PROCESSOR}) + set(GE_PREBUILD_PATH ${GE_CODE_DIR}/third_party/prebuild/${CMAKE_HOST_SYSTEM_PROCESSOR}) find_module(slog libslog.so ${GE_PREBUILD_PATH}) # if D_LINK_PATH is set in environment variables, search libraries in given path elseif(DEFINED ENV{D_LINK_PATH}) diff --git a/build.sh b/build.sh index eb1b4891..f0a997a7 100644 --- a/build.sh +++ b/build.sh @@ -117,7 +117,7 @@ build_graphengine() CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_GE_ST=ON" fi - CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_OPEN_SRC=True + CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_OPEN_SRC=True" echo "${CMAKE_ARGS}" cmake ${CMAKE_ARGS} ../.. make ${VERBOSE} -j${THREAD_NUM} diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index a1f558a7..4ee4fd2d 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -4,7 +4,7 @@ add_subdirectory(graph/build/memory) add_subdirectory(ge_local_engine) add_subdirectory(host_cpu_engine) add_subdirectory(executor) -#add_subdirectory(offline) +add_subdirectory(offline) set(PROTO_LIST "${METADEF_DIR}/proto/fusion_model.proto" diff --git a/third_party/patch/securec/0001-add-securec-cmake-script.patch b/third_party/patch/securec/0001-add-securec-cmake-script.patch index 8d338a01..0fcf50c4 100644 --- a/third_party/patch/securec/0001-add-securec-cmake-script.patch +++ b/third_party/patch/securec/0001-add-securec-cmake-script.patch @@ -1,4 +1,4 @@ -From f568b2731ac5356673e43361d718bb12704e05a9 Mon Sep 17 00:00:00 2001 +From 455c9812d70646fe725896d597d6c953bf5a09ac Mon Sep 17 00:00:00 2001 From: taoxiangdong Date: Wed, 14 Oct 2020 22:14:01 +0800 Subject: [PATCH] add securec cmake script @@ -10,15 +10,15 @@ Subject: [PATCH] add securec cmake script diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 -index 0000000..7d59953 +index 0000000..9b91fb2 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,86 @@ +cmake_minimum_required(VERSION 3.14) -+project (Securec) ++project(Securec) +file(GLOB SRC_LIST RELATIVE ${CMAKE_CURRENT_LIST_DIR} + "src/vsprintf_s.c" -+ "src/wmemmove_s" ++ "src/wmemmove_s.c" + "src/strncat_s.c" + "src/vsnprintf_s.c" + "src/fwscanf_s.c" @@ -59,7 +59,7 @@ index 0000000..7d59953 + ) + +include_directories(./include) -+include_directories(../src) ++include_directories(./src) +add_library(shared_c_sec SHARED ${SRC_LIST}) + +target_compile_options(shared_c_sec PRIVATE @@ -71,7 +71,7 @@ index 0000000..7d59953 +target_compile_definitions(shared_c_sec PRIVATE + NDEBUG + SECUREC_SUPPORT_STRTOLD=1 -+) ++ ) + +add_library(static_c_sec STATIC ${SRC_LIST}) + @@ -82,10 +82,10 @@ index 0000000..7d59953 + -O1 +) + -+target_compile_options(static_c_sec PRIVATE ++target_compile_definitions(static_c_sec PRIVATE + NDEBUG + SECUREC_SUPPORT_STRTOLD=1 -+) ++ ) + +set_target_properties(static_c_sec + PROPERTIES From 97f1e942fe466bb3316e4a71fcc4d1a32bbfd46b Mon Sep 17 00:00:00 2001 From: taoxiangdong Date: Fri, 16 Oct 2020 15:54:38 +0800 Subject: [PATCH 2/3] update graphengine cmakelists --- cmake/external_libs/protobuf_shared.cmake | 2 +- ge/CMakeLists.txt | 1 + ge/executor/CMakeLists.txt | 1 + ge/ge_local_engine/CMakeLists.txt | 5 +++++ ge/graph/build/memory/CMakeLists.txt | 1 + ge/host_cpu_engine/CMakeLists.txt | 5 +++++ ge/plugin/engine/CMakeLists.txt | 1 + 7 files changed, 15 insertions(+), 1 deletion(-) diff --git a/cmake/external_libs/protobuf_shared.cmake b/cmake/external_libs/protobuf_shared.cmake index 443cc681..59cc7ff3 100755 --- a/cmake/external_libs/protobuf_shared.cmake +++ b/cmake/external_libs/protobuf_shared.cmake @@ -16,7 +16,7 @@ set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack") ExternalProject_Add(protobuf_build URL https://github.com/protocolbuffers/protobuf/archive/v3.8.0.tar.gz #URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz - #SOURCE_DIR ${GE_CODE_DIR}/third_party/protobuf/src/protobuf-3.8.0 + #SOURCE_DIR ${GE_CODE_DIR}/../third_party/protobuf/src/protobuf-3.8.0 DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E copy_directory ${GE_CODE_DIR}/../third_party/protobuf/src/protobuf-3.8.0 #CONFIGURE_COMMAND ${CMAKE_COMMAND} #-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 4ee4fd2d..6141acb1 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -786,6 +786,7 @@ target_include_directories(fwk_stub_ge_runner PRIVATE ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework ${GE_CODE_DIR}/inc/framework/common + ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph ${METADEF_DIR}/inc/graph #### yellow zone #### diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt index d818497c..1709fe04 100755 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -90,6 +90,7 @@ target_include_directories(ge_executor PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework + ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph diff --git a/ge/ge_local_engine/CMakeLists.txt b/ge/ge_local_engine/CMakeLists.txt index 7223c697..e8aa5453 100755 --- a/ge/ge_local_engine/CMakeLists.txt +++ b/ge/ge_local_engine/CMakeLists.txt @@ -34,6 +34,7 @@ target_include_directories(ge_local_engine PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework + ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph @@ -73,6 +74,7 @@ target_include_directories(atc_ge_local_engine PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework + ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph @@ -113,6 +115,7 @@ target_include_directories(ge_local_opskernel_builder PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework + ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph @@ -147,6 +150,7 @@ target_include_directories(atc_ge_local_opskernel_builder PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework + ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph @@ -186,6 +190,7 @@ target_include_directories(ge_local_opskernel_builder_static PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework + ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph diff --git a/ge/graph/build/memory/CMakeLists.txt b/ge/graph/build/memory/CMakeLists.txt index dda7b9ea..e968d969 100644 --- a/ge/graph/build/memory/CMakeLists.txt +++ b/ge/graph/build/memory/CMakeLists.txt @@ -31,6 +31,7 @@ target_include_directories(ge_memory PRIVATE ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph ${GE_CODE_DIR}/inc/framework + ${GE_CODE_DIR}/third_party/fwkacllib/inc #### yellow zone #### ${GE_CODE_DIR}/../inc ) diff --git a/ge/host_cpu_engine/CMakeLists.txt b/ge/host_cpu_engine/CMakeLists.txt index e78eee2e..a1c19eac 100644 --- a/ge/host_cpu_engine/CMakeLists.txt +++ b/ge/host_cpu_engine/CMakeLists.txt @@ -28,6 +28,7 @@ target_include_directories(host_cpu_engine PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework + ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph @@ -66,6 +67,7 @@ target_include_directories(atc_host_cpu_engine PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework + ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph @@ -105,6 +107,7 @@ target_include_directories(host_cpu_opskernel_builder PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework + ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph @@ -138,6 +141,7 @@ target_include_directories(atc_host_cpu_opskernel_builder PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework + ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph @@ -176,6 +180,7 @@ target_include_directories(host_cpu_opskernel_builder_static PRIVATE ${GE_CODE_DIR}/inc ${GE_CODE_DIR}/inc/external ${GE_CODE_DIR}/inc/framework + ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${METADEF_DIR}/inc/external/graph diff --git a/ge/plugin/engine/CMakeLists.txt b/ge/plugin/engine/CMakeLists.txt index 751da08e..6515bda5 100644 --- a/ge/plugin/engine/CMakeLists.txt +++ b/ge/plugin/engine/CMakeLists.txt @@ -21,6 +21,7 @@ target_include_directories(engine PRIVATE ${GE_CODE_DIR}/inc/framework ${GE_CODE_DIR}/inc/framework/common ${GE_CODE_DIR}/inc/external + ${GE_CODE_DIR}/third_party/fwkacllib/inc ${METADEF_DIR}/inc ${METADEF_DIR}/inc/external ${CMAKE_BINARY_DIR} From abb77c8ff0ef92e0c9fccae3f84068ed243f1154 Mon Sep 17 00:00:00 2001 From: taoxiangdong Date: Fri, 16 Oct 2020 16:00:08 +0800 Subject: [PATCH 3/3] add ascendcl cmakelis --- ge/CMakeLists.txt | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 6141acb1..c20d873b 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -704,6 +704,42 @@ target_link_libraries(ge_compiler -ldl ) +############ libascendcl.so ############ +add_library(opensrc_ascendc SHARED ${DUMMY_OBJ}) + +target_link_libraries(opensrc_ascendcl PRIVATE + -Wl, --whole-archive + ge_executor + ascendcl_static + ge_common_static + graph_static + protobuf_static + register_static + error_manager_static + adump_server + msprofiler + -Wl, --no-whole-archive + -Wl, --no-as-needed + c_sec + runtime + mmpa + slog + msprof + ascend_hal_stub + -Wl, --as-needed + $<$>:-lrt> + -ldl + $<$:-llog> + json +) + +set_target_properties(opensrc_ascendc PROPERTIES + OUTPUT_NAME ascendcl +) + +file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/dummy.c CONTENT "") +add_library(dummy_obj OBJECT ${CMAKE_BINARY_DIR}/dummy.c) +set(DUMMY_OBJ $) ################################################################## add_custom_command(