Browse Source

update master code sync from 1030 yellow zone

pull/266/head
taoxiangdong 4 years ago
parent
commit
e39a051561
100 changed files with 553 additions and 646 deletions
  1. +117
    -121
      CMakeLists.txt
  2. +63
    -20
      build.sh
  3. +23
    -0
      cmake/FindModule.cmake
  4. +0
    -22
      cmake/external_libs/eigen.cmake
  5. +0
    -24
      cmake/external_libs/gtest.cmake
  6. +4
    -11
      cmake/external_libs/json.cmake
  7. +1
    -0
      cmake/external_libs/onnx.cmake
  8. +0
    -63
      cmake/external_libs/protobuf.cmake
  9. +3
    -3
      cmake/external_libs/protobuf_shared.cmake
  10. +62
    -11
      cmake/external_libs/securec.cmake
  11. +0
    -371
      cmake/ge_utils.cmake
  12. +52
    -0
      cmake/intf_pub_android.cmake
  13. +33
    -0
      cmake/intf_pub_linux.cmake
  14. +24
    -0
      cmake/intf_pub_windows.cmake
  15. +0
    -0
      ge/README.md
  16. +0
    -0
      ge/analyzer/analyzer.cc
  17. +0
    -0
      ge/analyzer/analyzer.h
  18. +0
    -0
      ge/client/ge_api.cc
  19. +0
    -0
      ge/client/ge_prof.cc
  20. +0
    -0
      ge/client/module.mk
  21. +0
    -0
      ge/client/proto/ge_api.proto
  22. +0
    -0
      ge/client/proto/ge_ir.proto
  23. +0
    -0
      ge/client/proto/insert_op.proto
  24. +0
    -0
      ge/client/proto/om.proto
  25. +0
    -0
      ge/client/proto/task.proto
  26. +171
    -0
      ge/common/CMakeLists.txt
  27. +0
    -0
      ge/common/auth/file_saver.cc
  28. +0
    -0
      ge/common/auth/file_saver.h
  29. +0
    -0
      ge/common/base64.h
  30. +0
    -0
      ge/common/context/ctx.cc
  31. +0
    -0
      ge/common/convert/pb2json.cc
  32. +0
    -0
      ge/common/convert/pb2json.h
  33. +0
    -0
      ge/common/cust_aicpu_kernel_store.cc
  34. +0
    -0
      ge/common/cust_aicpu_kernel_store.h
  35. +0
    -0
      ge/common/debug/memory_dumper.cc
  36. +0
    -0
      ge/common/debug/memory_dumper.h
  37. +0
    -0
      ge/common/dump/dump_manager.cc
  38. +0
    -0
      ge/common/dump/dump_manager.h
  39. +0
    -0
      ge/common/dump/dump_op.cc
  40. +0
    -0
      ge/common/dump/dump_op.h
  41. +0
    -0
      ge/common/dump/dump_properties.cc
  42. +0
    -0
      ge/common/dump/dump_properties.h
  43. +0
    -0
      ge/common/dump/dump_server.cc
  44. +0
    -0
      ge/common/fmk_error_codes.cc
  45. +0
    -0
      ge/common/formats/format_transfers/datatype_transfer.cc
  46. +0
    -0
      ge/common/formats/format_transfers/datatype_transfer.h
  47. +0
    -0
      ge/common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc
  48. +0
    -0
      ge/common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.h
  49. +0
    -0
      ge/common/formats/format_transfers/format_transfer_dhwcn_fracz3D.cc
  50. +0
    -0
      ge/common/formats/format_transfers/format_transfer_dhwcn_fracz3D.h
  51. +0
    -0
      ge/common/formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc
  52. +0
    -0
      ge/common/formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.h
  53. +0
    -0
      ge/common/formats/format_transfers/format_transfer_fractal_nz.cc
  54. +0
    -0
      ge/common/formats/format_transfers/format_transfer_fractal_nz.h
  55. +0
    -0
      ge/common/formats/format_transfers/format_transfer_fractal_z.cc
  56. +0
    -0
      ge/common/formats/format_transfers/format_transfer_fractal_z.h
  57. +0
    -0
      ge/common/formats/format_transfers/format_transfer_fractal_zz.cc
  58. +0
    -0
      ge/common/formats/format_transfers/format_transfer_fractal_zz.h
  59. +0
    -0
      ge/common/formats/format_transfers/format_transfer_fracz_hwcn.cc
  60. +0
    -0
      ge/common/formats/format_transfers/format_transfer_fracz_hwcn.h
  61. +0
    -0
      ge/common/formats/format_transfers/format_transfer_fracz_nchw.cc
  62. +0
    -0
      ge/common/formats/format_transfers/format_transfer_fracz_nchw.h
  63. +0
    -0
      ge/common/formats/format_transfers/format_transfer_fracz_nhwc.cc
  64. +0
    -0
      ge/common/formats/format_transfers/format_transfer_fracz_nhwc.h
  65. +0
    -0
      ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc
  66. +0
    -0
      ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.h
  67. +0
    -0
      ge/common/formats/format_transfers/format_transfer_nc1hwc0_nchw.cc
  68. +0
    -0
      ge/common/formats/format_transfers/format_transfer_nc1hwc0_nchw.h
  69. +0
    -0
      ge/common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc
  70. +0
    -0
      ge/common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.h
  71. +0
    -0
      ge/common/formats/format_transfers/format_transfer_nchw_fz_c04.cc
  72. +0
    -0
      ge/common/formats/format_transfers/format_transfer_nchw_fz_c04.h
  73. +0
    -0
      ge/common/formats/format_transfers/format_transfer_nchw_nc1hwc0.cc
  74. +0
    -0
      ge/common/formats/format_transfers/format_transfer_nchw_nc1hwc0.h
  75. +0
    -0
      ge/common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc
  76. +0
    -0
      ge/common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.h
  77. +0
    -0
      ge/common/formats/format_transfers/format_transfer_transpose.cc
  78. +0
    -0
      ge/common/formats/format_transfers/format_transfer_transpose.h
  79. +0
    -0
      ge/common/formats/formats.cc
  80. +0
    -0
      ge/common/formats/formats.h
  81. +0
    -0
      ge/common/formats/utils/formats_definitions.h
  82. +0
    -0
      ge/common/formats/utils/formats_trans_utils.cc
  83. +0
    -0
      ge/common/formats/utils/formats_trans_utils.h
  84. +0
    -0
      ge/common/fp16_t.cc
  85. +0
    -0
      ge/common/fp16_t.h
  86. +0
    -0
      ge/common/ge/datatype_util.cc
  87. +0
    -0
      ge/common/ge/datatype_util.h
  88. +0
    -0
      ge/common/ge/ge_util.h
  89. +0
    -0
      ge/common/ge/op_tiling_manager.cc
  90. +0
    -0
      ge/common/ge/op_tiling_manager.h
  91. +0
    -0
      ge/common/ge/plugin_manager.cc
  92. +0
    -0
      ge/common/ge/plugin_manager.h
  93. +0
    -0
      ge/common/ge/tbe_plugin_manager.cc
  94. +0
    -0
      ge/common/ge/tbe_plugin_manager.h
  95. +0
    -0
      ge/common/ge_common.mk
  96. +0
    -0
      ge/common/ge_format_util.cc
  97. +0
    -0
      ge/common/helper/model_cache_helper.cc
  98. +0
    -0
      ge/common/helper/model_cache_helper.h
  99. +0
    -0
      ge/common/helper/model_helper.cc
  100. +0
    -0
      ge/common/helper/om_file_helper.cc

+ 117
- 121
CMakeLists.txt View File

@@ -1,137 +1,133 @@
# Copyright 2019-2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================

cmake_minimum_required(VERSION 3.14)
project (GraphEngine[CXX])
set(CMAKE_CXX_STANDARD 17)
add_compile_definitions(_GLIBCXX_USE_CXX11_ABI=0)

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
set(GE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
set(GE_PROTO_DIR ${GE_SOURCE_DIR}/src)
set(GE_CODE_DIR ${CMAKE_CURRENT_LIST_DIR})
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE)

if (NOT BUILD_PATH)
set(BUILD_PATH "${CMAKE_SOURCE_DIR}/build")
endif()
# architecture: aarch64 or x86_64
message(STATUS "System architecture: ${CMAKE_HOST_SYSTEM_PROCESSOR}")
# system: euleros or ubuntu
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
execute_process(
COMMAND bash "-c" "cat /etc/os-release | grep ^ID= | awk -F '=' '{print $2}'"
OUTPUT_VARIABLE SYSTEM_TYPE
)
MESSAGE(STATUS "System type: ${SYSTEM_TYPE}.")
endif()

# download json headers, rather than whole repository
include(${GE_SOURCE_DIR}/cmake/ge_utils.cmake)
include(${GE_SOURCE_DIR}/cmake/external_libs/json.cmake)
include(${GE_SOURCE_DIR}/cmake/external_libs/eigen.cmake)
include(${GE_SOURCE_DIR}/cmake/external_libs/gtest.cmake)
#include(${GE_SOURCE_DIR}/cmake/external_libs/protobuf.cmake)
include(${GE_SOURCE_DIR}/cmake/external_libs/protobuf_shared.cmake)
include(${GE_SOURCE_DIR}/cmake/external_libs/protoc.cmake)
include(${GE_SOURCE_DIR}/cmake/external_libs/onnx.cmake)
include(${GE_SOURCE_DIR}/cmake/external_libs/securec.cmake)
set(CMAKE_SKIP_RPATH TRUE)
option(ENABLE_OPEN_SRC "Enable graphengine compile in opensource." FALSE)

# 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})
find_library(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})
# D_LINK_PATH is set
set(GE_LIB_PATH $ENV{D_LINK_PATH})
set(GE_SYS_ARCH "")
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
# x86 ubuntu
set(GE_SYS_ARCH "x86_64")
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "aarch64")
# arm euleros
set(GE_SYS_ARCH "aarch64")
else()
message(FATAL_ERROR "Running on a unsupported architecture: ${SYSTEM_TYPE}, build terminated")
endif()
set(GE_LIB_PATH ${GE_LIB_PATH}/${GE_SYS_ARCH})
find_library(slog libslog.so ${GE_LIB_PATH})
find_library(mmpa libmmpa.so ${GE_LIB_PATH})
find_library(runtime libruntime.so ${GE_LIB_PATH})
find_library(msprof libmsprofiler.a ${GE_LIB_PATH})
find_library(register libregister.so ${GE_LIB_PATH})
find_library(hccl libhccl.so ${GE_LIB_PATH})
find_library(resource libresource.so ${GE_LIB_PATH})
find_library(error_manager liberror_manager.so ${GE_LIB_PATH})
find_library(adump_server libadump_server.a ${GE_LIB_PATH})
else()
# Ascend mode
if(DEFINED ENV{ASCEND_CUSTOM_PATH})
set(ASCEND_DIR $ENV{ASCEND_CUSTOM_PATH})
else()
set(ASCEND_DIR /usr/local/Ascend)
endif()
set(ASCEND_DRIVER_DIR ${ASCEND_DIR}/driver/lib64/common)
set(ASCEND_RUNTIME_DIR ${ASCEND_DIR}/fwkacllib/lib64)
find_library(slog libslog.so ${ASCEND_DRIVER_DIR})
find_library(mmpa libmmpa.so ${ASCEND_DRIVER_DIR})
find_library(msprof libmsprofiler.a ${ASCEND_RUNTIME_DIR})
if (ENABLE_OPEN_SRC)
set(HI_PYTHON python3.7)

find_library(hccl libhccl.so ${ASCEND_RUNTIME_DIR})
find_library(runtime libruntime.so ${ASCEND_RUNTIME_DIR})
find_library(register libregister.so ${ASCEND_RUNTIME_DIR})
find_library(resource libresource.so ${ASCEND_RUNTIME_DIR})
find_library(error_manager liberror_manager.so ${ASCEND_RUNTIME_DIR})
find_library(adump_server libadump_server.a ${ASCEND_RUNTIME_DIR})
endif()
include(cmake/external_libs/protobuf_shared.cmake)
include(cmake/external_libs/protobuf_static.cmake)
include(cmake/external_libs/protoc.cmake)
include(cmake/external_libs/gflags.cmake)
include(cmake/external_libs/securec.cmake)
include(cmake/external_libs/json.cmake)
include(cmake/FindModule.cmake)
include(cmake/intf_pub_linux.cmake)

# add compile flags
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
message("Build in Debug mode")
set(CMAKE_C_FLAGS "-O0 -g -Wall -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe -fPIC ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-O0 -g -Wall -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe -fPIC ${CMAKE_CXX_FLAGS}")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic")
# 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_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
if(DEFINED ENV{D_LINK_PATH})
# D_LINK_PATH is set
set(GE_LIB_PATH $ENV{D_LINK_PATH})
set(GE_SYS_ARCH "")
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
# x86 ubuntu
set(GE_SYS_ARCH "x86_64")
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "aarch64")
# arm euleros
set(GE_SYS_ARCH "aarch64")
else()
message(FATAL_ERROR "Running on a unsupported architecture: ${SYSTEM_TYPE}, build terminated")
endif()
set(GE_LIB_PATH ${GE_LIB_PATH}/${GE_SYS_ARCH})
set(STATIC_ACL_LIB ${GE_LIB_PATH})
find_module(slog libslog.so ${GE_LIB_PATH})
find_module(mmpa libmmpa.so ${GE_LIB_PATH})
find_module(msprof libmsprof.so ${GE_LIB_PATH})
find_module(hccl libhccl.so ${GE_LIB_PATH})
find_module(adump_server libadump_server.a ${GE_LIB_PATH})
find_module(runtime libruntime.so ${GE_LIB_PATH})
find_module(runtime_compile libruntime_compile.so ${GE_LIB_PATH})
find_module(resource libresource.so ${GE_LIB_PATH})
find_module(error_manager liberror_manager.so ${GE_LIB_PATH})
find_module(ascend_hal_stub libascend_hal.so ${GE_LIB_PATH})
find_module(error_manager_static liberror_manager.a ${GE_LIB_PATH})
find_module(msprofiler libmsprofiler.a ${GE_LIB_PATH})
else()
if(DEFINED ENV{ASCEND_CUSTOM_PATH})
set(ASCEND_DIR $ENV{ASCEND_CUSTOM_PATH})
else()
set(ASCEND_DIR /usr/local/Ascend)
endif()
set(ASCEND_DRIVER_DIR ${ASCEND_DIR}/driver/lib64)
set(ASCEND_DRIVER_COMMON_DIR ${ASCEND_DIR}/driver/lib64/common)
set(ASCEND_DRIVER_SHARE_DIR ${ASCEND_DIR}/driver/lib64/share)
set(ASCEND_RUNTIME_DIR ${ASCEND_DIR}/fwkacllib/lib64)
set(ASCEND_ATC_DIR ${ASCEND_DIR}/atc/lib64)
set(ASCEND_ACL_DIR ${ASCEND_DIR}/acllib/lib64)
set(STATIC_ACL_LIB ${ASCEND_ACL_DIR})
find_module(slog libslog.so ${ASCEND_ATC_DIR})
find_module(mmpa libmmpa.so ${ASCEND_ATC_DIR})
if(PLATFORM STREQUAL "train")
find_module(msprof libmsprof.so ${ASCEND_DRIVER_COMMON_DIR})
find_module(hccl libhccl.so ${ASCEND_RUNTIME_DIR})
find_module(adump_server libadump_server.a ${ASCEND_RUNTIME_DIR})
find_module(runtime libruntime.so ${ASCEND_RUNTIME_DIR})
find_module(resource libresource.so ${ASCEND_RUNTIME_DIR})
find_module(error_manager liberror_manager.so ${ASCEND_RUNTIME_DIR})
find_module(msprofiler libmsprofiler.a ${ASCEND_RUNTIME_DIR})
find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR}/driver)
if(PRODUCT STREQUAL "flr3")
message(FATAL_ERROR "This platform is not supported in train mode, build terminated")
endif()
elseif(PLATFORM STREQUAL "inference")
find_module(adump_server libadump_server.a ${ASCEND_ACL_DIR})
find_module(runtime libruntime.so ${ASCEND_ACL_DIR})
find_module(runtime_compile libruntime_compile.so ${ASCEND_ATC_DIR})
find_module(resource libresource.so ${ASCEND_ATC_DIR})
find_module(error_manager liberror_manager.so ${ASCEND_ATC_DIR})
find_module(error_manager_static liberror_manager.a ${ASCEND_ACL_DIR})
find_module(msprofiler libmsprofiler.a ${ASCEND_ACL_DIR})
if(PRODUCT STREQUAL "flr3")
find_module(msprof libmsprof.so ${ASCEND_DRIVER_SHARE_DIR})
elseif(PRODUCT STREQUAL "flr1")
find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR}/driver)
find_module(msprof libmsprof.so ${ASCEND_DRIVER_COMMON_DIR})
elseif(PRODUCT STREQUAL "flr2")
# flr2 ascend_hal_stub limsprof ?
else()
find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR})
find_module(msprof libmsprof.so ${ASCEND_DRIVER_DIR})
endif()
elseif(PLATFORM STREQUAL "all")
find_module(msprof libmsprof.so ${ASCEND_DRIVER_COMMON_DIR})
find_module(hccl libhccl.so ${ASCEND_RUNTIME_DIR})
find_module(adump_server libadump_server.a ${ASCEND_ACL_DIR})
find_module(runtime libruntime.so ${ASCEND_ACL_DIR})
find_module(runtime_compile libruntime_compile.so ${ASCEND_ATC_DIR})
find_module(resource libresource.so ${ASCEND_ATC_DIR})
find_module(error_manager liberror_manager.so ${ASCEND_ATC_DIR})
find_module(error_manager_static liberror_manager.a ${ASCEND_ACL_DIR})
find_module(msprofiler libmsprofiler.a ${ASCEND_ACL_DIR})
find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR}/driver)
else()
message(FATAL_ERROR "PLATFORM param is invalid, should be train or inference, build terminated")
endif()
endif()
else()
set(CMAKE_C_FLAGS "-O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}")
endif ()

# force __FILE__ to show relative path of file, from source directory, as cmake project makes __FILE__ absolute directory
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILE__='\"$(subst $(realpath ${CMAKE_SOURCE_DIR})/,,$(abspath $<))\"' -Wno-builtin-macro-redefined")
set(METADEF_DIR ${CMAKE_CURRENT_LIST_DIR}/metadef)
set(PARSER_DIR ${CMAKE_CURRENT_LIST_DIR}/parser)
set(GE_DEPEND_DIR ${CMAKE_CURRENT_LIST_DIR}/..)

# compile libraries from following directories
# libgraph is compiled in any situation
add_subdirectory(${GE_SOURCE_DIR}/src/common/graph)
if(ENABLE_D)
# if MindSpore compiles in D mode, compile the following libraries
add_subdirectory(${GE_SOURCE_DIR}/src/ge/common)
add_subdirectory(${GE_SOURCE_DIR}/src/ge/ge_runtime)
elseif(GE_ONLY)
# standalone GraphEngine compiles all following libraries
add_subdirectory(${GE_SOURCE_DIR}/src/ge/common)
add_subdirectory(${GE_SOURCE_DIR}/src/ge/ge_runtime)
add_subdirectory(${GE_SOURCE_DIR}/src/ge/ge_local_engine)
add_subdirectory(${GE_SOURCE_DIR}/src/ge/graph/build/memory)
add_subdirectory(${GE_SOURCE_DIR}/src/ge/)
add_subdirectory(${GE_SOURCE_DIR}/src/ge/plugin/engine)
add_subdirectory(metadef)
add_subdirectory(parser)
#add_subdirectory(metadef/graph)
#add_subdirectory(metadef/register)
else()
set(METADEF_DIR ${CMAKE_CURRENT_LIST_DIR}/../metadef)
set(PARSER_DIR ${CMAKE_CURRENT_LIST_DIR}/../parser)
set(GE_DEPEND_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
endif()

# if (ENABLE_GE_COV OR ENABLE_GE_UT OR ENABLE_GE_ST)
# add_subdirectory(tests)
# endif()

add_subdirectory(ge)

+ 63
- 20
build.sh View File

@@ -32,6 +32,7 @@ usage()
echo " -j[n] Set the number of threads used for building GraphEngine, default is 8"
echo " -t Build and execute ut"
echo " -c Build ut with coverage tag"
echo " -p Build inference or train"
echo " -v Display build command"
echo " -S Enable enable download cmake compile dependency from gitee , default off"
echo "to be continued ..."
@@ -112,6 +113,9 @@ checkopts()
}
checkopts "$@"

git submodule update --init metadef
git submodule update --init parser

mk_dir() {
local create_dir="$1" # the target to make

@@ -126,8 +130,8 @@ echo "---------------- GraphEngine build start ----------------"
build_graphengine()
{
echo "create build directory and build GraphEngine";
mk_dir "${BUILD_PATH}/graphengine"
cd "${BUILD_PATH}/graphengine"
mk_dir "${BUILD_PATH}"
cd "${BUILD_PATH}"
CMAKE_ARGS="-DBUILD_PATH=$BUILD_PATH -DGE_ONLY=$GE_ONLY"

if [[ "X$ENABLE_GE_COV" = "Xon" ]]; then
@@ -177,11 +181,11 @@ build_graphengine()
echo "GraphEngine build success!"
}
g++ -v
build_graphengine
echo "---------------- GraphEngine build finished ----------------"
mk_dir ${OUTPUT_PATH}
cp -rf "${BUILD_PATH}/graphengine/"*.so "${OUTPUT_PATH}"
rm -rf "${OUTPUT_PATH}/"libproto*
build_graphengine || { echo "GraphEngine build failed."; return; }
echo "---------------- GraphEngine build finished ----------------"
#cp -rf "${BUILD_PATH}/graphengine/"*.so "${OUTPUT_PATH}"
#rm -rf "${OUTPUT_PATH}/"libproto*
rm -f ${OUTPUT_PATH}/libgmock*.so
rm -f ${OUTPUT_PATH}/libgtest*.so
rm -f ${OUTPUT_PATH}/lib*_stub.so
@@ -229,43 +233,82 @@ echo "---------------- GraphEngine output generated ----------------"
generate_package()
{
cd "${BASEPATH}"

GRAPHENGINE_LIB_PATH="lib"
ACL_PATH="acllib/lib64"
FWK_PATH="fwkacllib/lib64"
ATC_PATH="atc/lib64"
ATC_BIN_PATH="atc/bin"
NNENGINE_PATH="plugin/nnengine/ge_config"
OPSKERNEL_PATH="plugin/opskernel"

ATC_LIB=("libc_sec.so" "libge_common.so" "libge_compiler.so" "libgraph.so")
FWK_LIB=("libge_common.so" "libge_runner.so" "libgraph.so")
ATC_LIB=("libc_sec.so" "libge_common.so" "libge_compiler.so" "libgraph.so" "libregister.so")
FWK_LIB=("libge_common.so" "libge_runner.so" "libgraph.so" "libregister.so")
PLUGIN_OPSKERNEL=("libge_local_engine.so" "libge_local_opskernel_builder.so" "libhost_cpu_engine.so" "libhost_cpu_opskernel_builder.so" "optimizer_priority.pbtxt")
PARSER_LIB=("lib_caffe_parser.so" "libfmk_onnx_parser.so" "libfmk_parser.so" "libparser_common.so")

rm -rf ${OUTPUT_PATH:?}/${FWK_PATH}/
rm -rf ${OUTPUT_PATH:?}/${ACL_PATH}/
rm -rf ${OUTPUT_PATH:?}/${ATC_PATH}/
rm -rf ${OUTPUT_PATH:?}/${ATC_BIN_PATH}/

mk_dir "${OUTPUT_PATH}/${FWK_PATH}/${NNENGINE_PATH}"
mk_dir "${OUTPUT_PATH}/${FWK_PATH}/${OPSKERNEL_PATH}"
mk_dir "${OUTPUT_PATH}/${ATC_PATH}/${NNENGINE_PATH}"
mk_dir "${OUTPUT_PATH}/${ATC_PATH}/${OPSKERNEL_PATH}"
mk_dir "${OUTPUT_PATH}/${ACL_PATH}"
mk_dir "${OUTPUT_PATH}/${ATC_BIN_PATH}"
cd "${OUTPUT_PATH}"

find output/ -name graphengine_lib.tar -exec rm {} \;
cp src/ge/engine_manager/engine_conf.json ${OUTPUT_PATH}/${FWK_PATH}/${NNENGINE_PATH}
cp src/ge/engine_manager/engine_conf.json ${OUTPUT_PATH}/${ATC_PATH}/${NNENGINE_PATH}
find ./ -name graphengine_lib.tar -exec rm {} \;

find output/ -maxdepth 1 -name libengine.so -exec cp -f {} ${OUTPUT_PATH}/${FWK_PATH}/${NNENGINE_PATH}/../ \;
find output/ -maxdepth 1 -name libengine.so -exec cp -f {} ${OUTPUT_PATH}/${ATC_PATH}/${NNENGINE_PATH}/../ \;
cp ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH}/engine_conf.json ${OUTPUT_PATH}/${FWK_PATH}/${NNENGINE_PATH}
cp ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH}/engine_conf.json ${OUTPUT_PATH}/${ATC_PATH}/${NNENGINE_PATH}

find output/ -maxdepth 1 -name libge_local_engine.so -exec cp -f {} ${OUTPUT_PATH}/${FWK_PATH}/${OPSKERNEL_PATH} \;
find output/ -maxdepth 1 -name libge_local_engine.so -exec cp -f {} ${OUTPUT_PATH}/${ATC_PATH}/${OPSKERNEL_PATH} \;
find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name libengine.so -exec cp -f {} ${OUTPUT_PATH}/${FWK_PATH}/${NNENGINE_PATH}/../ \;
find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name libengine.so -exec cp -f {} ${OUTPUT_PATH}/${ATC_PATH}/${NNENGINE_PATH}/../ \;

cd "${OUTPUT_PATH}"
for lib in "${ATC_LIB[@]}";
MAX_DEPTH=1
if [ "x${PLATFORM}" = "xall" ] || [ "x${PLATFORM}" = "xinference" ]
then
MAX_DEPTH=2
fi
for lib in "${PLUGIN_OPSKERNEL[@]}";
do
find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth ${MAX_DEPTH} -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${FWK_PATH}/${OPSKERNEL_PATH} \;
find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth ${MAX_DEPTH} -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${ATC_PATH}/${OPSKERNEL_PATH} \;
done

for lib in "${PARSER_LIB[@]}";
do
cp "$lib" "${OUTPUT_PATH}/${ATC_PATH}"
find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${FWK_PATH} \;
find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${ATC_PATH} \;
done

for lib in "${FWK_LIB[@]}";
do
cp "$lib" "${OUTPUT_PATH}/${FWK_PATH}"
find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${FWK_PATH} \;
done

tar -cf graphengine_lib.tar fwkacllib/ atc/
for lib in "${ATC_LIB[@]}";
do
find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${ATC_PATH} \;
done

find ./bin -name atc -exec cp {} "${OUTPUT_PATH}/${ATC_BIN_PATH}" \;
find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "libascendcl.so" -exec cp -f {} ${OUTPUT_PATH}/${ACL_PATH} \;
if [ "x${PLATFORM}" = "xtrain" ]
then
tar -cf graphengine_lib.tar fwkacllib
elif [ "x${PLATFORM}" = "xinference" ]
then
tar -cf graphengine_lib.tar acllib atc
elif [ "x${PLATFORM}" = "xall" ]
then
tar -cf graphengine_lib.tar fwkacllib acllib atc
fi
}

if [[ "X$ENABLE_GE_UT" = "Xoff" ]]; then


+ 23
- 0
cmake/FindModule.cmake View File

@@ -0,0 +1,23 @@
#[[
module - the name of export imported target
name - find the library name
path - find the library path
#]]
function(find_module module name path)
if (TARGET ${module})
return()
endif()
find_library(${module}_LIBRARY_DIR NAMES ${name} NAMES_PER_DIR PATHS ${path}
PATH_SUFFIXES lib
)

message(STATUS "find ${name} location ${${module}_LIBRARY_DIR}")
if ("${${module}_LIBRARY_DIR}" STREQUAL "${module}_LIBRARY_DIR-NOTFOUND")
message(FATAL_ERROR "${name} not found in ${path}")
endif()
add_library(${module} SHARED IMPORTED)
set_target_properties(${module} PROPERTIES
IMPORTED_LOCATION ${${module}_LIBRARY_DIR}
)
endfunction()

+ 0
- 22
cmake/external_libs/eigen.cmake View File

@@ -1,22 +0,0 @@
set(Eigen3_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(Eigen3_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(Eigen3_NS "ge_")

if (ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/eigen-git-mirrorsource/repository/archive/3.3.7.tar.gz")
set(MD5 "cf6552a5d90c1aca4b5e0b011f65ea93")
else()
set(REQ_URL "https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz")
set(MD5 "9e30f67e8531477de4117506fe44669b")
endif ()

graphengine_add_pkg(Eigen3
VER 3.3.7
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DBUILD_TESTING=OFF)

find_package(Eigen3 3.3.7 REQUIRED ${GE_FIND_NO_DEFAULT_PATH})
set_property(TARGET Eigen3::Eigen PROPERTY IMPORTED_GLOBAL TRUE)
add_library(graphengine::eigen ALIAS Eigen3::Eigen)
include_directories(${EIGEN3_INCLUDE_DIRS})

+ 0
- 24
cmake/external_libs/gtest.cmake View File

@@ -1,24 +0,0 @@
set(ge_gtest_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack")
set(ge_gtest_CFLAGS "-D_FORTIFY_SOURCE=2 -O2 -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack")

if (ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/googletest/repository/archive/release-1.8.0.tar.gz")
set(MD5 "89e13ca1aa48d370719d58010b83f62c")
else()
set(REQ_URL "https://github.com/google/googletest/archive/release-1.8.0.tar.gz")
set(MD5 "16877098823401d1bf2ed7891d7dce36")
endif ()

graphengine_add_pkg(ge_gtest
VER 1.8.0
LIBS gtest gtest_main
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DBUILD_TESTING=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=ON
-DCMAKE_MACOSX_RPATH=TRUE -Dgtest_disable_pthreads=ON)

add_library(graphengine::gtest ALIAS ge_gtest::gtest)
add_library(graphengine::gtest_main ALIAS ge_gtest::gtest_main)
include_directories(${ge_gtest_INC})
file(COPY ${ge_gtest_INC}/../lib/libgtest.so DESTINATION ${CMAKE_SOURCE_DIR}/build/graphengine)
file(COPY ${ge_gtest_INC}/../lib/libgtest_main.so DESTINATION ${CMAKE_SOURCE_DIR}/build/graphengine)

+ 4
- 11
cmake/external_libs/json.cmake View File

@@ -1,15 +1,8 @@
set(nlohmann_json_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(nlohmann_json_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
if (HAVE_JSON)
return()
endif()

if (ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/JSON-for-Modern-CPP/repository/archive/v3.6.1.zip")
set(MD5 "5bda78ce308e6cfcf614dcf1d5ff27a7")
set(INCLUDE "./include")
else()
set(REQ_URL "https://github.com/nlohmann/json/releases/download/v3.6.1/include.zip")
set(MD5 "0dc903888211db3a0f170304cd9f3a89")
set(INCLUDE "./")
endif ()
include(ExternalProject)

set(JSON_SRC_DIR ${CMAKE_BINARY_DIR}/opensrc/json/include)
if (ENABLE_GITEE)


+ 1
- 0
cmake/external_libs/onnx.cmake View File

@@ -34,3 +34,4 @@ macro(onnx_protobuf_generate comp c_var h_var)
ge_protobuf_generate(${comp} ${c_var} ${h_var} ${ONNX_PROTO_FILE})
endmacro()



+ 0
- 63
cmake/external_libs/protobuf.cmake View File

@@ -1,63 +0,0 @@
if (NOT TARGET protobuf::protobuf)
set(protobuf_USE_STATIC_LIBS ON)
set(protobuf_CXXFLAGS "-Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -O2")
set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
set(_ge_tmp_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
string(REPLACE " -Wall" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE " -Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")

if (ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/protobuf_source/repository/archive/v3.8.0.tar.gz")
set(MD5 "eba86ae9f07ba5cfbaf8af3bc4e84236")
else()
set(REQ_URL "https://github.com/protocolbuffers/protobuf/archive/v3.8.0.tar.gz")
set(MD5 "3d9e32700639618a4d2d342c99d4507a")
endif ()

graphengine_add_pkg(protobuf
VER 3.8.0
LIBS protobuf
EXE protoc
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_PATH ../cmake/
CMAKE_OPTION -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_SHARED_LIBS=OFF)
set(CMAKE_CXX_FLAGS ${_ge_tmp_CMAKE_CXX_FLAGS})
endif()
add_library(graphengine::protobuf ALIAS protobuf::protobuf)
set(PROTOBUF_LIBRARY protobuf::protobuf)
include_directories(${protobuf_INC})
include_directories(${protobuf_DIRPATH}/src)

function(ge_protobuf_generate comp c_var h_var)
if(NOT ARGN)
message(SEND_ERROR "Error: ge_protobuf_generate() called without any proto files")
return()
endif()

set(${c_var})
set(${h_var})

foreach(file ${ARGN})
get_filename_component(abs_file ${file} ABSOLUTE)
get_filename_component(file_name ${file} NAME_WE)
get_filename_component(file_dir ${abs_file} PATH)

list(APPEND ${c_var} "${CMAKE_BINARY_DIR}/proto/${comp}/proto/${file_name}.pb.cc")
list(APPEND ${h_var} "${CMAKE_BINARY_DIR}/proto/${comp}/proto/${file_name}.pb.h")

add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/proto/${comp}/proto/${file_name}.pb.cc"
"${CMAKE_BINARY_DIR}/proto/${comp}/proto/${file_name}.pb.h"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/proto/${comp}/proto"
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${CMAKE_BINARY_DIR}/proto/${comp}/proto ${abs_file}
DEPENDS protobuf::protoc ${abs_file}
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM )
endforeach()

set_source_files_properties(${${c_var}} ${${h_var}} PROPERTIES GENERATED TRUE)
set(${c_var} ${${c_var}} PARENT_SCOPE)
set(${h_var} ${${h_var}} PARENT_SCOPE)

endfunction()

+ 3
- 3
cmake/external_libs/protobuf_shared.cmake View File

@@ -7,7 +7,7 @@ include(GNUInstallDirs)

if ((${CMAKE_INSTALL_PREFIX} STREQUAL /usr/local) OR
(${CMAKE_INSTALL_PREFIX} STREQUAL "C:/Program Files (x86)/ascend"))
set(CMAKE_INSTALL_PREFIX ${GE_SOURCE_DIR}/output CACHE STRING "path for install()" FORCE)
set(CMAKE_INSTALL_PREFIX ${GE_CODE_DIR}/output CACHE STRING "path for install()" FORCE)
message(STATUS "No install prefix selected, default to ${CMAKE_INSTALL_PREFIX}.")
endif()

@@ -24,8 +24,8 @@ set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
ExternalProject_Add(protobuf_build
URL ${REQ_URL}
#URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz
#SOURCE_DIR ${METADEF_DIR}/../../third_party/protobuf/src/protobuf-3.8.0
#DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E copy_directory ${METADEF_DIR}/../../third_party/protobuf/src/protobuf-3.8.0 <SOURCE_DIR>
#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 <SOURCE_DIR>
#CONFIGURE_COMMAND ${CMAKE_COMMAND}
#-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
#-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}


+ 62
- 11
cmake/external_libs/securec.cmake View File

@@ -1,11 +1,62 @@
graphengine_add_pkg(securec
VER 1.1.10
URL https://gitee.com/openeuler/libboundscheck/repository/archive/v1.1.10.tar.gz
MD5 193f0ca5246c1dd84920db34d2d8249f
LIBS c_sec
PATCHES ${GE_SOURCE_DIR}/third_party/patch/securec/securec.patch001
CMAKE_OPTION "-DCMAKE_BUILD_TYPE=Release"
)
include_directories(${securec_INC})
file(COPY ${securec_INC}/../lib/libc_sec.so DESTINATION ${CMAKE_SOURCE_DIR}/build/graphengine)
add_library(graphengine::securec ALIAS securec::c_sec)
if (HAVE_C_SEC)
return()
endif()

include(ExternalProject)

if ((${CMAKE_INSTALL_PREFIX} STREQUAL /usr/local) OR
(${CMAKE_INSTALL_PREFIX} STREQUAL "C:/Program Files (x86)/ascend"))
set(CMAKE_INSTALL_PREFIX ${GE_CODE_DIR}/output CACHE STRING "path for install()" FORCE)
message(STATUS "No install prefix selected, default to ${CMAKE_INSTALL_PREFIX}.")
endif()

ExternalProject_Add(c_sec_build
URL https://gitee.com/openeuler/libboundscheck/repository/archive/v1.1.10.tar.gz
#URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz
#SOURCE_DIR ${GE_CODE_DIR}/../libc_sec
PATCH_COMMAND patch -p1 < ${GE_CODE_DIR}/metadef/third_party/patch/securec/0001-add-securec-cmake-script.patch
CONFIGURE_COMMAND ${CMAKE_COMMAND}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_LINKER=${CMAKE_LINKER}
-DCMAKE_AR=${CMAKE_AR}
-DCMAKE_RANLIB=${CMAKE_RANLIB}
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/c_sec <SOURCE_DIR>
BUILD_COMMAND $(MAKE)
INSTALL_COMMAND $(MAKE) install
EXCLUDE_FROM_ALL TRUE
)

set(C_SEC_PKG_DIR ${CMAKE_INSTALL_PREFIX}/c_sec)

add_library(c_sec SHARED IMPORTED)

file(MAKE_DIRECTORY ${C_SEC_PKG_DIR}/include)

set_target_properties(c_sec PROPERTIES
IMPORTED_LOCATION ${C_SEC_PKG_DIR}/lib/libc_sec.so
)

target_include_directories(c_sec INTERFACE ${C_SEC_PKG_DIR}/include)

add_dependencies(c_sec c_sec_build)

set(INSTALL_BASE_DIR "")
set(INSTALL_LIBRARY_DIR lib)

install(FILES ${C_SEC_PKG_DIR}/lib/libc_sec.so OPTIONAL
DESTINATION ${INSTALL_LIBRARY_DIR})

add_library(c_sec_static_lib STATIC IMPORTED)
set_target_properties(c_sec_static_lib PROPERTIES
IMPORTED_LOCATION ${C_SEC_PKG_DIR}/lib/libc_sec.a
)

add_library(c_sec_static INTERFACE)
target_include_directories(c_sec_static INTERFACE ${C_SEC_PKG_DIR}/include)
target_link_libraries(c_sec_static INTERFACE c_sec_static_lib)

add_dependencies(c_sec_static c_sec_build)

#set(HAVE_C_SEC TRUE CACHE BOOL "c_sec build add")
set(HAVE_C_SEC TRUE)

+ 0
- 371
cmake/ge_utils.cmake View File

@@ -1,371 +0,0 @@
include(FetchContent)
set(FETCHCONTENT_QUIET OFF)

function(graphengine_add_submodule_obj des_submodule_objs sub_dir submodule_name_obj)

add_subdirectory(${sub_dir})

if(NOT TARGET ${submodule_name_obj})
message(FATAL_ERROR "Can not find submodule '${submodule_name_obj}'. in ${CMAKE_CURRENT_LIST_FILE}")
endif()
if("$<TARGET_OBJECTS:${submodule_name_obj}>" IN_LIST ${des_submodule_objs})
message(FATAL_ERROR "submodule '${submodule_name_obj}' added more than once. in ${CMAKE_CURRENT_LIST_FILE}")
endif()

set(${des_submodule_objs} ${${des_submodule_objs}} $<TARGET_OBJECTS:${submodule_name_obj}> PARENT_SCOPE)

endfunction()

if (DEFINED ENV{MSLIBS_CACHE_PATH})
set(_MS_LIB_CACHE $ENV{MSLIBS_CACHE_PATH})
else()
set(_MS_LIB_CACHE ${CMAKE_BINARY_DIR}/.mslib)
endif ()
message("MS LIBS CACHE PATH: ${_MS_LIB_CACHE}")

if (NOT EXISTS ${_MS_LIB_CACHE})
file(MAKE_DIRECTORY ${_MS_LIB_CACHE})
endif ()

if (DEFINED ENV{MSLIBS_SERVER})
set(LOCAL_LIBS_SERVER $ENV{MSLIBS_SERVER})
message("LOCAL_LIBS_SERVER: ${LOCAL_LIBS_SERVER}")
endif ()

include(ProcessorCount)
ProcessorCount(N)
if (JOBS)
set(THNUM ${JOBS})
else()
set(JOBS 8)
if (${JOBS} GREATER ${N})
set(THNUM ${N})
endif()
endif ()
message("set make thread num: ${THNUM}")

if(LOCAL_LIBS_SERVER)
if (NOT ENV{no_proxy})
set(ENV{no_proxy} "${LOCAL_LIBS_SERVER}")
else()
string(FIND $ENV{no_proxy} ${LOCAL_LIBS_SERVER} IP_POS)
if (${IP_POS} EQUAL -1)
set(ENV{no_proxy} "$ENV{no_proxy},${LOCAL_LIBS_SERVER}")
endif ()
endif ()
endif()

function(__download_pkg pkg_name pkg_url pkg_md5)

if(LOCAL_LIBS_SERVER)
get_filename_component(_URL_FILE_NAME ${pkg_url} NAME)
set(pkg_url "http://${LOCAL_LIBS_SERVER}:8081/libs/${pkg_name}/${_URL_FILE_NAME}" ${pkg_url})
endif()

FetchContent_Declare(
${pkg_name}
URL ${pkg_url}
URL_HASH MD5=${pkg_md5}
)
FetchContent_GetProperties(${pkg_name})
message("download: ${${pkg_name}_SOURCE_DIR} , ${pkg_name} , ${pkg_url}")
if(NOT ${pkg_name}_POPULATED)
FetchContent_Populate(${pkg_name})
set(${pkg_name}_SOURCE_DIR ${${pkg_name}_SOURCE_DIR} PARENT_SCOPE)
endif()

endfunction()

function(__download_pkg_with_git pkg_name pkg_url pkg_git_commit pkg_md5)

if(LOCAL_LIBS_SERVER)
set(pkg_url "http://${LOCAL_LIBS_SERVER}:8081/libs/${pkg_name}/${pkg_git_commit}")
FetchContent_Declare(
${pkg_name}
URL ${pkg_url}
URL_HASH MD5=${pkg_md5}
)
else()
FetchContent_Declare(
${pkg_name}
GIT_REPOSITORY ${pkg_url}
GIT_TAG ${pkg_git_commit})
endif()
FetchContent_GetProperties(${pkg_name})
message("download: ${${pkg_name}_SOURCE_DIR} , ${pkg_name} , ${pkg_url}")
if(NOT ${pkg_name}_POPULATED)
FetchContent_Populate(${pkg_name})
set(${pkg_name}_SOURCE_DIR ${${pkg_name}_SOURCE_DIR} PARENT_SCOPE)
endif()

endfunction()


function(__find_pkg_then_add_target pkg_name pkg_exe)

unset(${pkg_name}_LIBS)

message("_FIND:${${pkg_name}_BASE_DIR}")

if(pkg_exe)
find_program(${pkg_exe}_EXE ${pkg_exe} PATHS ${${pkg_name}_BASE_DIR}/bin NO_DEFAULT_PATH)
if(NOT ${pkg_exe}_EXE)
return()
endif()
add_executable(${pkg_name}::${pkg_exe} IMPORTED GLOBAL)
set_target_properties(${pkg_name}::${pkg_exe} PROPERTIES
IMPORTED_LOCATION ${${pkg_exe}_EXE}
)
message("found ${${pkg_exe}_EXE}")
endif()

foreach(_LIB_NAME ${ARGN})
set(_LIB_SEARCH_NAME ${_LIB_NAME})
set(_LIB_TYPE SHARED)
if (${pkg_name}_USE_STATIC_LIBS)
set(_LIB_SEARCH_NAME "${CMAKE_STATIC_LIBRARY_PREFIX}${_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(_LIB_TYPE STATIC)
endif ()
set(${_LIB_NAME}_LIB ${_LIB_NAME}_LIB-NOTFOUND)
find_library(${_LIB_NAME}_LIB ${_LIB_SEARCH_NAME} PATHS ${${pkg_name}_BASE_DIR}/lib NO_DEFAULT_PATH)
if(NOT ${_LIB_NAME}_LIB)
return()
endif()
add_library(${pkg_name}::${_LIB_NAME} ${_LIB_TYPE} IMPORTED GLOBAL)
set_target_properties(${pkg_name}::${_LIB_NAME} PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${${pkg_name}_BASE_DIR}/include"
IMPORTED_LOCATION ${${_LIB_NAME}_LIB}
)
list(APPEND ${pkg_name}_LIBS ${pkg_name}::${_LIB_NAME})
message("found ${${_LIB_NAME}_LIB}")
STRING( REGEX REPLACE "(.+)/(.+)" "\\1" LIBPATH ${${_LIB_NAME}_LIB})
set(${pkg_name}_LIBPATH ${LIBPATH} CACHE STRING INTERNAL)
endforeach(_LIB_NAME)

set(${pkg_name}_LIBS ${${pkg_name}_LIBS} PARENT_SCOPE)
endfunction()

function(__exec_cmd)
set(options )
set(oneValueArgs WORKING_DIRECTORY)
set(multiValueArgs COMMAND)

cmake_parse_arguments(EXEC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )

execute_process(COMMAND ${EXEC_COMMAND}
WORKING_DIRECTORY ${EXEC_WORKING_DIRECTORY}
RESULT_VARIABLE RESULT)
if(NOT RESULT EQUAL "0")
message(FATAL_ERROR "error! when ${EXEC_COMMAND} in ${EXEC_WORKING_DIRECTORY}")
endif()
endfunction()

function(__check_patches pkg_patches)
# check patches
if (PKG_PATCHES)
file(TOUCH ${_MS_LIB_CACHE}/${pkg_name}_patch.md5)
file(READ ${_MS_LIB_CACHE}/${pkg_name}_patch.md5 ${pkg_name}_PATCHES_MD5)

message("patches md5:${${pkg_name}_PATCHES_MD5}")

set(${pkg_name}_PATCHES_NEW_MD5 )
foreach(_PATCH ${PKG_PATCHES})
file(MD5 ${_PATCH} _PF_MD5)
set(${pkg_name}_PATCHES_NEW_MD5 "${${pkg_name}_PATCHES_NEW_MD5},${_PF_MD5}")
endforeach(_PATCH)

if (NOT ${pkg_name}_PATCHES_MD5 STREQUAL ${pkg_name}_PATCHES_NEW_MD5)
set(${pkg_name}_PATCHES ${PKG_PATCHES})
file(REMOVE_RECURSE "${_MS_LIB_CACHE}/${pkg_name}-subbuild")
file(WRITE ${_MS_LIB_CACHE}/${pkg_name}_patch.md5 ${${pkg_name}_PATCHES_NEW_MD5})
message("patches changed : ${${pkg_name}_PATCHES_NEW_MD5}")
endif ()
endif ()
endfunction()

set(GE_FIND_NO_DEFAULT_PATH NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_BUILDS_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PATH
NO_CMAKE_SYSTEM_PACKAGE_REGISTRY)
set(GE_FIND_NO_DEFAULT_PATH ${GE_FIND_NO_DEFAULT_PATH} PARENT_SCOPE)

function(graphengine_add_pkg pkg_name )
set(options )
set(oneValueArgs URL MD5 GIT_REPOSITORY GIT_TAG VER EXE DIR HEAD_ONLY CMAKE_PATH)
set(multiValueArgs CMAKE_OPTION LIBS PRE_CONFIGURE_COMMAND CONFIGURE_COMMAND BUILD_OPTION INSTALL_INCS INSTALL_LIBS PATCHES)
cmake_parse_arguments(PKG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )

if (NOT PKG_CMAKE_PATH)
set(PKG_CMAKE_PATH ..)
endif ()

set(__FIND_PKG_NAME ${pkg_name})
string(TOLOWER ${pkg_name} pkg_name)
message("pkg name:${__FIND_PKG_NAME},${pkg_name}")

set(${pkg_name}_PATCHES_HASH )
foreach(_PATCH ${PKG_PATCHES})
file(MD5 ${_PATCH} _PF_MD5)
set(${pkg_name}_PATCHES_HASH "${${pkg_name}_PATCHES_HASH},${_PF_MD5}")
endforeach(_PATCH)

# check options
set(${pkg_name}_CONFIG_TXT
"${CMAKE_CXX_COMPILER_VERSION}-${CMAKE_C_COMPILER_VERSION}
${ARGN} - ${${pkg_name}_USE_STATIC_LIBS}- ${${pkg_name}_PATCHES_HASH}
${${pkg_name}_CXXFLAGS}--${${pkg_name}_CFLAGS}--${${pkg_name}_LDFLAGS}")
string(REPLACE ";" "-" ${pkg_name}_CONFIG_TXT ${${pkg_name}_CONFIG_TXT})
string(MD5 ${pkg_name}_CONFIG_HASH ${${pkg_name}_CONFIG_TXT})

message("${pkg_name} config hash: ${${pkg_name}_CONFIG_HASH}")

set(${pkg_name}_BASE_DIR ${_MS_LIB_CACHE}/${pkg_name}_${${pkg_name}_CONFIG_HASH})
set(${pkg_name}_DIRPATH ${${pkg_name}_BASE_DIR} CACHE STRING INTERNAL)

if(EXISTS ${${pkg_name}_BASE_DIR}/options.txt AND PKG_HEAD_ONLY)
set(${pkg_name}_INC ${${pkg_name}_BASE_DIR}/${PKG_HEAD_ONLY} PARENT_SCOPE)
add_library(${pkg_name} INTERFACE)
target_include_directories(${pkg_name} INTERFACE ${${pkg_name}_INC})
return()
endif ()

if(NOT PKG_EXE)
set(PKG_EXE 0)
endif()

set(${__FIND_PKG_NAME}_ROOT ${${pkg_name}_BASE_DIR})
set(${__FIND_PKG_NAME}_ROOT ${${pkg_name}_BASE_DIR} PARENT_SCOPE)

if (PKG_LIBS)
__find_pkg_then_add_target(${pkg_name} ${PKG_EXE} ${PKG_LIBS})
if(${pkg_name}_LIBS)
set(${pkg_name}_INC ${${pkg_name}_BASE_DIR}/include PARENT_SCOPE)
message("Found libs: ${${pkg_name}_LIBS}")
return()
endif()
elseif(NOT PKG_HEAD_ONLY)
find_package(${__FIND_PKG_NAME} ${PKG_VER} ${GE_FIND_NO_DEFAULT_PATH})
if (${__FIND_PKG_NAME}_FOUND)
set(${pkg_name}_INC ${${pkg_name}_BASE_DIR}/include PARENT_SCOPE)
message("Found pkg: ${__FIND_PKG_NAME}")
return()
endif ()
endif ()

if (NOT PKG_DIR)
if (PKG_GIT_REPOSITORY)
__download_pkg_with_git(${pkg_name} ${PKG_GIT_REPOSITORY} ${PKG_GIT_TAG} ${PKG_MD5})
else()
__download_pkg(${pkg_name} ${PKG_URL} ${PKG_MD5})
endif()
else()
set(${pkg_name}_SOURCE_DIR ${PKG_DIR})
endif ()
file(WRITE ${${pkg_name}_BASE_DIR}/options.txt ${${pkg_name}_CONFIG_TXT})
message("${pkg_name}_SOURCE_DIR : ${${pkg_name}_SOURCE_DIR}")

foreach(_PATCH_FILE ${PKG_PATCHES})
message("patching ${${pkg_name}_SOURCE_DIR} -p1 < ${_PATCH_FILE}")
execute_process(COMMAND patch -p1 INPUT_FILE ${_PATCH_FILE}
WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR}
RESULT_VARIABLE Result)
if(NOT Result EQUAL "0")
message(FATAL_ERROR "Failed patch: ${_PATCH_FILE}")
endif()
endforeach(_PATCH_FILE)

file(LOCK ${${pkg_name}_BASE_DIR} DIRECTORY GUARD FUNCTION RESULT_VARIABLE ${pkg_name}_LOCK_RET TIMEOUT 600)
if(NOT ${pkg_name}_LOCK_RET EQUAL "0")
message(FATAL_ERROR "error! when try lock ${${pkg_name}_BASE_DIR} : ${${pkg_name}_LOCK_RET}")
endif()

if(${pkg_name}_SOURCE_DIR)
if (PKG_HEAD_ONLY)
file(GLOB ${pkg_name}_SOURCE_SUBDIRS ${${pkg_name}_SOURCE_DIR}/*)
file(COPY ${${pkg_name}_SOURCE_SUBDIRS} DESTINATION ${${pkg_name}_BASE_DIR})
set(${pkg_name}_INC ${${pkg_name}_BASE_DIR}/${PKG_HEAD_ONLY} PARENT_SCOPE)
add_library(${pkg_name} INTERFACE)
target_include_directories(${pkg_name} INTERFACE ${${pkg_name}_INC})

elseif (PKG_CMAKE_OPTION)
# in cmake
file(MAKE_DIRECTORY ${${pkg_name}_SOURCE_DIR}/_build)
if (${pkg_name}_CFLAGS)
set(${pkg_name}_CMAKE_CFLAGS "-DCMAKE_C_FLAGS=${${pkg_name}_CFLAGS}")
endif ()
if (${pkg_name}_CXXFLAGS)
set(${pkg_name}_CMAKE_CXXFLAGS "-DCMAKE_CXX_FLAGS=${${pkg_name}_CXXFLAGS}")
endif ()

if (${pkg_name}_LDFLAGS)
if (${pkg_name}_USE_STATIC_LIBS)
#set(${pkg_name}_CMAKE_LDFLAGS "-DCMAKE_STATIC_LINKER_FLAGS=${${pkg_name}_LDFLAGS}")
else()
set(${pkg_name}_CMAKE_LDFLAGS "-DCMAKE_SHARED_LINKER_FLAGS=${${pkg_name}_LDFLAGS}")
endif ()
endif ()

__exec_cmd(COMMAND ${CMAKE_COMMAND} ${PKG_CMAKE_OPTION} -G ${CMAKE_GENERATOR}
${${pkg_name}_CMAKE_CFLAGS} ${${pkg_name}_CMAKE_CXXFLAGS} ${${pkg_name}_CMAKE_LDFLAGS}
-DCMAKE_INSTALL_PREFIX=${${pkg_name}_BASE_DIR} ${PKG_CMAKE_PATH}
WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR}/_build)

__exec_cmd(COMMAND ${CMAKE_COMMAND} --build . --target install -- -j${THNUM}
WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR}/_build)

else()
if (${pkg_name}_CFLAGS)
set(${pkg_name}_MAKE_CFLAGS "CFLAGS=${${pkg_name}_CFLAGS}")
endif ()
if (${pkg_name}_CXXFLAGS)
set(${pkg_name}_MAKE_CXXFLAGS "CXXFLAGS=${${pkg_name}_CXXFLAGS}")
endif ()
if (${pkg_name}_LDFLAGS)
set(${pkg_name}_MAKE_LDFLAGS "LDFLAGS=${${pkg_name}_LDFLAGS}")
endif ()
# in configure && make
if (PKG_PRE_CONFIGURE_COMMAND)
__exec_cmd(COMMAND ${PKG_PRE_CONFIGURE_COMMAND}
WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR})
endif ()

if (PKG_CONFIGURE_COMMAND)
__exec_cmd(COMMAND ${PKG_CONFIGURE_COMMAND}
${${pkg_name}_MAKE_CFLAGS} ${${pkg_name}_MAKE_CXXFLAGS} ${${pkg_name}_MAKE_LDFLAGS}
--prefix=${${pkg_name}_BASE_DIR}
WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR})
endif ()
set(${pkg_name}_BUILD_OPTION ${PKG_BUILD_OPTION})
if (NOT PKG_CONFIGURE_COMMAND)
set(${pkg_name}_BUILD_OPTION ${${pkg_name}_BUILD_OPTION}
${${pkg_name}_MAKE_CFLAGS} ${${pkg_name}_MAKE_CXXFLAGS} ${${pkg_name}_MAKE_LDFLAGS})
endif ()
# build
__exec_cmd(COMMAND ${CMAKE_MAKE_PROGRAM} ${${pkg_name}_BUILD_OPTION} -j${THNUM}
WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR})

if (PKG_INSTALL_INCS OR PKG_INSTALL_LIBS)
file(GLOB ${pkg_name}_INSTALL_INCS ${${pkg_name}_SOURCE_DIR}/${PKG_INSTALL_INCS})
file(GLOB ${pkg_name}_INSTALL_LIBS ${${pkg_name}_SOURCE_DIR}/${PKG_INSTALL_LIBS})
file(COPY ${${pkg_name}_INSTALL_INCS} DESTINATION ${${pkg_name}_BASE_DIR}/include)
file(COPY ${${pkg_name}_INSTALL_LIBS} DESTINATION ${${pkg_name}_BASE_DIR}/lib)
else()
__exec_cmd(COMMAND ${CMAKE_MAKE_PROGRAM} install WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR})
endif ()
endif ()
endif()

if (PKG_LIBS)
__find_pkg_then_add_target(${pkg_name} ${PKG_EXE} ${PKG_LIBS})
set(${pkg_name}_INC ${${pkg_name}_BASE_DIR}/include PARENT_SCOPE)
if(NOT ${pkg_name}_LIBS)
message(FATAL_ERROR "Can not find pkg: ${pkg_name}")
endif()
else()
find_package(${__FIND_PKG_NAME} ${PKG_VER} QUIET)
if (${__FIND_PKG_NAME}_FOUND)
set(${pkg_name}_INC ${${pkg_name}_BASE_DIR}/include PARENT_SCOPE)
message("Found pkg: ${${__FIND_PKG_NAME}_LIBRARIES}")
return()
endif ()
endif ()
endfunction()

+ 52
- 0
cmake/intf_pub_android.cmake View File

@@ -0,0 +1,52 @@

add_library(intf_pub INTERFACE)

target_compile_options(intf_pub INTERFACE
-Wall
-fPIC
-fstack-protector-strong
)
target_compile_definitions(intf_pub INTERFACE
$<$<STREQUAL:${PRODUCT_SIDE},host>:_GLIBCXX_USE_CXX11_ABI=0>
$<$<CONFIG:Release>:CFG_BUILD_NDEBUG>
$<$<CONFIG:Debug>:CFG_BUILD_DEBUG>
WIN64=1
LINUX=0
)
target_link_options(intf_pub INTERFACE
-Wl,-z,relro
-Wl,-z,now
-Wl,-z,noexecstack
$<$<CONFIG:Release>:-Wl,--build-id=none>
)
target_link_directories(intf_pub INTERFACE
)

add_library(intf_ccec INTERFACE)
target_compile_options(intf_ccec INTERFACE
-mcpu=cortex-a73
--target=aarch64-linux-android29
--sysroot=${HCC_PATH}/../sysroot
-L${HCC_PATH}/../lib/gcc/aarch64-linux-android/4.9.x
-Wall
-fPIC
-fstack-protector-strong
)
target_compile_definitions(intf_ccec INTERFACE
$<$<STREQUAL:${PRODUCT_SIDE},host>:_GLIBCXX_USE_CXX11_ABI=0>
$<$<CONFIG:Release>:CFG_BUILD_NDEBUG>
$<$<CONFIG:Debug>:CFG_BUILD_DEBUG>
)

target_link_options(intf_ccec INTERFACE
-mcpu=cortex-a73
--target=aarch64-linux-android29
--sysroot=${HCC_PATH}/../sysroot
-L${HCC_PATH}/../lib/gcc/aarch64-linux-android/4.9.x
-Wl,-cce-host-android
-Wl,-z,relro
-Wl,-z,now
-Wl,-z,noexecstack
$<$<CONFIG:Release>:-Wl,--build-id=none>
)


+ 33
- 0
cmake/intf_pub_linux.cmake View File

@@ -0,0 +1,33 @@
if (HAVE_PUB)
return()
endif()

add_library(intf_pub INTERFACE)

target_compile_options(intf_pub INTERFACE
-Wall
-fPIC
$<IF:$<STREQUAL:${CMAKE_SYSTEM_NAME},centos>,-fstack-protector-all,-fstack-protector-strong>
$<$<COMPILE_LANGUAGE:CXX>:-std=c++11>
)
target_compile_definitions(intf_pub INTERFACE
_GLIBCXX_USE_CXX11_ABI=0
$<$<CONFIG:Release>:CFG_BUILD_NDEBUG>
$<$<CONFIG:Debug>:CFG_BUILD_DEBUG>
WIN64=1
LINUX=0
)
target_link_options(intf_pub INTERFACE
-Wl,-z,relro
-Wl,-z,now
-Wl,-z,noexecstack
$<$<CONFIG:Release>:-Wl,--build-id=none>
)
target_link_directories(intf_pub INTERFACE
)
target_link_libraries(intf_pub INTERFACE
-lpthread
)

#set(HAVE_PUB TRUE CACHE BOOL "pub add")
set(HAVE_PUB TRUE)

+ 24
- 0
cmake/intf_pub_windows.cmake View File

@@ -0,0 +1,24 @@

add_library(intf_pub INTERFACE)

target_compile_options(intf_pub INTERFACE
-Wall
-fPIC
$<IF:$<STREQUAL:${OS_TYPE},centos>,-fstack-protector-all,-fstack-protector-strong>
$<$<COMPILE_LANGUAGE:CXX>:-std=c++11>
)
target_compile_definitions(intf_pub INTERFACE
$<$<STREQUAL:${PRODUCT_SIDE},host>:_GLIBCXX_USE_CXX11_ABI=0>
OS_TYPE=WIN64
WIN64=1
LINUX=0
$<$<CONFIG:Release>:CFG_BUILD_NDEBUG>
$<$<CONFIG:Debug>:CFG_BUILD_DEBUG>
)
target_link_options(intf_pub INTERFACE
$<$<CONFIG:Release>:-Wl,--build-id=none>
)
target_link_directories(intf_pub INTERFACE
)
target_link_libraries(intf_pub INTERFACE
)

+ 0
- 0
ge/README.md View File


src/ge/analyzer/analyzer.cc → ge/analyzer/analyzer.cc View File


src/ge/analyzer/analyzer.h → ge/analyzer/analyzer.h View File


src/ge/client/ge_api.cc → ge/client/ge_api.cc View File


src/ge/client/ge_prof.cc → ge/client/ge_prof.cc View File


src/ge/client/module.mk → ge/client/module.mk View File


src/proto/ge_api.proto → ge/client/proto/ge_api.proto View File


src/proto/ge_ir.proto → ge/client/proto/ge_ir.proto View File


src/proto/insert_op.proto → ge/client/proto/insert_op.proto View File


src/proto/om.proto → ge/client/proto/om.proto View File


src/proto/task.proto → ge/client/proto/task.proto View File


+ 171
- 0
ge/common/CMakeLists.txt View File

@@ -0,0 +1,171 @@
set(PROTO_LIST
"${METADEF_DIR}/proto/om.proto"
"${METADEF_DIR}/proto/ge_ir.proto"
"${METADEF_DIR}/proto/insert_op.proto"
"${METADEF_DIR}/proto/task.proto"
"${METADEF_DIR}/proto/tensorflow/attr_value.proto"
"${METADEF_DIR}/proto/tensorflow/function.proto"
"${METADEF_DIR}/proto/tensorflow/graph.proto"
"${METADEF_DIR}/proto/tensorflow/node_def.proto"
"${METADEF_DIR}/proto/tensorflow/op_def.proto"
"${METADEF_DIR}/proto/tensorflow/resource_handle.proto"
"${METADEF_DIR}/proto/tensorflow/tensor.proto"
"${METADEF_DIR}/proto/tensorflow/tensor_shape.proto"
"${METADEF_DIR}/proto/tensorflow/types.proto"
"${METADEF_DIR}/proto/tensorflow/versions.proto"
)

protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST})

set(SRC_LIST
"context/ctx.cc"
"model_saver.cc"
"ge/datatype_util.cc"
"helper/om_file_helper.cc"
"helper/model_helper.cc"
"../model/ge_model.cc"
"auth/file_saver.cc"
"fp16_t.cc"
"math/fp16_math.cc"
"debug/memory_dumper.cc"
"formats/utils/formats_trans_utils.cc"
"dump/dump_properties.cc"
"formats/format_transfers/datatype_transfer.cc"
"formats/format_transfers/format_transfer_transpose.cc"
"formats/format_transfers/format_transfer_nchw_nc1hwc0.cc"
"formats/format_transfers/format_transfer_fractal_z.cc"
"formats/format_transfers/format_transfer_fractal_nz.cc"
"formats/format_transfers/format_transfer_fractal_zz.cc"
"formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc"
"formats/format_transfers/format_transfer_nc1hwc0_nchw.cc"
"formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc"
"formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc"
"formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc"
"formats/format_transfers/format_transfer_fracz_nchw.cc"
"formats/format_transfers/format_transfer_fracz_nhwc.cc"
"formats/format_transfers/format_transfer_fracz_hwcn.cc"
"formats/format_transfers/format_transfer_dhwcn_fracz3D.cc"
"formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc"
"formats/format_transfers/format_transfer_nchw_fz_c04.cc"
"formats/formats.cc"
"ge_format_util.cc"
"fmk_error_codes.cc"
"util.cc"
"properties_manager.cc"
"types.cc"
"model_parser/base.cc"
"kernel_store.cc"
"tbe_kernel_store.cc"
"cust_aicpu_kernel_store.cc"
"op/attr_value_util.cc"
"op/ge_op_utils.cc"
"thread_pool.cc"
"ge/tbe_plugin_manager.cc"
)

############ libge_common.so ############
add_library(ge_common SHARED ${SRC_LIST} ${PROTO_HDRS})
target_compile_definitions(ge_common PRIVATE
PROTOBUF_INLINE_NOT_IN_HEADERS=0
HOST_VISIBILITY
FMK_SUPPORT_DUMP
OS_CENTOS
)

target_compile_options(ge_common PRIVATE
-fvisibility=hidden
-O2
-Werror
)

target_include_directories(ge_common PRIVATE
${GE_CODE_DIR}/ge
${GE_CODE_DIR}/ge/common
${GE_CODE_DIR}/ge/common/op
${GE_CODE_DIR}/inc/external
${GE_CODE_DIR}/inc
${GE_CODE_DIR}/inc/framework
${METADEF_DIR}/inc
${METADEF_DIR}/inc/external
${METADEF_DIR}/inc/external/graph
${METADEF_DIR}/inc/graph
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/proto/ge
#### yellow zone ####
${GE_DEPEND_DIR}/inc
${GE_DEPEND_DIR}/inc/cce
#### blue zone ####
#${GE_DEPEND_DIR}/include
${GE_CODE_DIR}/third_party/fwkacllib/inc
${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain
)

target_link_libraries(ge_common PRIVATE
$<BUILD_INTERFACE:intf_pub>
-Wl,--no-as-needed
graph
protobuf
register
c_sec
error_manager
slog
mmpa
-Wl,--as-needed
json
-lrt
-ldl
)

############ libge_common.a ############
add_library(ge_common_static STATIC ${SRC_LIST} ${PROTO_HDRS})
target_compile_definitions(ge_common_static PRIVATE
PROTOBUF_INLINE_NOT_IN_HEADERS=0
HOST_VISIBILITY
FMK_SUPPORT_DUMP
OS_CENTOS
)

target_compile_options(ge_common_static PRIVATE
-fvisibility=hidden
-O2
-Werror
)

target_include_directories(ge_common_static PRIVATE
${GE_CODE_DIR}/ge
${GE_CODE_DIR}/ge/common
${GE_CODE_DIR}/ge/common/op
${GE_CODE_DIR}/inc
${GE_CODE_DIR}/inc/external
${GE_CODE_DIR}/inc/framework
${METADEF_DIR}/inc
${METADEF_DIR}/inc/external
${METADEF_DIR}/inc/external/graph
${METADEF_DIR}/inc/graph
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/proto/ge
#### yellow zone ####
${GE_DEPEND_DIR}/inc
${GE_DEPEND_DIR}/inc/cce
#### blue zone ####
#${GE_DEPEND_DIR}/include
${GE_CODE_DIR}/third_party/fwkacllib/inc
${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain
)

target_link_libraries(ge_common_static PRIVATE
$<BUILD_INTERFACE:intf_pub>
protobuf
json
c_sec
-lrt
-ldl
)

############ install ############
set(INSTALL_BASE_DIR "")
set(INSTALL_LIBRARY_DIR lib)

install(TARGETS ge_common OPTIONAL
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
)

src/ge/common/auth/file_saver.cc → ge/common/auth/file_saver.cc View File


src/ge/common/auth/file_saver.h → ge/common/auth/file_saver.h View File


src/ge/common/base64.h → ge/common/base64.h View File


src/ge/common/context/ctx.cc → ge/common/context/ctx.cc View File


src/convert/pb2json.cc → ge/common/convert/pb2json.cc View File


src/convert/pb2json.h → ge/common/convert/pb2json.h View File


src/ge/common/cust_aicpu_kernel_store.cc → ge/common/cust_aicpu_kernel_store.cc View File


src/ge/common/cust_aicpu_kernel_store.h → ge/common/cust_aicpu_kernel_store.h View File


src/ge/common/debug/memory_dumper.cc → ge/common/debug/memory_dumper.cc View File


src/ge/common/debug/memory_dumper.h → ge/common/debug/memory_dumper.h View File


src/ge/common/dump/dump_manager.cc → ge/common/dump/dump_manager.cc View File


src/ge/common/dump/dump_manager.h → ge/common/dump/dump_manager.h View File


src/ge/common/dump/dump_op.cc → ge/common/dump/dump_op.cc View File


src/ge/common/dump/dump_op.h → ge/common/dump/dump_op.h View File


src/ge/common/dump/dump_properties.cc → ge/common/dump/dump_properties.cc View File


src/ge/common/dump/dump_properties.h → ge/common/dump/dump_properties.h View File


src/ge/common/dump/dump_server.cc → ge/common/dump/dump_server.cc View File


src/ge/common/fmk_error_codes.cc → ge/common/fmk_error_codes.cc View File


src/ge/common/formats/format_transfers/datatype_transfer.cc → ge/common/formats/format_transfers/datatype_transfer.cc View File


src/ge/common/formats/format_transfers/datatype_transfer.h → ge/common/formats/format_transfers/datatype_transfer.h View File


src/ge/common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc → ge/common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc View File


src/ge/common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.h → ge/common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.h View File


src/ge/common/formats/format_transfers/format_transfer_dhwcn_fracz3D.cc → ge/common/formats/format_transfers/format_transfer_dhwcn_fracz3D.cc View File


src/ge/common/formats/format_transfers/format_transfer_dhwcn_fracz3D.h → ge/common/formats/format_transfers/format_transfer_dhwcn_fracz3D.h View File


src/ge/common/formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc → ge/common/formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc View File


src/ge/common/formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.h → ge/common/formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.h View File


src/ge/common/formats/format_transfers/format_transfer_fractal_nz.cc → ge/common/formats/format_transfers/format_transfer_fractal_nz.cc View File


src/ge/common/formats/format_transfers/format_transfer_fractal_nz.h → ge/common/formats/format_transfers/format_transfer_fractal_nz.h View File


src/ge/common/formats/format_transfers/format_transfer_fractal_z.cc → ge/common/formats/format_transfers/format_transfer_fractal_z.cc View File


src/ge/common/formats/format_transfers/format_transfer_fractal_z.h → ge/common/formats/format_transfers/format_transfer_fractal_z.h View File


src/ge/common/formats/format_transfers/format_transfer_fractal_zz.cc → ge/common/formats/format_transfers/format_transfer_fractal_zz.cc View File


src/ge/common/formats/format_transfers/format_transfer_fractal_zz.h → ge/common/formats/format_transfers/format_transfer_fractal_zz.h View File


src/ge/common/formats/format_transfers/format_transfer_fracz_hwcn.cc → ge/common/formats/format_transfers/format_transfer_fracz_hwcn.cc View File


src/ge/common/formats/format_transfers/format_transfer_fracz_hwcn.h → ge/common/formats/format_transfers/format_transfer_fracz_hwcn.h View File


src/ge/common/formats/format_transfers/format_transfer_fracz_nchw.cc → ge/common/formats/format_transfers/format_transfer_fracz_nchw.cc View File


src/ge/common/formats/format_transfers/format_transfer_fracz_nchw.h → ge/common/formats/format_transfers/format_transfer_fracz_nchw.h View File


src/ge/common/formats/format_transfers/format_transfer_fracz_nhwc.cc → ge/common/formats/format_transfers/format_transfer_fracz_nhwc.cc View File


src/ge/common/formats/format_transfers/format_transfer_fracz_nhwc.h → ge/common/formats/format_transfers/format_transfer_fracz_nhwc.h View File


src/ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc → ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc View File


src/ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.h → ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.h View File


src/ge/common/formats/format_transfers/format_transfer_nc1hwc0_nchw.cc → ge/common/formats/format_transfers/format_transfer_nc1hwc0_nchw.cc View File


src/ge/common/formats/format_transfers/format_transfer_nc1hwc0_nchw.h → ge/common/formats/format_transfers/format_transfer_nc1hwc0_nchw.h View File


src/ge/common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc → ge/common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc View File


src/ge/common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.h → ge/common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.h View File


src/ge/common/formats/format_transfers/format_transfer_nchw_fz_c04.cc → ge/common/formats/format_transfers/format_transfer_nchw_fz_c04.cc View File


src/ge/common/formats/format_transfers/format_transfer_nchw_fz_c04.h → ge/common/formats/format_transfers/format_transfer_nchw_fz_c04.h View File


src/ge/common/formats/format_transfers/format_transfer_nchw_nc1hwc0.cc → ge/common/formats/format_transfers/format_transfer_nchw_nc1hwc0.cc View File


src/ge/common/formats/format_transfers/format_transfer_nchw_nc1hwc0.h → ge/common/formats/format_transfers/format_transfer_nchw_nc1hwc0.h View File


src/ge/common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc → ge/common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc View File


src/ge/common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.h → ge/common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.h View File


src/ge/common/formats/format_transfers/format_transfer_transpose.cc → ge/common/formats/format_transfers/format_transfer_transpose.cc View File


src/ge/common/formats/format_transfers/format_transfer_transpose.h → ge/common/formats/format_transfers/format_transfer_transpose.h View File


src/ge/common/formats/formats.cc → ge/common/formats/formats.cc View File


src/ge/common/formats/formats.h → ge/common/formats/formats.h View File


src/ge/common/formats/utils/formats_definitions.h → ge/common/formats/utils/formats_definitions.h View File


src/ge/common/formats/utils/formats_trans_utils.cc → ge/common/formats/utils/formats_trans_utils.cc View File


src/ge/common/formats/utils/formats_trans_utils.h → ge/common/formats/utils/formats_trans_utils.h View File


src/ge/common/fp16_t.cc → ge/common/fp16_t.cc View File


src/ge/common/fp16_t.h → ge/common/fp16_t.h View File


src/ge/common/ge/datatype_util.cc → ge/common/ge/datatype_util.cc View File


src/ge/common/ge/datatype_util.h → ge/common/ge/datatype_util.h View File


src/ge/common/ge/ge_util.h → ge/common/ge/ge_util.h View File


src/ge/common/ge/op_tiling_manager.cc → ge/common/ge/op_tiling_manager.cc View File


src/ge/common/ge/op_tiling_manager.h → ge/common/ge/op_tiling_manager.h View File


src/ge/common/ge/plugin_manager.cc → ge/common/ge/plugin_manager.cc View File


src/ge/common/ge/plugin_manager.h → ge/common/ge/plugin_manager.h View File


src/ge/common/ge/tbe_plugin_manager.cc → ge/common/ge/tbe_plugin_manager.cc View File


src/ge/common/ge/tbe_plugin_manager.h → ge/common/ge/tbe_plugin_manager.h View File


src/ge/common/ge_common.mk → ge/common/ge_common.mk View File


src/ge/common/ge_format_util.cc → ge/common/ge_format_util.cc View File


src/ge/common/helper/model_cache_helper.cc → ge/common/helper/model_cache_helper.cc View File


src/ge/common/helper/model_cache_helper.h → ge/common/helper/model_cache_helper.h View File


src/ge/common/helper/model_helper.cc → ge/common/helper/model_helper.cc View File


src/ge/common/helper/om_file_helper.cc → ge/common/helper/om_file_helper.cc View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save