@@ -0,0 +1,6 @@ | |||
[submodule "metadef"] | |||
path = metadef | |||
url = https://gitee.com/ascend/metadef.git | |||
[submodule "parser"] | |||
path = parser | |||
url = https://gitee.com/ascend/parser.git |
@@ -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_RUNTIME_DIR}) | |||
find_module(runtime_compile libruntime_compile.so ${ASCEND_ATC_DIR}) | |||
find_module(runtime libruntime.so ${ASCEND_RUNTIME_DIR}) | |||
find_module(resource libresource.so ${ASCEND_ATC_DIR}) | |||
find_module(error_manager liberror_manager.so ${ASCEND_RUNTIME_DIR}) | |||
find_module(error_manager_static liberror_manager.a ${ASCEND_ACL_DIR}) | |||
find_module(msprofiler libmsprofiler.a ${ASCEND_RUNTIME_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) |
@@ -23,7 +23,7 @@ export BUILD_PATH="${BASEPATH}/build/" | |||
usage() | |||
{ | |||
echo "Usage:" | |||
echo "sh build.sh [-j[n]] [-h] [-v] [-s] [-t] [-u] [-c]" | |||
echo "sh build.sh [-j[n]] [-h] [-v] [-s] [-t] [-u] [-c] [-S on|off]" | |||
echo "" | |||
echo "Options:" | |||
echo " -h Print usage" | |||
@@ -32,10 +32,23 @@ 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 ..." | |||
} | |||
# check value of input is 'on' or 'off' | |||
# usage: check_on_off arg_value arg_name | |||
check_on_off() | |||
{ | |||
if [[ "X$1" != "Xon" && "X$1" != "Xoff" ]]; then | |||
echo "Invalid value $1 for option -$2" | |||
usage | |||
exit 1 | |||
fi | |||
} | |||
# parse and set options | |||
checkopts() | |||
{ | |||
@@ -46,8 +59,11 @@ checkopts() | |||
ENABLE_GE_ST="off" | |||
ENABLE_GE_COV="off" | |||
GE_ONLY="on" | |||
PLATFORM="train" | |||
PRODUCT="normal" | |||
ENABLE_GITEE="off" | |||
# Process the options | |||
while getopts 'ustchj:v' opt | |||
while getopts 'ustchj:p:g:vS:' opt | |||
do | |||
OPTARG=$(echo ${OPTARG} | tr '[A-Z]' '[a-z]') | |||
case "${opt}" in | |||
@@ -77,6 +93,17 @@ checkopts() | |||
v) | |||
VERBOSE="VERBOSE=1" | |||
;; | |||
p) | |||
PLATFORM=$OPTARG | |||
;; | |||
g) | |||
PRODUCT=$OPTARG | |||
;; | |||
S) | |||
check_on_off $OPTARG S | |||
ENABLE_GITEE="$OPTARG" | |||
echo "enable download from gitee" | |||
;; | |||
*) | |||
echo "Undefined option: ${opt}" | |||
usage | |||
@@ -86,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 | |||
@@ -100,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 | |||
@@ -117,17 +147,45 @@ build_graphengine() | |||
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_GE_ST=ON" | |||
fi | |||
if [[ "X$ENABLE_GITEE" = "Xon" ]]; then | |||
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_GITEE=ON" | |||
fi | |||
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_OPEN_SRC=True -DCMAKE_INSTALL_PREFIX=${OUTPUT_PATH} -DPLATFORM=${PLATFORM} -DPRODUCT=${PRODUCT}" | |||
echo "${CMAKE_ARGS}" | |||
cmake ${CMAKE_ARGS} ../.. | |||
make ${VERBOSE} -j${THREAD_NUM} | |||
cmake ${CMAKE_ARGS} .. | |||
if [ $? -ne 0 ] | |||
then | |||
echo "execute command: cmake ${CMAKE_ARGS} .. failed." | |||
return 1 | |||
fi | |||
COMMON_TARGET="ge_common engine fmk_parser parser_common _caffe_parser fmk_onnx_parser graph register engine_conf.json optimizer_priority.pbtxt " | |||
TARGET=${COMMON_TARGET} | |||
if [ "x${PLATFORM}" = "xtrain" ] | |||
then | |||
TARGET="ge_runner ge_local_engine host_cpu_engine ${TARGET}" | |||
elif [ "x${PLATFORM}" = "xinference" ] | |||
then | |||
TARGET="ge_compiler atc_ge_local_engine atc_host_cpu_engine atc opensrc_ascendcl ${TARGET}" | |||
elif [ "x${PLATFORM}" = "xall" ] | |||
then | |||
# build all the target | |||
TARGET="ge_runner ge_local_engine host_cpu_engine ge_compiler atc_ge_local_engine atc_host_cpu_engine atc opensrc_ascendcl ${TARGET}" | |||
fi | |||
make ${VERBOSE} ${TARGET} -j${THREAD_NUM} && make install | |||
if [ $? -ne 0 ] | |||
then | |||
echo "execute command: make ${VERBOSE} -j${THREAD_NUM} && make install failed." | |||
return 1 | |||
fi | |||
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 | |||
@@ -175,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 1 -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 | |||
@@ -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() |
@@ -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,0 +1,47 @@ | |||
if (HAVE_GFLAGS) | |||
return() | |||
endif() | |||
include(ExternalProject) | |||
#set(CMAKE_INSTALL_PREFIX ${GE_CODE_DIR}/output) | |||
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() | |||
if (ENABLE_GITEE) | |||
set(REQ_URL "https://gitee.com/mirrors/gflags/repository/archive/v2.2.2.tar.gz") | |||
set(MD5 "") | |||
else() | |||
set(REQ_URL "https://github.com/gflags/gflags/archive/v2.2.2.tar.gz") | |||
set(MD5 "") | |||
endif () | |||
ExternalProject_Add(gflags_build | |||
URL ${REQ_URL} | |||
#URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz | |||
#SOURCE_DIR ${GE_CODE_DIR}/../third_party/gflags/src/gflags-2.2.2 | |||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/gflags <SOURCE_DIR> | |||
BUILD_COMMAND $(MAKE) | |||
INSTALL_COMMAND $(MAKE) install | |||
EXCLUDE_FROM_ALL TRUE | |||
) | |||
set(GFLAGS_PKG_DIR ${CMAKE_INSTALL_PREFIX}/gflags) | |||
add_library(gflags_static STATIC IMPORTED) | |||
set_target_properties(gflags_static PROPERTIES | |||
IMPORTED_LOCATION ${GFLAGS_PKG_DIR}/lib/libgflags.a | |||
) | |||
add_library(gflags INTERFACE) | |||
target_include_directories(gflags INTERFACE ${GFLAGS_PKG_DIR}/include) | |||
target_link_libraries(gflags INTERFACE gflags_static) | |||
add_dependencies(gflags gflags_build) | |||
#set(HAVE_GFLAGS TRUE CACHE BOOL "gflags build add") | |||
set(HAVE_GFLAGS TRUE) |
@@ -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) |
@@ -1,20 +1,33 @@ | |||
set(nlohmann_json_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2") | |||
set(nlohmann_json_CFLAGS "-D_FORTIFY_SOURCE=2 -O2") | |||
if (HAVE_JSON) | |||
return() | |||
endif() | |||
include(ExternalProject) | |||
set(JSON_SRC_DIR ${CMAKE_BINARY_DIR}/opensrc/json/include) | |||
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") | |||
set(JSON_INCLUDE_DIR "${JSON_SRC_DIR}/include") | |||
else() | |||
set(REQ_URL "https://github.com/nlohmann/json/releases/download/v3.6.1/include.zip") | |||
set(MD5 "0dc903888211db3a0f170304cd9f3a89") | |||
set(INCLUDE "./") | |||
set(JSON_INCLUDE_DIR ${JSON_SRC_DIR}) | |||
endif () | |||
ExternalProject_Add(json_build | |||
URL ${REQ_URL} | |||
#URL /home/txd/workspace/cloud_code/pkg/include.zip | |||
SOURCE_DIR ${JSON_SRC_DIR} | |||
CONFIGURE_COMMAND "" | |||
BUILD_COMMAND "" | |||
INSTALL_COMMAND "" | |||
EXCLUDE_FROM_ALL TRUE | |||
) | |||
add_library(json INTERFACE) | |||
target_include_directories(json INTERFACE ${JSON_INCLUDE_DIR}) | |||
add_dependencies(json json_build) | |||
graphengine_add_pkg(ge_nlohmann_json | |||
VER 3.6.1 | |||
HEAD_ONLY ${INCLUDE} | |||
URL ${REQ_URL} | |||
MD5 ${MD5}) | |||
include_directories(${ge_nlohmann_json_INC}) | |||
add_library(graphengine::json ALIAS ge_nlohmann_json) | |||
#set(HAVE_JSON TRUE CACHE BOOL "json build add") | |||
set(HAVE_JSON TRUE) |
@@ -1,3 +1,11 @@ | |||
include(ExternalProject) | |||
#set(ONNX_SRC_DIR /home/txd/workspace/cloud_code/graphengine/build/graphengine/open_source/onnx) | |||
#set(ONNX_PROTO ${ONNX_SRC_DIR}/onnx/onnx.proto) | |||
set(ONNX_PROTO_DIR ${CMAKE_BINARY_DIR}/onnx) | |||
set(ONNX_PROTO_FILE ${ONNX_PROTO_DIR}/onnx.proto) | |||
file(MAKE_DIRECTORY ${ONNX_PROTO_DIR}) | |||
if (ENABLE_GITEE) | |||
set(REQ_URL "https://gitee.com/mirrors/ONNX/repository/archive/v1.6.0.tar.gz") | |||
set(MD5 "1bdbcecdd68ea8392630467646776e02") | |||
@@ -6,8 +14,24 @@ else() | |||
set(MD5 "512f2779d6215d4a36f366b6b9acdf1e") | |||
endif () | |||
graphengine_add_pkg(onnx | |||
VER 1.6.0 | |||
HEAD_ONLY ./ | |||
URL ${REQ_URL} | |||
MD5 ${MD5}) | |||
ExternalProject_Add(onnx | |||
URL ${REQ_URL} | |||
#URL /home/txd/workspace/cloud_code/pkg/onnx-1.6.0.tar.gz | |||
#URL_HASH SHA256=3b88c3fe521151651a0403c4d131cb2e0311bd28b753ef692020a432a81ce345 | |||
#SOURCE_DIR ${ONNX_SRC_DIR} | |||
CONFIGURE_COMMAND "" | |||
BUILD_COMMAND "" | |||
#INSTALL_COMMAND "" | |||
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy <SOURCE_DIR>/onnx/onnx.proto ${ONNX_PROTO_FILE} | |||
#BUILD_ALWAYS TRUE | |||
EXCLUDE_FROM_ALL TRUE | |||
) | |||
macro(onnx_protobuf_generate comp c_var h_var) | |||
add_custom_command(OUTPUT ${ONNX_PROTO_FILE} | |||
DEPENDS onnx | |||
) | |||
ge_protobuf_generate(${comp} ${c_var} ${h_var} ${ONNX_PROTO_FILE}) | |||
endmacro() | |||
@@ -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() |
@@ -7,17 +7,25 @@ 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() | |||
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 () | |||
set(protobuf_CXXFLAGS "-Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -D_GLIBCXX_USE_CXX11_ABI=0 -O2") | |||
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 ${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} | |||
@@ -0,0 +1,51 @@ | |||
include(ExternalProject) | |||
include(GNUInstallDirs) | |||
#set(CMAKE_INSTALL_PREFIX ${GE_CODE_DIR}/output) | |||
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() | |||
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 () | |||
set(protobuf_CXXFLAGS "-Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -D_GLIBCXX_USE_CXX11_ABI=0 -O2") | |||
set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack") | |||
set(PROTOBUF_STATIC_PKG_DIR ${CMAKE_INSTALL_PREFIX}/protobuf_static) | |||
ExternalProject_Add(protobuf_static_build | |||
URL ${REQ_URL} | |||
#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 | |||
CONFIGURE_COMMAND ${CMAKE_COMMAND} | |||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} | |||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} | |||
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} | |||
-DCMAKE_LINKER=${CMAKE_LINKER} | |||
-DCMAKE_AR=${CMAKE_AR} | |||
-DCMAKE_RANLIB=${CMAKE_RANLIB} | |||
-Dprotobuf_WITH_ZLIB=OFF | |||
-Dprotobuf_BUILD_TESTS=OFF -DCMAKE_CXX_FLAGS=${protobuf_CXXFLAGS} -DCMAKE_CXX_LDFLAGS=${protobuf_LDFLAGS} -DCMAKE_INSTALL_PREFIX=${PROTOBUF_STATIC_PKG_DIR} <SOURCE_DIR>/cmake | |||
BUILD_COMMAND $(MAKE) | |||
INSTALL_COMMAND $(MAKE) install | |||
EXCLUDE_FROM_ALL TRUE | |||
) | |||
include(GNUInstallDirs) | |||
add_library(protobuf_static_lib STATIC IMPORTED) | |||
set_target_properties(protobuf_static_lib PROPERTIES | |||
IMPORTED_LOCATION ${PROTOBUF_STATIC_PKG_DIR}/${CMAKE_INSTALL_LIBDIR}/libprotobuf.a | |||
) | |||
add_library(protobuf_static INTERFACE) | |||
target_include_directories(protobuf_static INTERFACE ${PROTOBUF_STATIC_PKG_DIR}/include) | |||
target_link_libraries(protobuf_static INTERFACE protobuf_static_lib) | |||
add_dependencies(protobuf_static protobuf_static_build) |
@@ -8,7 +8,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() | |||
@@ -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) |
@@ -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() |
@@ -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> | |||
) | |||
@@ -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) |
@@ -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 +1,901 @@ | |||
add_subdirectory(common) | |||
add_subdirectory(plugin/engine) | |||
add_subdirectory(graph/build/memory) | |||
add_subdirectory(ge_local_engine) | |||
add_subdirectory(host_cpu_engine) | |||
add_subdirectory(executor) | |||
add_subdirectory(offline) | |||
set(PROTO_LIST | |||
"${METADEF_DIR}/proto/fusion_model.proto" | |||
"${GE_CODE_DIR}/ge/proto/optimizer_priority.proto" | |||
) | |||
set(PROTO_CLIENT_LIST | |||
"${METADEF_DIR}/proto/ge_api.proto" | |||
) | |||
set(PROTO_HEADER_LIST | |||
"${METADEF_DIR}/proto/om.proto" | |||
"${METADEF_DIR}/proto/task.proto" | |||
"${METADEF_DIR}/proto/insert_op.proto" | |||
"${METADEF_DIR}/proto/ge_ir.proto" | |||
"${METADEF_DIR}/proto/fwk_adapter.proto" | |||
"${METADEF_DIR}/proto/op_mapping_info.proto" | |||
) | |||
protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST}) | |||
protobuf_generate(ge PROTO_CLIENT_SRCS PROTO_CLIENT_HDRS ${PROTO_CLIENT_LIST}) | |||
protobuf_generate(ge PROTO_HEADER_SRCS PROTO_HEADER_HDRS ${PROTO_HEADER_LIST}) | |||
############ libge_runner.so ############ | |||
set(TRAIN_SRC_LIST | |||
"common/formats/format_transfers/datatype_transfer.cc" | |||
"common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc" | |||
"common/formats/format_transfers/format_transfer_dhwcn_fracz3D.cc" | |||
"common/formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc" | |||
"common/formats/format_transfers/format_transfer_fractal_nz.cc" | |||
"common/formats/format_transfers/format_transfer_fractal_z.cc" | |||
"common/formats/format_transfers/format_transfer_fractal_zz.cc" | |||
"common/formats/format_transfers/format_transfer_fracz_hwcn.cc" | |||
"common/formats/format_transfers/format_transfer_fracz_nchw.cc" | |||
"common/formats/format_transfers/format_transfer_fracz_nhwc.cc" | |||
"common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc" | |||
"common/formats/format_transfers/format_transfer_nc1hwc0_nchw.cc" | |||
"common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc" | |||
"common/formats/format_transfers/format_transfer_nchw_nc1hwc0.cc" | |||
"common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc" | |||
"common/formats/format_transfers/format_transfer_transpose.cc" | |||
"common/formats/formats.cc" | |||
"common/formats/utils/formats_trans_utils.cc" | |||
"common/fp16_t.cc" | |||
"common/ge/plugin_manager.cc" | |||
"common/ge/op_tiling_manager.cc" | |||
"common/helper/model_cache_helper.cc" | |||
"common/profiling/profiling_manager.cc" | |||
"common/dump/dump_manager.cc" | |||
"common/dump/dump_properties.cc" | |||
"common/dump/dump_op.cc" | |||
"engine_manager/dnnengine_manager.cc" | |||
"ge_local_engine/engine/host_cpu_engine.cc" | |||
"generator/ge_generator.cc" | |||
"generator/generator_api.cc" | |||
"graph/build/graph_builder.cc" | |||
"graph/build/label_allocator.cc" | |||
"graph/build/logical_stream_allocator.cc" | |||
"graph/build/model_builder.cc" | |||
"graph/build/run_context.cc" | |||
"graph/build/stream_allocator.cc" | |||
"graph/build/stream_graph_optimizer.cc" | |||
"graph/build/task_generator.cc" | |||
"graph/common/bcast.cc" | |||
"graph/common/local_context.cc" | |||
"graph/common/omg_util.cc" | |||
"graph/common/transop_util.cc" | |||
"graph/execute/graph_execute.cc" | |||
"graph/label/case_label_maker.cc" | |||
"graph/label/if_label_maker.cc" | |||
"graph/label/label_maker.cc" | |||
"graph/label/partitioned_call_label_maker.cc" | |||
"graph/label/while_label_maker.cc" | |||
"graph/load/graph_loader.cc" | |||
"graph/load/new_model_manager/cpu_queue_schedule.cc" | |||
"graph/load/new_model_manager/data_dumper.cc" | |||
"graph/load/new_model_manager/data_inputer.cc" | |||
"graph/load/new_model_manager/davinci_model.cc" | |||
"graph/load/new_model_manager/davinci_model_parser.cc" | |||
"graph/load/new_model_manager/model_manager.cc" | |||
"graph/load/new_model_manager/model_utils.cc" | |||
"graph/load/new_model_manager/aipp_utils.cc" | |||
"graph/load/new_model_manager/task_info/end_graph_task_info.cc" | |||
"graph/load/new_model_manager/task_info/event_record_task_info.cc" | |||
"graph/load/new_model_manager/task_info/event_wait_task_info.cc" | |||
"graph/load/new_model_manager/task_info/fusion_start_task_info.cc" | |||
"graph/load/new_model_manager/task_info/fusion_stop_task_info.cc" | |||
"graph/load/new_model_manager/task_info/hccl_task_info.cc" | |||
"graph/load/new_model_manager/task_info/kernel_ex_task_info.cc" | |||
"graph/load/new_model_manager/task_info/kernel_task_info.cc" | |||
"graph/load/new_model_manager/task_info/label_set_task_info.cc" | |||
"graph/load/new_model_manager/task_info/label_switch_by_index_task_info.cc" | |||
"graph/load/new_model_manager/task_info/label_goto_ex_task_info.cc" | |||
"graph/load/new_model_manager/task_info/memcpy_addr_async_task_info.cc" | |||
"graph/load/new_model_manager/task_info/memcpy_async_task_info.cc" | |||
"graph/load/new_model_manager/task_info/profiler_trace_task_info.cc" | |||
"graph/load/new_model_manager/task_info/stream_active_task_info.cc" | |||
"graph/load/new_model_manager/task_info/stream_switch_task_info.cc" | |||
"graph/load/new_model_manager/task_info/stream_switchn_task_info.cc" | |||
"graph/load/new_model_manager/task_info/super_kernel/super_kernel.cc" | |||
"graph/load/new_model_manager/task_info/super_kernel/super_kernel_factory.cc" | |||
"graph/load/new_model_manager/task_info/task_info.cc" | |||
"graph/load/new_model_manager/tbe_handle_store.cc" | |||
"graph/load/new_model_manager/zero_copy_task.cc" | |||
"graph/load/new_model_manager/zero_copy_offset.cc" | |||
"graph/manager/graph_context.cc" | |||
"graph/manager/graph_manager.cc" | |||
"graph/manager/graph_manager_utils.cc" | |||
"graph/manager/graph_mem_allocator.cc" | |||
"graph/manager/graph_caching_allocator.cc" | |||
"graph/manager/graph_var_manager.cc" | |||
"graph/manager/host_mem_manager.cc" | |||
"graph/manager/rdma_pool_allocator.cc" | |||
"graph/manager/memory_api.cc" | |||
"graph/manager/model_manager/event_manager.cc" | |||
"graph/manager/trans_var_data_utils.cc" | |||
"graph/manager/util/debug.cc" | |||
"graph/manager/util/hcom_util.cc" | |||
"graph/manager/util/rt_context_util.cc" | |||
"graph/manager/util/variable_accelerate_ctrl.cc" | |||
"graph/optimize/graph_optimize.cc" | |||
"graph/optimize/mem_rw_conflict_optimize.cc" | |||
"graph/optimize/summary_optimize.cc" | |||
"graph/partition/engine_place.cc" | |||
"graph/partition/graph_partition.cc" | |||
"graph/passes/addn_pass.cc" | |||
"graph/passes/aicpu_constant_folding_pass.cc" | |||
"graph/passes/assert_pass.cc" | |||
"graph/passes/input_output_connection_identify_pass.cc" | |||
"graph/passes/atomic_addr_clean_pass.cc" | |||
"graph/passes/mark_same_addr_pass.cc" | |||
"graph/passes/mark_graph_unknown_status_pass.cc" | |||
"graph/passes/mark_agnostic_pass.cc" | |||
"graph/partition/dynamic_shape_partition.cc" | |||
"graph/passes/base_pass.cc" | |||
"graph/passes/bitcast_pass.cc" | |||
"graph/passes/cast_remove_pass.cc" | |||
"graph/passes/cast_translate_pass.cc" | |||
"graph/passes/common_subexpression_elimination_pass.cc" | |||
"graph/passes/transop_symmetry_elimination_pass.cc" | |||
"graph/passes/compile_nodes_pass.cc" | |||
"graph/passes/constant_folding_pass.cc" | |||
"graph/passes/constant_fuse_same_pass.cc" | |||
"graph/passes/control_trigger_pass.cc" | |||
"graph/passes/dimension_adjust_pass.cc" | |||
"graph/passes/dimension_compute_pass.cc" | |||
"graph/passes/dropout_pass.cc" | |||
"graph/passes/hccl_group_pass.cc" | |||
"graph/passes/enter_pass.cc" | |||
"graph/passes/assign_pass.cc" | |||
"graph/passes/flow_ctrl_pass.cc" | |||
"graph/passes/global_step_insert_pass.cc" | |||
"host_kernels/transpose_kernel.cc" | |||
"host_kernels/add_kernel.cc" | |||
"host_kernels/broadcast_args_kernel.cc" | |||
"host_kernels/broadcast_gradient_args_kernel.cc" | |||
"host_kernels/cast_kernel.cc" | |||
"host_kernels/concat_offset_kernel.cc" | |||
"host_kernels/concat_v2_kernel.cc" | |||
"host_kernels/dynamic_stitch_kernel.cc" | |||
"host_kernels/identity_kernel.cc" | |||
"host_kernels/empty_kernel.cc" | |||
"host_kernels/expanddims_kernel.cc" | |||
"host_kernels/fill_kernel.cc" | |||
"host_kernels/floordiv_kernel.cc" | |||
"host_kernels/floormod_kernel.cc" | |||
"host_kernels/gather_v2_kernel.cc" | |||
"host_kernels/greater_kernel.cc" | |||
"host_kernels/kernel_utils.cc" | |||
"host_kernels/maximum_kernel.cc" | |||
"host_kernels/mul_kernel.cc" | |||
"host_kernels/pack_kernel.cc" | |||
"host_kernels/permute_kernel.cc" | |||
"host_kernels/range_kernel.cc" | |||
"host_kernels/rank_kernel.cc" | |||
"host_kernels/reduce_prod_kernel.cc" | |||
"host_kernels/reshape_kernel.cc" | |||
"host_kernels/rsqrt_kernel.cc" | |||
"host_kernels/shape_kernel.cc" | |||
"host_kernels/shape_n_kernel.cc" | |||
"host_kernels/size_kernel.cc" | |||
"host_kernels/slice_d_kernel.cc" | |||
"host_kernels/slice_kernel.cc" | |||
"host_kernels/squeeze_kernel.cc" | |||
"host_kernels/unsqueeze_kernel.cc" | |||
"host_kernels/ssd_prior_box_kernel.cc" | |||
"host_kernels/strided_slice_kernel.cc" | |||
"host_kernels/sub_kernel.cc" | |||
"host_kernels/transdata_kernel.cc" | |||
"host_kernels/unpack_kernel.cc" | |||
"graph/passes/folding_pass.cc" | |||
"graph/passes/get_original_format_pass.cc" | |||
"graph/passes/guarantee_const_pass.cc" | |||
"graph/passes/hccl_memcpy_pass.cc" | |||
"graph/passes/identity_pass.cc" | |||
"graph/passes/ref_identity_delete_op_pass.cc" | |||
"graph/passes/infershape_pass.cc" | |||
"graph/passes/isolated_op_remove_pass.cc" | |||
"graph/passes/iterator_op_pass.cc" | |||
"graph/passes/link_gen_mask_nodes_pass.cc" | |||
"graph/passes/merge_pass.cc" | |||
"graph/passes/multi_batch_pass.cc" | |||
"graph/passes/multi_batch_clone_pass.cc" | |||
"graph/passes/subexpression_migration_pass.cc" | |||
"graph/passes/unused_args_clean_pass.cc" | |||
"graph/passes/net_output_pass.cc" | |||
"graph/passes/next_iteration_pass.cc" | |||
"graph/passes/no_use_reshape_remove_pass.cc" | |||
"graph/passes/pass_manager.cc" | |||
"graph/passes/pass_utils.cc" | |||
"graph/passes/permute_pass.cc" | |||
"graph/passes/placeholder_with_default_pass.cc" | |||
"graph/passes/prevent_gradient_pass.cc" | |||
"graph/passes/print_op_pass.cc" | |||
"graph/passes/prune_pass.cc" | |||
"graph/passes/ctrl_edge_transfer_pass.cc" | |||
"graph/passes/replace_with_empty_const_pass.cc" | |||
"graph/passes/reshape_remove_pass.cc" | |||
"graph/passes/reshape_recovery_pass.cc" | |||
"graph/passes/resource_pair_add_control_pass.cc" | |||
"graph/passes/resource_pair_remove_control_pass.cc" | |||
"graph/passes/same_transdata_breadth_fusion_pass.cc" | |||
"graph/passes/save_pass.cc" | |||
"graph/passes/shape_operate_op_remove_pass.cc" | |||
"graph/passes/snapshot_pass.cc" | |||
"graph/passes/stop_gradient_pass.cc" | |||
"graph/passes/subgraph_pass.cc" | |||
"graph/passes/data_pass.cc" | |||
"graph/passes/switch_data_edges_bypass.cc" | |||
"graph/passes/switch_logic_remove_pass.cc" | |||
"graph/passes/merge_to_stream_merge_pass.cc" | |||
"graph/passes/switch_to_stream_switch_pass.cc" | |||
"graph/passes/attach_stream_label_pass.cc" | |||
"graph/passes/switch_dead_branch_elimination.cc" | |||
"graph/passes/replace_transshape_pass.cc" | |||
"graph/passes/transop_breadth_fusion_pass.cc" | |||
"graph/passes/transop_depth_fusion_pass.cc" | |||
"graph/passes/transop_nearby_allreduce_fusion_pass.cc" | |||
"graph/passes/transop_without_reshape_fusion_pass.cc" | |||
"graph/passes/transpose_transdata_pass.cc" | |||
"graph/passes/unused_const_pass.cc" | |||
"graph/passes/unused_op_remove_pass.cc" | |||
"graph/passes/var_is_initialized_op_pass.cc" | |||
"graph/passes/parallel_concat_start_op_pass.cc" | |||
"graph/passes/cond_pass.cc" | |||
"graph/passes/cond_remove_pass.cc" | |||
"graph/passes/for_pass.cc" | |||
"graph/passes/variable_format_pass.cc" | |||
"graph/passes/variable_op_pass.cc" | |||
"graph/passes/variable_prepare_op_pass.cc" | |||
"graph/passes/variable_ref_delete_op_pass.cc" | |||
"graph/passes/variable_ref_useless_control_out_delete_pass.cc" | |||
"graph/passes/end_of_sequence_add_control_pass.cc" | |||
"graph/passes/memcpy_addr_async_pass.cc" | |||
"graph/passes/set_input_output_offset_pass.cc" | |||
"graph/preprocess/graph_preprocess.cc" | |||
"graph/preprocess/insert_op/ge_aipp_op.cc" | |||
"graph/preprocess/insert_op/util_insert_aipp_op.cc" | |||
"graph/preprocess/multi_batch_options.cc" | |||
"graph/preprocess/multi_batch_copy_graph.cc" | |||
"init/gelib.cc" | |||
"model/ge_model.cc" | |||
"model/ge_root_model.cc" | |||
"omm/csa_interact.cc" | |||
"opskernel_manager/ops_kernel_manager.cc" | |||
"session/inner_session.cc" | |||
"session/session_manager.cc" | |||
"single_op/single_op.cc" | |||
"single_op/single_op_manager.cc" | |||
"single_op/single_op_model.cc" | |||
"single_op/stream_resource.cc" | |||
"single_op/task/build_task_utils.cc" | |||
"single_op/task/op_task.cc" | |||
"single_op/task/tbe_task_builder.cc" | |||
"single_op/task/aicpu_task_builder.cc" | |||
"single_op/task/aicpu_kernel_task_builder.cc" | |||
"hybrid/common/tensor_value.cc" | |||
"hybrid/common/npu_memory_allocator.cc" | |||
"hybrid/executor/rt_callback_manager.cc" | |||
"hybrid/executor/node_state.cc" | |||
"hybrid/executor/node_done_manager.cc" | |||
"hybrid/executor/hybrid_profiler.cc" | |||
"hybrid/executor/hybrid_model_executor.cc" | |||
"hybrid/executor/hybrid_model_async_executor.cc" | |||
"hybrid/executor/hybrid_execution_context.cc" | |||
"hybrid/executor/subgraph_context.cc" | |||
"hybrid/executor/subgraph_executor.cc" | |||
"hybrid/executor/worker/task_compile_engine.cc" | |||
"hybrid/executor/worker/shape_inference_engine.cc" | |||
"hybrid/executor/worker/execution_engine.cc" | |||
"hybrid/model/hybrid_model.cc" | |||
"hybrid/model/hybrid_model_builder.cc" | |||
"hybrid/model/node_item.cc" | |||
"hybrid/model/graph_item.cc" | |||
"hybrid/node_executor/aicore/aicore_node_executor.cc" | |||
"hybrid/node_executor/aicore/aicore_op_task.cc" | |||
"hybrid/node_executor/aicore/aicore_task_builder.cc" | |||
"hybrid/node_executor/aicore/aicore_task_compiler.cc" | |||
"hybrid/node_executor/aicpu/aicpu_ext_info.cc" | |||
"hybrid/node_executor/aicpu/aicpu_node_executor.cc" | |||
"hybrid/node_executor/compiledsubgraph/known_node_executor.cc" | |||
"hybrid/node_executor/ge_local/ge_local_node_executor.cc" | |||
"hybrid/node_executor/host_cpu/host_cpu_node_executor.cc" | |||
"hybrid/node_executor/host_cpu/kernel_factory.cc" | |||
"hybrid/node_executor/host_cpu/kernel/no_op_kernel.cc" | |||
"hybrid/node_executor/host_cpu/kernel/variable_kernel.cc" | |||
"hybrid/node_executor/host_cpu/kernel/assign_kernel.cc" | |||
"hybrid/node_executor/host_cpu/kernel/random_uniform_kernel.cc" | |||
"hybrid/node_executor/controlop/control_op_executor.cc" | |||
"hybrid/node_executor/partitioned_call/partitioned_call_node_executor.cc" | |||
"hybrid/node_executor/hccl/hccl_node_executor.cc" | |||
"hybrid/node_executor/rts/rts_node_executor.cc" | |||
"hybrid/node_executor/node_executor.cc" | |||
"hybrid/node_executor/task_context.cc" | |||
"hybrid/hybrid_davinci_model.cc" | |||
"executor/ge_executor.cc" | |||
"client/ge_api.cc" | |||
"client/ge_prof.cc" | |||
"analyzer/analyzer.cc" | |||
) | |||
add_library(ge_runner SHARED ${TRAIN_SRC_LIST} ${PROTO_SRCS} ${PROTO_CLIENT_SRCS}) | |||
target_compile_definitions(ge_runner PRIVATE | |||
PROTOBUF_INLINE_NOT_IN_HEADERS=0 | |||
DAVINCI_SUPPORT_PROFILING | |||
REUSE_MEMORY=1 | |||
FMK_SUPPORT_DUMP | |||
DAVINCI_CLOUD | |||
) | |||
target_compile_options(ge_runner PRIVATE | |||
-O2 | |||
) | |||
target_include_directories(ge_runner PRIVATE | |||
${GE_CODE_DIR}/ge | |||
${GE_CODE_DIR}/ge/analyzer | |||
${GE_CODE_DIR}/inc | |||
${GE_CODE_DIR}/inc/external | |||
${GE_CODE_DIR}/inc/framework | |||
${GE_CODE_DIR}/inc/framework/common | |||
${METADEF_DIR} | |||
${METADEF_DIR}/inc | |||
${METADEF_DIR}/inc/external/graph | |||
${METADEF_DIR}/inc/external | |||
${METADEF_DIR}/inc/graph | |||
${CMAKE_BINARY_DIR} | |||
${CMAKE_BINARY_DIR}/proto/ge | |||
#### yellow zone #### | |||
${GE_CODE_DIR}/../inc | |||
${GE_CODE_DIR}/../inc/external | |||
${GE_CODE_DIR}/../inc/cce | |||
${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external | |||
#### blue zone | |||
${ASCEND_DIR}/driver/include | |||
${ASCEND_DIR}/fwkacllib/include | |||
${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain | |||
) | |||
target_link_libraries(ge_runner | |||
$<BUILD_INTERFACE:intf_pub> | |||
ge_memory | |||
adump_server | |||
msprofiler | |||
-Wl,--no-as-needed | |||
graph | |||
ge_common | |||
protobuf | |||
register | |||
c_sec | |||
slog | |||
mmpa | |||
msprof | |||
runtime | |||
resource | |||
error_manager | |||
ascend_hal_stub | |||
json | |||
-Wl,--as-needed | |||
-lrt | |||
-ldl | |||
) | |||
############ libge_compiler.so ############ | |||
set(INFER_SRC_LIST | |||
"graph/manager/trans_var_data_utils.cc" | |||
"omm/csa_interact.cc" | |||
"common/fp16_t.cc" | |||
"common/formats/utils/formats_trans_utils.cc" | |||
"common/formats/format_transfers/datatype_transfer.cc" | |||
"common/formats/format_transfers/format_transfer_transpose.cc" | |||
"common/formats/format_transfers/format_transfer_nchw_nc1hwc0.cc" | |||
"common/formats/format_transfers/format_transfer_fractal_z.cc" | |||
"common/formats/format_transfers/format_transfer_fractal_nz.cc" | |||
"common/formats/format_transfers/format_transfer_fractal_zz.cc" | |||
"common/formats/format_transfers/format_transfer_nhwc_nc1hwc0.cc" | |||
"common/formats/format_transfers/format_transfer_nc1hwc0_nchw.cc" | |||
"common/formats/format_transfers/format_transfer_nc1hwc0_nhwc.cc" | |||
"common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc" | |||
"common/formats/format_transfers/format_transfer_c1hwncoc0_hwcn.cc" | |||
"common/formats/format_transfers/format_transfer_fracz_nchw.cc" | |||
"common/formats/format_transfers/format_transfer_fracz_nhwc.cc" | |||
"common/formats/format_transfers/format_transfer_fracz_hwcn.cc" | |||
"common/formats/format_transfers/format_transfer_dhwcn_fracz3D.cc" | |||
"common/formats/format_transfers/format_transfer_dhwnc_fracz3D_transpose.cc" | |||
"common/formats/format_transfers/format_transfer_nchw_fz_c04.cc" | |||
"common/formats/formats.cc" | |||
"common/profiling/profiling_manager.cc" | |||
"common/dump/dump_properties.cc" | |||
"common/dump/dump_manager.cc" | |||
"common/dump/dump_op.cc" | |||
"common/dump/dump_server.cc" | |||
"common/helper/model_cache_helper.cc" | |||
"ge_local_engine/engine/host_cpu_engine.cc" | |||
"common/ge/plugin_manager.cc" | |||
"common/ge/op_tiling_manager.cc" | |||
"init/gelib.cc" | |||
"session/inner_session.cc" | |||
"session/session_manager.cc" | |||
"engine_manager/dnnengine_manager.cc" | |||
"opskernel_manager/ops_kernel_manager.cc" | |||
"graph/manager/graph_manager.cc" | |||
"graph/manager/graph_manager_utils.cc" | |||
"graph/manager/graph_context.cc" | |||
"graph/preprocess/graph_preprocess.cc" | |||
"graph/preprocess/multi_batch_options.cc" | |||
"graph/preprocess/multi_batch_copy_graph.cc" | |||
"graph/execute/graph_execute.cc" | |||
"graph/load/graph_loader.cc" | |||
"graph/optimize/graph_optimize.cc" | |||
"graph/optimize/mem_rw_conflict_optimize.cc" | |||
"graph/optimize/summary_optimize.cc" | |||
"graph/build/graph_builder.cc" | |||
"graph/partition/engine_place.cc" | |||
"graph/partition/graph_partition.cc" | |||
"graph/partition/dynamic_shape_partition.cc" | |||
"generator/ge_generator.cc" | |||
"generator/generator_api.cc" | |||
"graph/manager/graph_var_manager.cc" | |||
"graph/manager/host_mem_manager.cc" | |||
"graph/manager/rdma_pool_allocator.cc" | |||
"graph/manager/graph_mem_allocator.cc" | |||
"graph/manager/graph_caching_allocator.cc" | |||
"model/ge_model.cc" | |||
"model/ge_root_model.cc" | |||
"graph/common/transop_util.cc" | |||
"graph/passes/pass_manager.cc" | |||
"graph/passes/resource_pair_add_control_pass.cc" | |||
"graph/passes/resource_pair_remove_control_pass.cc" | |||
"graph/passes/pass_utils.cc" | |||
"graph/passes/base_pass.cc" | |||
"graph/passes/bitcast_pass.cc" | |||
"graph/passes/constant_folding_pass.cc" | |||
"graph/passes/aicpu_constant_folding_pass.cc" | |||
"graph/passes/reshape_remove_pass.cc" | |||
"graph/passes/reshape_recovery_pass.cc" | |||
"graph/passes/transop_breadth_fusion_pass.cc" | |||
"graph/passes/transop_depth_fusion_pass.cc" | |||
"graph/passes/transop_nearby_allreduce_fusion_pass.cc" | |||
"graph/passes/same_transdata_breadth_fusion_pass.cc" | |||
"graph/passes/transop_without_reshape_fusion_pass.cc" | |||
"graph/passes/compile_nodes_pass.cc" | |||
"graph/passes/variable_prepare_op_pass.cc" | |||
"graph/passes/variable_ref_delete_op_pass.cc" | |||
"graph/passes/variable_ref_useless_control_out_delete_pass.cc" | |||
"graph/passes/subgraph_pass.cc" | |||
"graph/passes/data_pass.cc" | |||
"graph/passes/net_output_pass.cc" | |||
"graph/passes/replace_transshape_pass.cc" | |||
"graph/passes/constant_fuse_same_pass.cc" | |||
"graph/passes/print_op_pass.cc" | |||
"graph/passes/no_use_reshape_remove_pass.cc" | |||
"graph/passes/iterator_op_pass.cc" | |||
"graph/passes/input_output_connection_identify_pass.cc" | |||
"graph/passes/atomic_addr_clean_pass.cc" | |||
"graph/passes/mark_same_addr_pass.cc" | |||
"graph/passes/mark_graph_unknown_status_pass.cc" | |||
"graph/passes/mark_agnostic_pass.cc" | |||
"graph/common/omg_util.cc" | |||
"graph/common/bcast.cc" | |||
"graph/common/local_context.cc" | |||
"graph/passes/dimension_compute_pass.cc" | |||
"graph/passes/dimension_adjust_pass.cc" | |||
"graph/passes/get_original_format_pass.cc" | |||
"graph/passes/shape_operate_op_remove_pass.cc" | |||
"graph/passes/unused_op_remove_pass.cc" | |||
"graph/passes/assert_pass.cc" | |||
"graph/passes/dropout_pass.cc" | |||
"graph/passes/infershape_pass.cc" | |||
"graph/passes/unused_const_pass.cc" | |||
"graph/passes/isolated_op_remove_pass.cc" | |||
"graph/passes/permute_pass.cc" | |||
"graph/passes/ctrl_edge_transfer_pass.cc" | |||
"graph/passes/end_of_sequence_add_control_pass.cc" | |||
"host_kernels/broadcast_gradient_args_kernel.cc" | |||
"host_kernels/greater_kernel.cc" | |||
"host_kernels/gather_v2_kernel.cc" | |||
"host_kernels/maximum_kernel.cc" | |||
"host_kernels/floormod_kernel.cc" | |||
"host_kernels/floordiv_kernel.cc" | |||
"host_kernels/range_kernel.cc" | |||
"host_kernels/shape_kernel.cc" | |||
"host_kernels/size_kernel.cc" | |||
"host_kernels/shape_n_kernel.cc" | |||
"host_kernels/rank_kernel.cc" | |||
"host_kernels/broadcast_args_kernel.cc" | |||
"host_kernels/fill_kernel.cc" | |||
"host_kernels/empty_kernel.cc" | |||
"host_kernels/expanddims_kernel.cc" | |||
"host_kernels/reshape_kernel.cc" | |||
"host_kernels/squeeze_kernel.cc" | |||
"host_kernels/unsqueeze_kernel.cc" | |||
"host_kernels/kernel_utils.cc" | |||
"host_kernels/cast_kernel.cc" | |||
"host_kernels/transdata_kernel.cc" | |||
"host_kernels/unpack_kernel.cc" | |||
"host_kernels/transpose_kernel.cc" | |||
"host_kernels/permute_kernel.cc" | |||
"host_kernels/pack_kernel.cc" | |||
"host_kernels/concat_v2_kernel.cc" | |||
"host_kernels/concat_offset_kernel.cc" | |||
"host_kernels/strided_slice_kernel.cc" | |||
"host_kernels/ssd_prior_box_kernel.cc" | |||
"host_kernels/add_kernel.cc" | |||
"host_kernels/sub_kernel.cc" | |||
"host_kernels/mul_kernel.cc" | |||
"host_kernels/reduce_prod_kernel.cc" | |||
"host_kernels/rsqrt_kernel.cc" | |||
"host_kernels/slice_kernel.cc" | |||
"host_kernels/slice_d_kernel.cc" | |||
"host_kernels/dynamic_stitch_kernel.cc" | |||
"host_kernels/identity_kernel.cc" | |||
"graph/passes/stop_gradient_pass.cc" | |||
"graph/passes/prevent_gradient_pass.cc" | |||
"graph/passes/identity_pass.cc" | |||
"graph/passes/ref_identity_delete_op_pass.cc" | |||
"graph/passes/placeholder_with_default_pass.cc" | |||
"graph/passes/snapshot_pass.cc" | |||
"graph/passes/guarantee_const_pass.cc" | |||
"graph/passes/var_is_initialized_op_pass.cc" | |||
"graph/passes/parallel_concat_start_op_pass.cc" | |||
"graph/passes/folding_pass.cc" | |||
"graph/passes/cast_translate_pass.cc" | |||
"graph/passes/prune_pass.cc" | |||
"graph/passes/merge_to_stream_merge_pass.cc" | |||
"graph/passes/switch_to_stream_switch_pass.cc" | |||
"graph/passes/attach_stream_label_pass.cc" | |||
"graph/passes/multi_batch_pass.cc" | |||
"graph/passes/multi_batch_clone_pass.cc" | |||
"graph/passes/subexpression_migration_pass.cc" | |||
"graph/passes/unused_args_clean_pass.cc" | |||
"graph/passes/next_iteration_pass.cc" | |||
"graph/passes/control_trigger_pass.cc" | |||
"graph/passes/cond_pass.cc" | |||
"graph/passes/cond_remove_pass.cc" | |||
"graph/passes/for_pass.cc" | |||
"graph/passes/enter_pass.cc" | |||
"graph/passes/assign_pass.cc" | |||
"graph/passes/addn_pass.cc" | |||
"graph/passes/common_subexpression_elimination_pass.cc" | |||
"graph/passes/transop_symmetry_elimination_pass.cc" | |||
"graph/passes/save_pass.cc" | |||
"graph/passes/switch_dead_branch_elimination.cc" | |||
"graph/passes/switch_logic_remove_pass.cc" | |||
"graph/passes/switch_data_edges_bypass.cc" | |||
"graph/passes/merge_pass.cc" | |||
"graph/passes/variable_format_pass.cc" | |||
"graph/passes/variable_op_pass.cc" | |||
"graph/passes/cast_remove_pass.cc" | |||
"graph/passes/transpose_transdata_pass.cc" | |||
"graph/passes/hccl_memcpy_pass.cc" | |||
"graph/passes/flow_ctrl_pass.cc" | |||
"graph/passes/global_step_insert_pass.cc" | |||
"graph/passes/link_gen_mask_nodes_pass.cc" | |||
"graph/passes/replace_with_empty_const_pass.cc" | |||
"graph/passes/hccl_group_pass.cc" | |||
"graph/passes/memcpy_addr_async_pass.cc" | |||
"graph/passes/set_input_output_offset_pass.cc" | |||
"graph/manager/model_manager/event_manager.cc" | |||
"graph/manager/util/rt_context_util.cc" | |||
"graph/manager/util/variable_accelerate_ctrl.cc" | |||
"graph/manager/util/debug.cc" | |||
"graph/load/new_model_manager/model_manager.cc" | |||
"graph/load/new_model_manager/data_inputer.cc" | |||
"graph/load/new_model_manager/davinci_model.cc" | |||
"graph/load/new_model_manager/davinci_model_parser.cc" | |||
"graph/load/new_model_manager/model_utils.cc" | |||
"graph/load/new_model_manager/aipp_utils.cc" | |||
"graph/load/new_model_manager/tbe_handle_store.cc" | |||
"graph/load/new_model_manager/cpu_queue_schedule.cc" | |||
"graph/load/new_model_manager/zero_copy_task.cc" | |||
"graph/load/new_model_manager/zero_copy_offset.cc" | |||
"graph/load/new_model_manager/data_dumper.cc" | |||
"graph/load/new_model_manager/task_info/task_info.cc" | |||
"graph/load/new_model_manager/task_info/event_record_task_info.cc" | |||
"graph/load/new_model_manager/task_info/event_wait_task_info.cc" | |||
"graph/load/new_model_manager/task_info/fusion_start_task_info.cc" | |||
"graph/load/new_model_manager/task_info/fusion_stop_task_info.cc" | |||
"graph/load/new_model_manager/task_info/kernel_ex_task_info.cc" | |||
"graph/load/new_model_manager/task_info/kernel_task_info.cc" | |||
"graph/load/new_model_manager/task_info/label_set_task_info.cc" | |||
"graph/load/new_model_manager/task_info/label_switch_by_index_task_info.cc" | |||
"graph/load/new_model_manager/task_info/label_goto_ex_task_info.cc" | |||
"graph/load/new_model_manager/task_info/memcpy_async_task_info.cc" | |||
"graph/load/new_model_manager/task_info/memcpy_addr_async_task_info.cc" | |||
"graph/load/new_model_manager/task_info/profiler_trace_task_info.cc" | |||
"graph/load/new_model_manager/task_info/stream_active_task_info.cc" | |||
"graph/load/new_model_manager/task_info/stream_switch_task_info.cc" | |||
"graph/load/new_model_manager/task_info/stream_switchn_task_info.cc" | |||
"graph/load/new_model_manager/task_info/end_graph_task_info.cc" | |||
"graph/load/new_model_manager/task_info/super_kernel/super_kernel_factory.cc" | |||
"graph/load/new_model_manager/task_info/super_kernel/super_kernel.cc" | |||
"single_op/task/op_task.cc" | |||
"single_op/task/build_task_utils.cc" | |||
"single_op/task/tbe_task_builder.cc" | |||
"single_op/task/aicpu_task_builder.cc" | |||
"single_op/task/aicpu_kernel_task_builder.cc" | |||
"single_op/single_op.cc" | |||
"single_op/single_op_model.cc" | |||
"single_op/stream_resource.cc" | |||
"single_op/single_op_manager.cc" | |||
"hybrid/hybrid_davinci_model_stub.cc" | |||
"ir_build/ge_ir_build.cc" | |||
"ir_build/atc_ir_common.cc" | |||
"graph/preprocess/insert_op/ge_aipp_op.cc" | |||
"graph/preprocess/insert_op/util_insert_aipp_op.cc" | |||
"hybrid/node_executor/aicpu/aicpu_ext_info.cc" | |||
"graph/build/model_builder.cc" | |||
"graph/build/task_generator.cc" | |||
"graph/build/stream_allocator.cc" | |||
"graph/build/logical_stream_allocator.cc" | |||
"graph/build/stream_graph_optimizer.cc" | |||
"graph/build/run_context.cc" | |||
"graph/build/label_allocator.cc" | |||
"graph/label/label_maker.cc" | |||
"graph/label/if_label_maker.cc" | |||
"graph/label/case_label_maker.cc" | |||
"graph/label/while_label_maker.cc" | |||
"graph/label/partitioned_call_label_maker.cc" | |||
"analyzer/analyzer.cc" | |||
) | |||
add_library(ge_compiler SHARED ${INFER_SRC_LIST} ${PROTO_SRCS}) | |||
target_compile_definitions(ge_compiler PRIVATE | |||
PROTOBUF_INLINE_NOT_IN_HEADERS=0 | |||
REUSE_MEMORY=1 | |||
FMK_SUPPORT_DUMP | |||
FMK_HOST_INFER | |||
COMPILE_OMG_PACKAGE | |||
) | |||
target_compile_options(ge_compiler PRIVATE | |||
-O2 | |||
) | |||
target_include_directories(ge_compiler PRIVATE | |||
${GE_CODE_DIR}/ge | |||
${GE_CODE_DIR}/ge/analyzer | |||
${GE_CODE_DIR}/inc | |||
${GE_CODE_DIR}/inc/external | |||
${GE_CODE_DIR}/inc/framework | |||
${GE_CODE_DIR}/inc/framework/common | |||
${METADEF_DIR} | |||
${METADEF_DIR}/inc | |||
${METADEF_DIR}/inc/external/graph | |||
${METADEF_DIR}/inc/external | |||
${METADEF_DIR}/inc/graph | |||
${CMAKE_BINARY_DIR} | |||
${CMAKE_BINARY_DIR}/proto/ge | |||
#### yellow zone #### | |||
${GE_CODE_DIR}/../inc | |||
${GE_CODE_DIR}/../inc/external | |||
${GE_CODE_DIR}/../inc/cce | |||
${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external | |||
#### blue zone #### | |||
${ASCEND_DIR}/driver/include | |||
${ASCEND_DIR}/fwkacllib/include | |||
${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain | |||
) | |||
target_link_libraries(ge_compiler | |||
$<BUILD_INTERFACE:intf_pub> | |||
ge_memory | |||
-Wl,--no-as-needed | |||
graph | |||
ge_common | |||
protobuf | |||
register | |||
c_sec | |||
error_manager | |||
slog | |||
mmpa | |||
runtime_compile | |||
resource | |||
-Wl,--as-needed | |||
json | |||
-lrt | |||
-ldl | |||
) | |||
############ libascendcl.so ############ | |||
file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/dummy.c CONTENT "") | |||
#add_library(dummy_obj OBJECT ${CMAKE_BINARY_DIR}/dummy.c) | |||
#set(DUMMY_OBJ $<TARGET_OBJECTS:dummy_obj>) | |||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ascendcl_object) | |||
if(EXISTS ${STATIC_ACL_LIB}/libascendcl.a) | |||
execute_process( | |||
COMMAND ar x ${STATIC_ACL_LIB}/libascendcl.a | |||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ascendcl_object | |||
) | |||
file(GLOB OBJECT_LIST ${CMAKE_CURRENT_BINARY_DIR}/ascendcl_object/*.o) | |||
else() | |||
set(OBJECT_LIST ${CMAKE_BINARY_DIR}/dummy.c) | |||
endif() | |||
add_library(opensrc_ascendcl SHARED | |||
${OBJECT_LIST} | |||
) | |||
target_compile_options(opensrc_ascendcl PRIVATE | |||
-O2 | |||
-fvisibility=hidden | |||
) | |||
target_link_options(opensrc_ascendcl PRIVATE | |||
-rdynamic | |||
-Wl,--allow-multiple-definition | |||
-Wl,-z,muldefs | |||
-Wl,-Bsymbolic | |||
-Wl,--exclude-libs,ALL | |||
) | |||
target_link_libraries(opensrc_ascendcl PRIVATE | |||
-Wl,--whole-archive | |||
ge_executor | |||
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 | |||
-ldl | |||
json | |||
) | |||
set_target_properties(opensrc_ascendcl PROPERTIES | |||
OUTPUT_NAME ascendcl | |||
) | |||
################################################################## | |||
add_custom_command( | |||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/stub_ge_ir_build.cc | |||
${CMAKE_CURRENT_BINARY_DIR}/stub_ge_api.cc | |||
${CMAKE_CURRENT_BINARY_DIR}/stub_ge_prof.cc | |||
COMMAND echo "Generating stub files." | |||
&& ${HI_PYTHON} ${CMAKE_CURRENT_LIST_DIR}/stub/gen_stubapi.py ${GE_CODE_DIR}/inc/external ${CMAKE_CURRENT_BINARY_DIR} | |||
&& mv ge_ir_build.cc stub_ge_ir_build.cc | |||
&& mv ge_api.cc stub_ge_api.cc | |||
&& mv ge_prof.cc stub_ge_prof.cc | |||
&& echo "Generating stub files end." | |||
#WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} | |||
#DEPENDS stub/gen_stubapi.py ${TOP_DIR}/inc/external ${CMAKE_CURRENT_BINARY_DIR} | |||
) | |||
add_custom_target(ge_stub | |||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/stub_ge_ir_build.cc | |||
${CMAKE_CURRENT_BINARY_DIR}/stub_ge_api.cc | |||
${CMAKE_CURRENT_BINARY_DIR}/stub_ge_prof.cc | |||
) | |||
################################################################## | |||
############ stub/libge_compiler.so ############ | |||
add_library(atc_stub_ge_compiler SHARED | |||
stub_ge_ir_build.cc | |||
) | |||
add_dependencies(atc_stub_ge_compiler ge_stub) | |||
target_link_libraries(atc_stub_ge_compiler PRIVATE | |||
$<BUILD_INTERFACE:intf_pub> | |||
) | |||
set_target_properties(atc_stub_ge_compiler PROPERTIES | |||
OUTPUT_NAME ge_compiler | |||
LIBRARY_OUTPUT_DIRECTORY atc_stub | |||
) | |||
target_include_directories(atc_stub_ge_compiler PRIVATE | |||
${GE_CODE_DIR} | |||
${GE_CODE_DIR}/ge | |||
${GE_CODE_DIR}/ge/analyzer | |||
${GE_CODE_DIR}/inc | |||
${GE_CODE_DIR}/inc/framework | |||
${GE_CODE_DIR}/inc/framework/common | |||
${GE_CODE_DIR}/inc/external | |||
${METADEF_DIR}/inc/external | |||
${METADEF_DIR}/inc/external/graph | |||
${METADEF_DIR}/inc/graph | |||
#### yellow zone #### | |||
${GE_CODE_DIR}/../inc/cce | |||
${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external | |||
#### blue zone #### | |||
${ASCEND_DIR}/driver/include | |||
${ASCEND_DIR}/fwkacllib/include | |||
) | |||
############ stub/libge_runner.so ############ | |||
add_library(fwk_stub_ge_runner SHARED | |||
stub_ge_api.cc | |||
stub_ge_prof.cc | |||
) | |||
add_dependencies(fwk_stub_ge_runner ge_stub) | |||
target_link_libraries(fwk_stub_ge_runner PRIVATE | |||
$<BUILD_INTERFACE:intf_pub> | |||
) | |||
set_target_properties(fwk_stub_ge_runner PROPERTIES | |||
OUTPUT_NAME ge_runner | |||
LIBRARY_OUTPUT_DIRECTORY fwk_stub | |||
) | |||
target_include_directories(fwk_stub_ge_runner PRIVATE | |||
${GE_CODE_DIR} | |||
${GE_CODE_DIR}/ge | |||
${GE_CODE_DIR}/ge/analyzer | |||
${GE_CODE_DIR}/inc | |||
${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 #### | |||
${GE_CODE_DIR}/../inc/cce | |||
${GE_CODE_DIR}/../toolchain/ide/ide-daemon/external | |||
#### blue zone #### | |||
${ASCEND_DIR}/driver/include | |||
${ASCEND_DIR}/fwkacllib/include | |||
) | |||
############################################################### | |||
add_custom_target( | |||
engine_conf.json ALL | |||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/engine_conf.json | |||
) | |||
add_custom_command( | |||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/engine_conf.json | |||
COMMAND cp ${CMAKE_CURRENT_LIST_DIR}/engine_manager/engine_conf.json ${CMAKE_CURRENT_BINARY_DIR}/ | |||
) | |||
############################################################### | |||
add_custom_target( | |||
optimizer_priority.pbtxt ALL | |||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/optimizer_priority.pbtxt | |||
) | |||
add_custom_command( | |||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/optimizer_priority.pbtxt | |||
COMMAND cp ${CMAKE_CURRENT_LIST_DIR}/opskernel_manager/optimizer_priority.pbtxt ${CMAKE_CURRENT_BINARY_DIR}/ | |||
) | |||
############################################################### | |||
############ install ############ | |||
set(INSTALL_BASE_DIR "") | |||
set(INSTALL_LIBRARY_DIR lib) | |||
install(TARGETS ge_runner ge_compiler opensrc_ascendcl OPTIONAL | |||
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} | |||
) | |||
install(TARGETS atc_stub_ge_compiler fwk_stub_ge_runner OPTIONAL | |||
LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}/stub | |||
) | |||
install(FILES | |||
${CMAKE_CURRENT_BINARY_DIR}/engine_conf.json | |||
${CMAKE_CURRENT_BINARY_DIR}/optimizer_priority.pbtxt OPTIONAL | |||
DESTINATION ${INSTALL_LIBRARY_DIR} | |||
) |
@@ -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} | |||
) |