@@ -1,6 +1,21 @@ | |||||
cmake_minimum_required(VERSION 3.14) | cmake_minimum_required(VERSION 3.14) | ||||
project (Parser[CXX]) | project (Parser[CXX]) | ||||
include(CMakePrintHelpers) | |||||
message(STATUS "Variables in parser project :") | |||||
cmake_print_variables(ASCEND_OPENSDK_DIR) | |||||
cmake_print_variables(CMAKE_BUILD_TYPE) | |||||
cmake_print_variables(CMAKE_INSTALL_PREFIX) | |||||
cmake_print_variables(CMAKE_PREFIX_PATH) | |||||
cmake_print_variables(CMAKE_MODULE_PATH) | |||||
cmake_print_variables(protoc_ROOT) | |||||
cmake_print_variables(protobuf_grpc_ROOT) | |||||
cmake_print_variables(protobuf_static_ROOT) | |||||
cmake_print_variables(ascend_protobuf_shared_ROOT) | |||||
cmake_print_variables(ascend_protobuf_static_ROOT) | |||||
cmake_print_variables(ENABLE_OPEN_SRC ENABLE_GITEE ENABLE_PARSER_UT ENABLE_PARSER_ST ENABLE_PARSER_COV) | |||||
cmake_print_variables(BUILD_METADEF METADEF_DIR) | |||||
set(INSTALL_BASE_DIR "") | set(INSTALL_BASE_DIR "") | ||||
set(INSTALL_LIBRARY_DIR lib) | set(INSTALL_LIBRARY_DIR lib) | ||||
set(INSTALL_RUNTIME_DIR bin) | set(INSTALL_RUNTIME_DIR bin) | ||||
@@ -9,68 +24,51 @@ set(INSTALL_CONFIG_DIR cmake) | |||||
include(CMakePackageConfigHelpers) | include(CMakePackageConfigHelpers) | ||||
set(PARSER_DIR ${CMAKE_CURRENT_LIST_DIR}) | set(PARSER_DIR ${CMAKE_CURRENT_LIST_DIR}) | ||||
if (DEFINED ENV{D_PKG_SERVER}) | |||||
set(PARSER_PB_PKG $ENV{D_PKG_SERVER}) | |||||
elseif (DEFINED ENV{MSLIBS_SERVER}) | |||||
set(PARSER_PB_PKG "http://$ENV{MSLIBS_SERVER}:8081") | |||||
message("Download packages from MSPKG server") | |||||
endif () | |||||
option(ENABLE_OPEN_SRC "Enable graphengine compile in opensource." FALSE) | option(ENABLE_OPEN_SRC "Enable graphengine compile in opensource." FALSE) | ||||
if (ENABLE_OPEN_SRC) | if (ENABLE_OPEN_SRC) | ||||
set(HI_PYTHON python3) | set(HI_PYTHON python3) | ||||
include(cmake/external_libs/protobuf_shared.cmake) | |||||
include(cmake/external_libs/protoc.cmake) | |||||
include(cmake/external_libs/securec.cmake) | |||||
include(cmake/external_libs/json.cmake) | |||||
include(cmake/FindModule.cmake) | |||||
include(cmake/intf_pub_linux.cmake) | |||||
# 开源软件包 | |||||
find_package(json MODULE) | |||||
find_package(protoc MODULE) | |||||
find_package(ascend_protobuf_shared MODULE) | |||||
find_package(ascend_protobuf_static MODULE) | |||||
find_package(GTest CONFIG REQUIRED) | |||||
# 自研软件包 | |||||
find_package(securec MODULE REQUIRED) | |||||
find_package(slog CONFIG REQUIRED) | |||||
find_package(mmpa CONFIG REQUIRED) | |||||
find_package(runtime CONFIG REQUIRED) | |||||
find_package(msprof CONFIG REQUIRED) | |||||
find_package(cce CONFIG REQUIRED) | |||||
if (BUILD_WITHOUT_AIR) | |||||
find_package(air CONFIG REQUIRED) | |||||
endif() | |||||
if (NOT BUILD_METADEF) | |||||
find_package(metadef CONFIG REQUIRED) | |||||
endif() | |||||
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") | |||||
if (BUILD_METADEF) | |||||
# 使用medadef源码编译 | |||||
if (BUILD_WITHOUT_AIR) | |||||
# parser集成metadef源码 | |||||
set(METADEF_DIR ${CMAKE_CURRENT_LIST_DIR}/metadef) | |||||
else () | |||||
# air已经集成metadef源码,parser直接使用 | |||||
message(STATUS "METADEF_DIR = ${METADEF_DIR}") | |||||
endif() | endif() | ||||
set(GE_LIB_PATH ${GE_LIB_PATH}/${GE_SYS_ARCH}) | |||||
find_module(slog libascendalog.so ${GE_LIB_PATH}) | |||||
find_module(static_mmpa libmmpa.a ${GE_LIB_PATH}) | |||||
elseif(ENABLE_GE_COV OR ENABLE_GE_UT) | |||||
message(STATUS "Runing on llt mode, no need to depend other component") | |||||
elseif(ENABLE_PARSER_UT OR ENABLE_PARSER_COV OR ENABLE_PARSER_ST) | |||||
include(cmake/external_libs/gtest.cmake) | |||||
add_subdirectory(tests) | |||||
else() | |||||
if(DEFINED ENV{ASCEND_CUSTOM_PATH}) | |||||
set(ASCEND_DIR $ENV{ASCEND_CUSTOM_PATH}) | |||||
else() | |||||
set(ASCEND_DIR /usr/local/Ascend) | |||||
endif() | |||||
set(ASCEND_COMPILER_DIR ${ASCEND_DIR}/compiler/lib64) | |||||
find_module(slog libascendalog.so ${ASCEND_COMPILER_DIR}) | |||||
find_module(static_mmpa libmmpa.a ${ASCEND_COMPILER_DIR}) | |||||
else () | |||||
# 使用medadef发布包编译 | |||||
set(METADEF_DIR ${ASCEND_OPENSDK_DIR}) | |||||
endif() | endif() | ||||
if (NOT DEFINED METADEF_DIR) | |||||
set(METADEF_DIR ${CMAKE_CURRENT_LIST_DIR}/metadef) | |||||
add_subdirectory(metadef) | |||||
endif() | |||||
include(cmake/intf_pub_linux.cmake) | |||||
include(cmake/function.cmake) | |||||
else() | else() | ||||
####工程tigong | |||||
set(METADEF_DIR ${CMAKE_CURRENT_LIST_DIR}/../metadef) | |||||
# 使用全量源码构建框架集成的metadef源码 | |||||
set(METADEF_DIR ${TOP_DIR}/metadef) | |||||
endif() | endif() | ||||
set(PARSER_PROTO_LIST | set(PARSER_PROTO_LIST | ||||
@@ -131,16 +129,10 @@ set(PARSER_CAFFE_PROTO_SRC | |||||
add_library(parser_graph_library_proto_obj OBJECT ${PARSER_GRAPH_LIBRARY_PROTO_SRC}) | add_library(parser_graph_library_proto_obj OBJECT ${PARSER_GRAPH_LIBRARY_PROTO_SRC}) | ||||
add_dependencies(parser_graph_library_proto_obj parser_protos) | add_dependencies(parser_graph_library_proto_obj parser_protos) | ||||
target_include_directories(parser_graph_library_proto_obj PRIVATE | |||||
#### blue zone #### | |||||
${PROTOBUF_SHARED_PKG_DIR}/include | |||||
#### yellow zone #### | |||||
${ASCEND_PROTOBUF_SHARED_PKG_DIR}/include | |||||
) | |||||
target_compile_definitions(parser_graph_library_proto_obj PRIVATE | target_compile_definitions(parser_graph_library_proto_obj PRIVATE | ||||
google=ascend_private | google=ascend_private | ||||
) | ) | ||||
target_link_libraries(parser_graph_library_proto_obj PRIVATE ascend_protobuf $<BUILD_INTERFACE:intf_pub>) | |||||
target_link_libraries(parser_graph_library_proto_obj PRIVATE ascend_protobuf intf_pub) | |||||
target_compile_options(parser_graph_library_proto_obj PRIVATE | target_compile_options(parser_graph_library_proto_obj PRIVATE | ||||
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>:-O2 -fPIC -Wextra -Wfloat-equal> | $<$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>:-O2 -fPIC -Wextra -Wfloat-equal> | ||||
$<$<OR:$<STREQUAL:${PRODUCT_SIDE},host>,$<STREQUAL:${ENABLE_OPEN_SRC},True>>:-fexceptions> | $<$<OR:$<STREQUAL:${PRODUCT_SIDE},host>,$<STREQUAL:${ENABLE_OPEN_SRC},True>>:-fexceptions> | ||||
@@ -152,16 +144,10 @@ target_compile_options(parser_graph_library_proto_obj PRIVATE | |||||
add_library(parser_tensorflow_protos_obj OBJECT ${PARSER_TENSORFLOW_PROTO_SRCS}) | add_library(parser_tensorflow_protos_obj OBJECT ${PARSER_TENSORFLOW_PROTO_SRCS}) | ||||
add_dependencies(parser_tensorflow_protos_obj parser_protos) | add_dependencies(parser_tensorflow_protos_obj parser_protos) | ||||
target_include_directories(parser_tensorflow_protos_obj PRIVATE | |||||
#### blue zone #### | |||||
${PROTOBUF_SHARED_PKG_DIR}/include | |||||
#### yellow zone #### | |||||
${ASCEND_PROTOBUF_SHARED_PKG_DIR}/include | |||||
) | |||||
target_compile_definitions(parser_tensorflow_protos_obj PRIVATE | target_compile_definitions(parser_tensorflow_protos_obj PRIVATE | ||||
google=ascend_private | google=ascend_private | ||||
) | ) | ||||
target_link_libraries(parser_tensorflow_protos_obj PRIVATE ascend_protobuf $<BUILD_INTERFACE:intf_pub>) | |||||
target_link_libraries(parser_tensorflow_protos_obj PRIVATE ascend_protobuf intf_pub) | |||||
target_compile_options(parser_tensorflow_protos_obj PRIVATE | target_compile_options(parser_tensorflow_protos_obj PRIVATE | ||||
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>:-O2 -fPIC -Wextra -Wfloat-equal> | $<$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>:-O2 -fPIC -Wextra -Wfloat-equal> | ||||
$<$<OR:$<STREQUAL:${PRODUCT_SIDE},host>,$<STREQUAL:${ENABLE_OPEN_SRC},True>>:-fexceptions> | $<$<OR:$<STREQUAL:${PRODUCT_SIDE},host>,$<STREQUAL:${ENABLE_OPEN_SRC},True>>:-fexceptions> | ||||
@@ -173,16 +159,10 @@ target_compile_options(parser_tensorflow_protos_obj PRIVATE | |||||
add_library(parser_onnx_protos_obj OBJECT ${PARSER_ONNX_PROTO_SRCS}) | add_library(parser_onnx_protos_obj OBJECT ${PARSER_ONNX_PROTO_SRCS}) | ||||
add_dependencies(parser_onnx_protos_obj parser_protos) | add_dependencies(parser_onnx_protos_obj parser_protos) | ||||
target_include_directories(parser_onnx_protos_obj PRIVATE | |||||
#### blue zone #### | |||||
${PROTOBUF_SHARED_PKG_DIR}/include | |||||
#### yellow zone #### | |||||
${ASCEND_PROTOBUF_SHARED_PKG_DIR}/include | |||||
) | |||||
target_compile_definitions(parser_onnx_protos_obj PRIVATE | target_compile_definitions(parser_onnx_protos_obj PRIVATE | ||||
google=ascend_private | google=ascend_private | ||||
) | ) | ||||
target_link_libraries(parser_onnx_protos_obj PRIVATE ascend_protobuf $<BUILD_INTERFACE:intf_pub>) | |||||
target_link_libraries(parser_onnx_protos_obj PRIVATE ascend_protobuf intf_pub) | |||||
target_compile_options(parser_onnx_protos_obj PRIVATE | target_compile_options(parser_onnx_protos_obj PRIVATE | ||||
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>:-O2 -fPIC -Wextra -Wfloat-equal> | $<$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>:-O2 -fPIC -Wextra -Wfloat-equal> | ||||
$<$<OR:$<STREQUAL:${PRODUCT_SIDE},host>,$<STREQUAL:${ENABLE_OPEN_SRC},True>>:-fexceptions> | $<$<OR:$<STREQUAL:${PRODUCT_SIDE},host>,$<STREQUAL:${ENABLE_OPEN_SRC},True>>:-fexceptions> | ||||
@@ -194,16 +174,10 @@ target_compile_options(parser_onnx_protos_obj PRIVATE | |||||
add_library(parser_caffe_proto_obj OBJECT ${PARSER_CAFFE_PROTO_SRC}) | add_library(parser_caffe_proto_obj OBJECT ${PARSER_CAFFE_PROTO_SRC}) | ||||
add_dependencies(parser_caffe_proto_obj parser_protos) | add_dependencies(parser_caffe_proto_obj parser_protos) | ||||
target_include_directories(parser_caffe_proto_obj PRIVATE | |||||
#### blue zone #### | |||||
${PROTOBUF_SHARED_PKG_DIR}/include | |||||
#### yellow zone #### | |||||
${ASCEND_PROTOBUF_SHARED_PKG_DIR}/include | |||||
) | |||||
target_compile_definitions(parser_caffe_proto_obj PRIVATE | target_compile_definitions(parser_caffe_proto_obj PRIVATE | ||||
google=ascend_private | google=ascend_private | ||||
) | ) | ||||
target_link_libraries(parser_caffe_proto_obj PRIVATE ascend_protobuf $<BUILD_INTERFACE:intf_pub>) | |||||
target_link_libraries(parser_caffe_proto_obj PRIVATE ascend_protobuf intf_pub) | |||||
target_compile_options(parser_caffe_proto_obj PRIVATE | target_compile_options(parser_caffe_proto_obj PRIVATE | ||||
$<$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>:-O2 -fPIC -Wextra -Wfloat-equal> | $<$<STREQUAL:${TARGET_SYSTEM_NAME},Linux>:-O2 -fPIC -Wextra -Wfloat-equal> | ||||
$<$<OR:$<STREQUAL:${PRODUCT_SIDE},host>,$<STREQUAL:${ENABLE_OPEN_SRC},True>>:-fexceptions> | $<$<OR:$<STREQUAL:${PRODUCT_SIDE},host>,$<STREQUAL:${ENABLE_OPEN_SRC},True>>:-fexceptions> | ||||
@@ -243,6 +217,12 @@ add_subdirectory(parser) | |||||
add_subdirectory(parser/common) | add_subdirectory(parser/common) | ||||
add_subdirectory(parser/func_to_graph) | add_subdirectory(parser/func_to_graph) | ||||
add_subdirectory(parser/onnx) | add_subdirectory(parser/onnx) | ||||
if (BUILD_METADEF AND BUILD_WITHOUT_AIR) | |||||
add_subdirectory(metadef) | |||||
endif() | |||||
if(ENABLE_PARSER_UT OR ENABLE_PARSER_COV OR ENABLE_PARSER_ST) | |||||
add_subdirectory(tests) | |||||
endif() | |||||
install(TARGETS _caffe_parser parser_common fmk_onnx_parser fmk_parser parser_headers | install(TARGETS _caffe_parser parser_common fmk_onnx_parser fmk_parser parser_headers | ||||
EXPORT parser-targets | EXPORT parser-targets | ||||
@@ -255,7 +235,16 @@ install(FILES ${PARSER_DIR}/inc/external/parser/onnx_parser.h | |||||
${PARSER_DIR}/inc/external/parser/tensorflow_parser.h | ${PARSER_DIR}/inc/external/parser/tensorflow_parser.h | ||||
DESTINATION ${INSTALL_INCLUDE_DIR}/parser/external/parser COMPONENT opensdk EXCLUDE_FROM_ALL | DESTINATION ${INSTALL_INCLUDE_DIR}/parser/external/parser COMPONENT opensdk EXCLUDE_FROM_ALL | ||||
) | ) | ||||
# 下列头文件发布是非法的,需要在后续整改中删掉 | |||||
# --------------------start------------------------ | |||||
install(FILES ${PARSER_DIR}/parser/common/pre_checker.h | |||||
${PARSER_DIR}/parser/common/register_tbe.h | |||||
DESTINATION ${INSTALL_INCLUDE_DIR}/parser/parser/common COMPONENT opensdk EXCLUDE_FROM_ALL | |||||
) | |||||
install(FILES ${PARSER_DIR}/parser/common/convert/pb2json.h | |||||
DESTINATION ${INSTALL_INCLUDE_DIR}/parser/parser/common/convert COMPONENT opensdk EXCLUDE_FROM_ALL | |||||
) | |||||
# ---------------------end------------------------- | |||||
if (PACKAGE STREQUAL "opensdk") | if (PACKAGE STREQUAL "opensdk") | ||||
install(EXPORT parser-targets DESTINATION ${INSTALL_CONFIG_DIR} | install(EXPORT parser-targets DESTINATION ${INSTALL_CONFIG_DIR} | ||||
FILE parser-targets.cmake COMPONENT opensdk EXCLUDE_FROM_ALL | FILE parser-targets.cmake COMPONENT opensdk EXCLUDE_FROM_ALL | ||||
@@ -15,9 +15,30 @@ | |||||
# ============================================================================ | # ============================================================================ | ||||
set -e | set -e | ||||
echo "ASCEND_CUSTOM_PATH=${ASCEND_CUSTOM_PATH}" | |||||
echo "BUILD_METADEF=${BUILD_METADEF}" | |||||
if [ ! ${BUILD_METADEF} ] ; then | |||||
BUILD_METADEF=OFF | |||||
fi | |||||
BASEPATH=$(cd "$(dirname $0)"; pwd) | BASEPATH=$(cd "$(dirname $0)"; pwd) | ||||
OUTPUT_PATH="${BASEPATH}/output" | OUTPUT_PATH="${BASEPATH}/output" | ||||
export BUILD_PATH="${BASEPATH}/build/" | |||||
BUILD_PATH="${BASEPATH}/build/" | |||||
ASCEND_OPENSDK_DIR=${ASCEND_CUSTOM_PATH}/opensdk/opensdk | |||||
PREFIX_PATH="${ASCEND_OPENSDK_DIR}/cmake;\ | |||||
${ASCEND_OPENSDK_DIR}/c_sec;\ | |||||
${ASCEND_OPENSDK_DIR}/json;\ | |||||
${ASCEND_OPENSDK_DIR}/openssl;\ | |||||
${ASCEND_OPENSDK_DIR}/zlib;\ | |||||
${ASCEND_OPENSDK_DIR}/protoc;\ | |||||
${ASCEND_OPENSDK_DIR}/protoc_grpc;\ | |||||
${ASCEND_OPENSDK_DIR}/grpc;\ | |||||
${ASCEND_OPENSDK_DIR}/protobuf_static;\ | |||||
${ASCEND_OPENSDK_DIR}/ascend_protobuf;\ | |||||
${ASCEND_OPENSDK_DIR}/ascend_protobuf_static;\ | |||||
${ASCEND_OPENSDK_DIR}/gtest_shared/lib/cmake/GTest;\ | |||||
${ASCEND_OPENSDK_DIR}/gtest_shared/lib64/cmake/GTest" | |||||
# print usage message | # print usage message | ||||
usage() | usage() | ||||
@@ -53,11 +74,9 @@ checkopts() | |||||
{ | { | ||||
VERBOSE="" | VERBOSE="" | ||||
THREAD_NUM=8 | THREAD_NUM=8 | ||||
# ENABLE_PARSER_UT_ONLY_COMPILE="off" | |||||
ENABLE_PARSER_UT="off" | ENABLE_PARSER_UT="off" | ||||
ENABLE_PARSER_ST="off" | ENABLE_PARSER_ST="off" | ||||
ENABLE_PARSER_COV="off" | ENABLE_PARSER_COV="off" | ||||
GE_ONLY="on" | |||||
ENABLE_GITEE="off" | ENABLE_GITEE="off" | ||||
# Process the options | # Process the options | ||||
while getopts 'ustchj:vS:' opt | while getopts 'ustchj:vS:' opt | ||||
@@ -66,18 +85,15 @@ checkopts() | |||||
case "${opt}" in | case "${opt}" in | ||||
u) | u) | ||||
ENABLE_PARSER_UT="on" | ENABLE_PARSER_UT="on" | ||||
GE_ONLY="off" | |||||
;; | ;; | ||||
s) | s) | ||||
ENABLE_PARSER_ST="on" | ENABLE_PARSER_ST="on" | ||||
;; | ;; | ||||
t) | t) | ||||
ENABLE_PARSER_UT="on" | ENABLE_PARSER_UT="on" | ||||
GE_ONLY="off" | |||||
;; | ;; | ||||
c) | c) | ||||
ENABLE_PARSER_COV="on" | ENABLE_PARSER_COV="on" | ||||
GE_ONLY="off" | |||||
;; | ;; | ||||
h) | h) | ||||
usage | usage | ||||
@@ -103,7 +119,7 @@ checkopts() | |||||
} | } | ||||
checkopts "$@" | checkopts "$@" | ||||
git submodule update --init metadef | |||||
#git submodule update --init metadef | |||||
mk_dir() { | mk_dir() { | ||||
local create_dir="$1" # the target to make | local create_dir="$1" # the target to make | ||||
@@ -121,31 +137,27 @@ build_parser() | |||||
echo "create build directory and build Parser"; | echo "create build directory and build Parser"; | ||||
mk_dir "${BUILD_PATH}" | mk_dir "${BUILD_PATH}" | ||||
cd "${BUILD_PATH}" | cd "${BUILD_PATH}" | ||||
CMAKE_ARGS="-DBUILD_PATH=$BUILD_PATH -DGE_ONLY=$GE_ONLY" | |||||
if [[ "X$ENABLE_PARSER_COV" = "Xon" ]]; then | |||||
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_PARSER_COV=ON" | |||||
fi | |||||
if [[ "X$ENABLE_PARSER_UT" = "Xon" ]]; then | |||||
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_PARSER_UT=ON" | |||||
fi | |||||
if [[ "X$ENABLE_PARSER_ST" = "Xon" ]]; then | |||||
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_PARSER_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}" | |||||
echo "${CMAKE_ARGS}" | |||||
cmake ${CMAKE_ARGS} .. | |||||
cmake -D ENABLE_OPEN_SRC=True \ | |||||
-D ENABLE_PARSER_COV=${ENABLE_PARSER_COV} \ | |||||
-D ENABLE_PARSER_UT=${ENABLE_PARSER_UT} \ | |||||
-D ENABLE_PARSER_ST=${ENABLE_PARSER_ST} \ | |||||
-D ENABLE_GITEE=${ENABLE_GITEE} \ | |||||
-D BUILD_METADEF=${BUILD_METADEF} \ | |||||
-D BUILD_WITHOUT_AIR=True \ | |||||
-D ASCEND_OPENSDK_DIR=${ASCEND_OPENSDK_DIR} \ | |||||
-D CMAKE_BUILD_TYPE=Release \ | |||||
-D CMAKE_INSTALL_PREFIX=${OUTPUT_PATH} \ | |||||
-D CMAKE_MODULE_PATH=${ASCEND_OPENSDK_DIR}/cmake/modules \ | |||||
-D CMAKE_PREFIX_PATH=${PREFIX_PATH} \ | |||||
-D protoc_ROOT=${ASCEND_OPENSDK_DIR}/protoc \ | |||||
-D protobuf_grpc_ROOT=${ASCEND_OPENSDK_DIR}/grpc \ | |||||
-D protobuf_static_ROOT=${ASCEND_OPENSDK_DIR}/protobuf_static \ | |||||
-D ascend_protobuf_shared_ROOT=${ASCEND_OPENSDK_DIR}/ascend_protobuf \ | |||||
-D ascend_protobuf_static_ROOT=${ASCEND_OPENSDK_DIR}/ascend_protobuf_static \ | |||||
.. | |||||
if [ 0 -ne $? ] | if [ 0 -ne $? ] | ||||
then | then | ||||
echo "execute command: cmake ${CMAKE_ARGS} .. failed." | |||||
echo "execute command: cmake .. failed." | |||||
return 1 | return 1 | ||||
fi | fi | ||||
@@ -168,14 +180,6 @@ g++ -v | |||||
mk_dir ${OUTPUT_PATH} | mk_dir ${OUTPUT_PATH} | ||||
build_parser || { echo "Parser build failed."; return; } | build_parser || { echo "Parser build failed."; return; } | ||||
echo "---------------- Parser build finished ----------------" | echo "---------------- Parser build finished ----------------" | ||||
rm -f ${OUTPUT_PATH}/libgmock*.so | |||||
rm -f ${OUTPUT_PATH}/libgtest*.so | |||||
rm -f ${OUTPUT_PATH}/lib*_stub.so | |||||
chmod -R 750 ${OUTPUT_PATH} | |||||
find ${OUTPUT_PATH} -name "*.so*" -print0 | xargs -0 chmod 500 | |||||
echo "---------------- Parser output generated ----------------" | |||||
if [[ "X$ENABLE_PARSER_UT" = "Xon" || "X$ENABLE_PARSER_COV" = "Xon" ]]; then | if [[ "X$ENABLE_PARSER_UT" = "Xon" || "X$ENABLE_PARSER_COV" = "Xon" ]]; then | ||||
cp ${BUILD_PATH}/tests/ut/parser/ut_parser ${OUTPUT_PATH} | cp ${BUILD_PATH}/tests/ut/parser/ut_parser ${OUTPUT_PATH} | ||||
@@ -0,0 +1,108 @@ | |||||
function(protobuf_generate comp c_var h_var) | |||||
if(NOT ARGN) | |||||
message(SEND_ERROR "Error: protobuf_generate() called without any proto files") | |||||
return() | |||||
endif() | |||||
set(${c_var}) | |||||
set(${h_var}) | |||||
set(_add_target FALSE) | |||||
set(extra_option "") | |||||
foreach(arg ${ARGN}) | |||||
if("${arg}" MATCHES "--proto_path") | |||||
set(extra_option ${arg}) | |||||
endif() | |||||
endforeach() | |||||
foreach(file ${ARGN}) | |||||
if("${file}" MATCHES "--proto_path") | |||||
continue() | |||||
endif() | |||||
if("${file}" STREQUAL "TARGET") | |||||
set(_add_target TRUE) | |||||
continue() | |||||
endif() | |||||
get_filename_component(abs_file ${file} ABSOLUTE) | |||||
get_filename_component(file_name ${file} NAME_WE) | |||||
get_filename_component(file_dir ${abs_file} PATH) | |||||
get_filename_component(parent_subdir ${file_dir} NAME) | |||||
if("${parent_subdir}" STREQUAL "proto") | |||||
set(proto_output_path ${CMAKE_BINARY_DIR}/proto/${comp}/proto) | |||||
else() | |||||
set(proto_output_path ${CMAKE_BINARY_DIR}/proto/${comp}/proto/${parent_subdir}) | |||||
endif() | |||||
list(APPEND ${c_var} "${proto_output_path}/${file_name}.pb.cc") | |||||
list(APPEND ${h_var} "${proto_output_path}/${file_name}.pb.h") | |||||
add_custom_command( | |||||
OUTPUT "${proto_output_path}/${file_name}.pb.cc" "${proto_output_path}/${file_name}.pb.h" | |||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} | |||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${proto_output_path}" | |||||
COMMAND ${CMAKE_COMMAND} -E echo "generate proto cpp_out ${comp} by ${abs_file}" | |||||
COMMAND ${PROTOC_PROGRAM} -I${file_dir} ${extra_option} --cpp_out=${proto_output_path} ${abs_file} | |||||
DEPENDS ${abs_file} | |||||
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM ) | |||||
endforeach() | |||||
if(_add_target) | |||||
add_custom_target( | |||||
${comp} DEPENDS ${${c_var}} ${${h_var}} | |||||
) | |||||
endif() | |||||
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() | |||||
function(protobuf_generate_py comp py_var) | |||||
if(NOT ARGN) | |||||
message(SEND_ERROR "Error: protobuf_generate_py() called without any proto files") | |||||
return() | |||||
endif() | |||||
set(${py_var}) | |||||
set(_add_target FALSE) | |||||
foreach(file ${ARGN}) | |||||
if("${file}" STREQUAL "TARGET") | |||||
set(_add_target TRUE) | |||||
continue() | |||||
endif() | |||||
get_filename_component(abs_file ${file} ABSOLUTE) | |||||
get_filename_component(file_name ${file} NAME_WE) | |||||
get_filename_component(file_dir ${abs_file} PATH) | |||||
get_filename_component(parent_subdir ${file_dir} NAME) | |||||
if("${parent_subdir}" STREQUAL "proto") | |||||
set(proto_output_path ${CMAKE_BINARY_DIR}/proto/${comp}/proto) | |||||
else() | |||||
set(proto_output_path ${CMAKE_BINARY_DIR}/proto/${comp}/proto/${parent_subdir}) | |||||
endif() | |||||
list(APPEND ${py_var} "${proto_output_path}/${file_name}_pb2.py") | |||||
add_custom_command( | |||||
OUTPUT "${proto_output_path}/${file_name}_pb2.py" | |||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} | |||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${proto_output_path}" | |||||
COMMAND ${CMAKE_COMMAND} -E echo "generate proto python_out ${comp} by ${abs_file}" | |||||
COMMAND ${PROTOC_PROGRAM} -I${file_dir} --python_out=${proto_output_path} ${abs_file} | |||||
DEPENDS ${abs_file} | |||||
COMMENT "Running PYTHON protocol buffer compiler on ${file}" VERBATIM ) | |||||
endforeach() | |||||
if(_add_target) | |||||
add_custom_target( | |||||
${comp} DEPENDS ${${py_var}} | |||||
) | |||||
endif() | |||||
set_source_files_properties(${${py_var}} PROPERTIES GENERATED TRUE) | |||||
set(${py_var} ${${py_var}} PARENT_SCOPE) | |||||
endfunction() |
@@ -1,4 +1,5 @@ | |||||
if (HAVE_PUB) | |||||
include_guard(GLOBAL) | |||||
if (TARGET intf_pub) | |||||
return() | return() | ||||
endif() | endif() | ||||
@@ -30,5 +31,3 @@ target_link_libraries(intf_pub INTERFACE | |||||
-lpthread | -lpthread | ||||
) | ) | ||||
#set(HAVE_PUB TRUE CACHE BOOL "pub add") | |||||
set(HAVE_PUB TRUE) |
@@ -58,37 +58,11 @@ target_compile_definitions(fmk_parser PRIVATE | |||||
) | ) | ||||
target_include_directories(fmk_parser PRIVATE | target_include_directories(fmk_parser PRIVATE | ||||
${CMAKE_CURRENT_LIST_DIR} | |||||
${PARSER_DIR} | ${PARSER_DIR} | ||||
${PARSER_DIR}/inc | ${PARSER_DIR}/inc | ||||
${PARSER_DIR}/parser | ${PARSER_DIR}/parser | ||||
${METADEF_DIR}/inc | |||||
${METADEF_DIR}/inc/graph | |||||
${METADEF_DIR}/inc/register | |||||
${METADEF_DIR}/inc/external | |||||
${METADEF_DIR}/inc/external/graph | |||||
${METADEF_DIR}/inc/external/register | |||||
#### temp #### | |||||
${PARSER_DIR}/../graphengine/inc/common/util | |||||
${PARSER_DIR}/../graphengine/inc/external | |||||
${PARSER_DIR}/../graphengine/inc/framework | |||||
${PARSER_DIR}/../graphengine/inc | |||||
${PARSER_DIR}/../graphengine/ge | |||||
${CMAKE_BINARY_DIR} | ${CMAKE_BINARY_DIR} | ||||
${CMAKE_BINARY_DIR}/proto/parser_protos | ${CMAKE_BINARY_DIR}/proto/parser_protos | ||||
#### blue zone compile ##### | |||||
${PARSER_DIR}/../ge | |||||
${PARSER_DIR}/../inc | |||||
${PARSER_DIR}/../inc/framework | |||||
${PARSER_DIR}/../inc/common/util | |||||
${PARSER_DIR}/../inc/external | |||||
${PARSER_DIR}/../third_party/fwkacllib/inc | |||||
#### blue independent compile ##### | |||||
${METADEF_DIR}/third_party/graphengine/ge | |||||
${METADEF_DIR}/third_party/graphengine/inc | |||||
${METADEF_DIR}/third_party/graphengine/inc/framework | |||||
${METADEF_DIR}/third_party/graphengine/inc/external | |||||
${METADEF_DIR}/third_party/fwkacllib/inc | |||||
) | ) | ||||
target_link_options(fmk_parser PRIVATE | target_link_options(fmk_parser PRIVATE | ||||
@@ -98,6 +72,7 @@ target_link_options(fmk_parser PRIVATE | |||||
target_link_libraries(fmk_parser | target_link_libraries(fmk_parser | ||||
PRIVATE | PRIVATE | ||||
intf_pub | intf_pub | ||||
air_headers | |||||
json | json | ||||
PUBLIC | PUBLIC | ||||
static_mmpa | static_mmpa | ||||
@@ -125,8 +100,6 @@ add_custom_command( | |||||
&& mv tensorflow_parser.cc stub_tensorflow_parser.cc | && mv tensorflow_parser.cc stub_tensorflow_parser.cc | ||||
&& mv caffe_parser.cc stub_caffe_parser.cc | && mv caffe_parser.cc stub_caffe_parser.cc | ||||
&& echo "Generating stub files end." | && echo "Generating stub files end." | ||||
#WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} | |||||
#DEPENDS ../stub/gen_stubapi.py ${TOP_DIR}/inc/external ${CMAKE_CURRENT_BINARY_DIR} | |||||
) | ) | ||||
################################################################## | ################################################################## | ||||
@@ -153,29 +126,15 @@ target_compile_definitions(fmk_parser_stub PRIVATE | |||||
) | ) | ||||
target_include_directories(fmk_parser_stub PRIVATE | target_include_directories(fmk_parser_stub PRIVATE | ||||
${CMAKE_CURRENT_LIST_DIR} | |||||
${PARSER_DIR} | ${PARSER_DIR} | ||||
${PARSER_DIR}/inc | ${PARSER_DIR}/inc | ||||
${PARSER_DIR}/inc/external | ${PARSER_DIR}/inc/external | ||||
${PARSER_DIR}/parser | ${PARSER_DIR}/parser | ||||
${PARSER_DIR}/../inc | |||||
${PARSER_DIR}/../inc/common/util | |||||
${METADEF_DIR}/inc | |||||
${METADEF_DIR}/inc/graph | |||||
${METADEF_DIR}/inc/register | |||||
${METADEF_DIR}/inc/external | |||||
${METADEF_DIR}/inc/external/graph | |||||
${METADEF_DIR}/inc/external/register | |||||
#### temp #### | |||||
${PARSER_DIR}/../graphengine/inc/common/util | |||||
${PARSER_DIR}/../graphengine/inc/external | |||||
${PARSER_DIR}/../graphengine/inc/framework | |||||
${PARSER_DIR}/../graphengine/inc | |||||
${PARSER_DIR}/../graphengine/ge | |||||
) | ) | ||||
target_link_libraries(fmk_parser_stub PRIVATE | target_link_libraries(fmk_parser_stub PRIVATE | ||||
$<BUILD_INTERFACE:intf_pub> | |||||
intf_pub | |||||
metadef_headers | |||||
) | ) | ||||
set_target_properties(fmk_parser_stub PROPERTIES | set_target_properties(fmk_parser_stub PROPERTIES | ||||
@@ -48,37 +48,10 @@ target_compile_definitions(parser_common PRIVATE | |||||
) | ) | ||||
target_include_directories(parser_common PRIVATE | target_include_directories(parser_common PRIVATE | ||||
${CMAKE_CURRENT_LIST_DIR} | |||||
${PARSER_DIR} | ${PARSER_DIR} | ||||
${PARSER_DIR}/parser | ${PARSER_DIR}/parser | ||||
${METADEF_DIR} | |||||
${METADEF_DIR}/inc | |||||
${METADEF_DIR}/inc/graph | |||||
${METADEF_DIR}/inc/register | |||||
${METADEF_DIR}/inc/external | |||||
${METADEF_DIR}/inc/external/graph | |||||
${METADEF_DIR}/inc/external/register | |||||
#### temp #### | |||||
${PARSER_DIR}/../graphengine/inc/common/util | |||||
${PARSER_DIR}/../graphengine/inc/external | |||||
${PARSER_DIR}/../graphengine/inc/framework | |||||
${PARSER_DIR}/../graphengine/inc | |||||
${PARSER_DIR}/../graphengine/ge | |||||
${CMAKE_BINARY_DIR} | ${CMAKE_BINARY_DIR} | ||||
${CMAKE_BINARY_DIR}/proto/parser_protos | ${CMAKE_BINARY_DIR}/proto/parser_protos | ||||
#### blue zone compile ##### | |||||
${PARSER_DIR}/../ge | |||||
${PARSER_DIR}/../inc | |||||
${PARSER_DIR}/../inc/framework | |||||
${PARSER_DIR}/../inc/common/util | |||||
${PARSER_DIR}/../inc/external | |||||
${PARSER_DIR}/../third_party/fwkacllib/inc | |||||
#### independent compile ##### | |||||
${METADEF_DIR}/third_party/graphengine/ge | |||||
${METADEF_DIR}/third_party/graphengine/inc | |||||
${METADEF_DIR}/third_party/graphengine/inc/framework | |||||
${METADEF_DIR}/third_party/graphengine/inc/external | |||||
${METADEF_DIR}/third_party/fwkacllib/inc | |||||
) | ) | ||||
target_link_options(parser_common PRIVATE | target_link_options(parser_common PRIVATE | ||||
@@ -88,6 +61,7 @@ target_link_options(parser_common PRIVATE | |||||
target_link_libraries(parser_common | target_link_libraries(parser_common | ||||
PRIVATE | PRIVATE | ||||
intf_pub | intf_pub | ||||
air_headers | |||||
static_mmpa | static_mmpa | ||||
-Wl,--no-as-needed | -Wl,--no-as-needed | ||||
graph | graph | ||||
@@ -23,9 +23,6 @@ add_custom_target(util ALL | |||||
&& cp -r ${PROTO_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/util | && cp -r ${PROTO_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/util | ||||
) | ) | ||||
set(INSTALL_BASE_DIR "") | |||||
set(INSTALL_LIBRARY_DIR lib) | |||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/util OPTIONAL | install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/util OPTIONAL | ||||
DESTINATION ${INSTALL_LIBRARY_DIR}/func2graph | DESTINATION ${INSTALL_LIBRARY_DIR}/func2graph | ||||
) | ) | ||||
@@ -31,39 +31,13 @@ target_compile_definitions(fmk_onnx_parser PRIVATE | |||||
) | ) | ||||
target_include_directories(fmk_onnx_parser PRIVATE | target_include_directories(fmk_onnx_parser PRIVATE | ||||
${CMAKE_CURRENT_LIST_DIR} | |||||
${CMAKE_CURRENT_LIST_DIR}/subgraph_adapter | ${CMAKE_CURRENT_LIST_DIR}/subgraph_adapter | ||||
${PARSER_DIR} | ${PARSER_DIR} | ||||
${PARSER_DIR}/inc | ${PARSER_DIR}/inc | ||||
${PARSER_DIR}/parser | ${PARSER_DIR}/parser | ||||
${PARSER_DIR}/parser/inc | ${PARSER_DIR}/parser/inc | ||||
${METADEF_DIR}/inc | |||||
${METADEF_DIR}/inc/graph | |||||
${METADEF_DIR}/inc/register | |||||
${METADEF_DIR}/inc/external | |||||
${METADEF_DIR}/inc/external/graph | |||||
${METADEF_DIR}/inc/external/register | |||||
#### temp #### | |||||
${PARSER_DIR}/../graphengine/inc/common/util | |||||
${PARSER_DIR}/../graphengine/inc/external | |||||
${PARSER_DIR}/../graphengine/inc/framework | |||||
${PARSER_DIR}/../graphengine/inc | |||||
${PARSER_DIR}/../graphengine/ge | |||||
${CMAKE_BINARY_DIR} | ${CMAKE_BINARY_DIR} | ||||
${CMAKE_BINARY_DIR}/proto/parser_protos | ${CMAKE_BINARY_DIR}/proto/parser_protos | ||||
#### blue zone compile ##### | |||||
${PARSER_DIR}/../ge | |||||
${PARSER_DIR}/../inc | |||||
${PARSER_DIR}/../inc/common/util | |||||
${PARSER_DIR}/../inc/framework | |||||
${PARSER_DIR}/../inc/external | |||||
${PARSER_DIR}/../third_party/fwkacllib/inc | |||||
#### independent compile ##### | |||||
${METADEF_DIR}/third_party/graphengine/ge | |||||
${METADEF_DIR}/third_party/graphengine/inc | |||||
${METADEF_DIR}/third_party/graphengine/inc/framework | |||||
${METADEF_DIR}/third_party/graphengine/inc/external | |||||
${METADEF_DIR}/third_party/fwkacllib/inc | |||||
) | ) | ||||
target_link_options(fmk_onnx_parser PRIVATE | target_link_options(fmk_onnx_parser PRIVATE | ||||
@@ -73,6 +47,7 @@ target_link_options(fmk_onnx_parser PRIVATE | |||||
target_link_libraries(fmk_onnx_parser | target_link_libraries(fmk_onnx_parser | ||||
PRIVATE | PRIVATE | ||||
intf_pub | intf_pub | ||||
air_headers | |||||
static_mmpa | static_mmpa | ||||
-Wl,--no-as-needed | -Wl,--no-as-needed | ||||
ascend_protobuf | ascend_protobuf | ||||
@@ -97,8 +72,6 @@ add_custom_command( | |||||
&& ${HI_PYTHON} ${CMAKE_CURRENT_LIST_DIR}/../stub/gen_stubapi.py ${PARSER_DIR}/inc/external ${CMAKE_CURRENT_BINARY_DIR} | && ${HI_PYTHON} ${CMAKE_CURRENT_LIST_DIR}/../stub/gen_stubapi.py ${PARSER_DIR}/inc/external ${CMAKE_CURRENT_BINARY_DIR} | ||||
&& mv onnx_parser.cc stub_onnx_parser.cc | && mv onnx_parser.cc stub_onnx_parser.cc | ||||
&& echo "Generating stub files end." | && echo "Generating stub files end." | ||||
#WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} | |||||
#DEPENDS ../stub/gen_stubapi.py ${TOP_DIR}/inc/external ${CMAKE_CURRENT_BINARY_DIR} | |||||
) | ) | ||||
################################################################## | ################################################################## | ||||
@@ -127,14 +100,11 @@ target_include_directories(fmk_onnx_parser_stub PRIVATE | |||||
${PARSER_DIR}/inc/external | ${PARSER_DIR}/inc/external | ||||
${PARSER_DIR}/parser | ${PARSER_DIR}/parser | ||||
${PARSER_DIR}/../inc | ${PARSER_DIR}/../inc | ||||
${METADEF_DIR}/inc | |||||
${METADEF_DIR}/inc/graph | |||||
${METADEF_DIR}/inc/external | |||||
${METADEF_DIR}/inc/external/graph | |||||
) | ) | ||||
target_link_libraries(fmk_onnx_parser_stub PRIVATE | target_link_libraries(fmk_onnx_parser_stub PRIVATE | ||||
$<BUILD_INTERFACE:intf_pub> | |||||
intf_pub | |||||
metadef_headers | |||||
) | ) | ||||
set_target_properties(fmk_onnx_parser_stub PROPERTIES | set_target_properties(fmk_onnx_parser_stub PROPERTIES | ||||
@@ -13,7 +13,6 @@ | |||||
# limitations under the License. | # limitations under the License. | ||||
# ============================================================================ | # ============================================================================ | ||||
project(tests CXX C) | |||||
add_subdirectory(depends/slog) | add_subdirectory(depends/slog) | ||||
add_subdirectory(depends/mmpa) | add_subdirectory(depends/mmpa) | ||||
add_subdirectory(depends/profiler) | add_subdirectory(depends/profiler) | ||||
@@ -12,23 +12,14 @@ | |||||
# See the License for the specific language governing permissions and | # See the License for the specific language governing permissions and | ||||
# limitations under the License. | # limitations under the License. | ||||
# ============================================================================ | # ============================================================================ | ||||
#cmake_minimum_required(VERSION 2.8) | |||||
project(STUB_ERROR_MANAGER) | |||||
file(GLOB_RECURSE SRCS RELATIVE ${CMAKE_CURRENT_LIST_DIR} | file(GLOB_RECURSE SRCS RELATIVE ${CMAKE_CURRENT_LIST_DIR} | ||||
"src/error_manager_stub.cc" | "src/error_manager_stub.cc" | ||||
) | ) | ||||
include_directories(${PARSER_DIR}/metadef/inc) | |||||
include_directories(${PARSER_DIR}/metadef/inc/external) | |||||
include_directories(${PARSER_DIR}/metadef/metadef/inc) | |||||
include_directories(${PARSER_DIR}/metadef/inc/framework) | |||||
include_directories(${PARSER_DIR}/metadef/metadef/inc/external) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/fwkacllib/inc) | |||||
add_library(error_manager_stub SHARED ${SRCS}) | add_library(error_manager_stub SHARED ${SRCS}) | ||||
target_link_libraries(error_manager_stub PRIVATE | |||||
$<BUILD_INTERFACE:intf_pub> | |||||
target_link_libraries(error_manager_stub | |||||
PRIVATE | |||||
intf_pub | |||||
PUBLIC | |||||
metadef_headers | |||||
) | ) |
@@ -12,12 +12,6 @@ | |||||
# See the License for the specific language governing permissions and | # See the License for the specific language governing permissions and | ||||
# limitations under the License. | # limitations under the License. | ||||
# ============================================================================ | # ============================================================================ | ||||
#cmake_minimum_required(VERSION 2.8) | |||||
project(STUB_ATTR_UTIL) | |||||
################################################################################ | |||||
set(PARSER_PROTO_LIST | set(PARSER_PROTO_LIST | ||||
"${PARSER_DIR}/metadef/proto/om.proto" | "${PARSER_DIR}/metadef/proto/om.proto" | ||||
"${PARSER_DIR}/metadef/proto/ge_ir.proto" | "${PARSER_DIR}/metadef/proto/ge_ir.proto" | ||||
@@ -46,18 +40,6 @@ file(GLOB_RECURSE SRCS RELATIVE ${CMAKE_CURRENT_LIST_DIR} | |||||
) | ) | ||||
include_directories(${CMAKE_CURRENT_LIST_DIR}) | include_directories(${CMAKE_CURRENT_LIST_DIR}) | ||||
include_directories(${PARSER_DIR}/metadef/inc) | |||||
include_directories(${PARSER_DIR}/metadef/inc/graph) | |||||
include_directories(${PARSER_DIR}/metadef/inc/external) | |||||
include_directories(${PARSER_DIR}/metadef/inc/external/graph) | |||||
include_directories(${PARSER_DIR}/metadef/graph) | |||||
include_directories(${PARSER_DIR}/metadef/third_party) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc/external) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc/external/ge) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/fwkacllib/inc) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/transformer/inc) | |||||
include_directories(${PARSER_DIR}/metadef) | |||||
include_directories(${CMAKE_BINARY_DIR}/proto/ge) | include_directories(${CMAKE_BINARY_DIR}/proto/ge) | ||||
include_directories(${CMAKE_BINARY_DIR}/proto/ge/proto) | include_directories(${CMAKE_BINARY_DIR}/proto/ge/proto) | ||||
@@ -75,7 +57,10 @@ target_compile_options(attr_util_stub PRIVATE | |||||
) | ) | ||||
target_link_libraries(attr_util_stub PRIVATE | target_link_libraries(attr_util_stub PRIVATE | ||||
$<BUILD_INTERFACE:intf_pub> | |||||
intf_pub | |||||
metadef_headers | |||||
air_headers | |||||
slog_headers | |||||
ascend_protobuf | ascend_protobuf | ||||
c_sec | c_sec | ||||
) | ) |
@@ -12,28 +12,19 @@ | |||||
# See the License for the specific language governing permissions and | # See the License for the specific language governing permissions and | ||||
# limitations under the License. | # limitations under the License. | ||||
# ============================================================================ | # ============================================================================ | ||||
#cmake_minimum_required(VERSION 2.8) | |||||
project(STUB_MMPA) | |||||
file(GLOB_RECURSE SRCS RELATIVE ${CMAKE_CURRENT_LIST_DIR} | file(GLOB_RECURSE SRCS RELATIVE ${CMAKE_CURRENT_LIST_DIR} | ||||
"src/mmpa_stub.cc" | "src/mmpa_stub.cc" | ||||
) | ) | ||||
include_directories(${PARSER_DIR}/metadef/third_party/fwkacllib/inc) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc/framework) | |||||
include_directories(${PARSER_DIR}/metadef/inc) | |||||
include_directories(${PARSER_DIR}/metadef/inc/external) | |||||
include_directories(${PARSER_DIR}/metadef/metadef/inc) | |||||
include_directories(${PARSER_DIR}/metadef/inc/framework) | |||||
include_directories(${PARSER_DIR}/metadef/metadef/inc/external) | |||||
add_library(parser_mmpa_stub SHARED ${SRCS}) | add_library(parser_mmpa_stub SHARED ${SRCS}) | ||||
target_link_libraries(parser_mmpa_stub PRIVATE | |||||
$<BUILD_INTERFACE:intf_pub> | |||||
-Wl,--no-as-needed | |||||
ascend_protobuf | |||||
-Wl,--as-needed | |||||
c_sec | |||||
target_link_libraries(parser_mmpa_stub | |||||
PRIVATE | |||||
intf_pub | |||||
metadef_headers | |||||
-Wl,--no-as-needed | |||||
ascend_protobuf | |||||
-Wl,--as-needed | |||||
c_sec | |||||
PUBLIC | |||||
mmpa_headers | |||||
) | ) |
@@ -12,17 +12,15 @@ | |||||
# See the License for the specific language governing permissions and | # See the License for the specific language governing permissions and | ||||
# limitations under the License. | # limitations under the License. | ||||
# ============================================================================ | # ============================================================================ | ||||
#cmake_minimum_required(VERSION 2.8) | |||||
project(parser_profiler_stub) | |||||
file(GLOB_RECURSE SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} | file(GLOB_RECURSE SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} | ||||
"src/profiler_stub.cc" | "src/profiler_stub.cc" | ||||
) | ) | ||||
include_directories(${PARSER_DIR}/metadef/third_party/fwkacllib/inc) | |||||
add_library(parser_profiler_stub SHARED ${SRC_FILES}) | add_library(parser_profiler_stub SHARED ${SRC_FILES}) | ||||
target_link_libraries(parser_profiler_stub PRIVATE | |||||
$<BUILD_INTERFACE:intf_pub> | |||||
target_link_libraries(parser_profiler_stub | |||||
PRIVATE | |||||
intf_pub | |||||
PUBLIC | |||||
msprof_headers | |||||
) | ) |
@@ -15,17 +15,7 @@ | |||||
*/ | */ | ||||
#include "toolchain/prof_engine.h" | #include "toolchain/prof_engine.h" | ||||
#include "toolchain/prof_mgr_core.h" | |||||
void * ProfMgrStartUp(const ProfMgrCfg *cfg) | |||||
{ | |||||
return nullptr; | |||||
} | |||||
int ProfMgrStop(void *handle) | |||||
{ | |||||
return 0; | |||||
} | |||||
int Msprof::Engine::RegisterEngine(const std::string& module, const Msprof::Engine::EngineIntf* engine) | int Msprof::Engine::RegisterEngine(const std::string& module, const Msprof::Engine::EngineIntf* engine) | ||||
{ | { | ||||
@@ -12,15 +12,14 @@ | |||||
# See the License for the specific language governing permissions and | # See the License for the specific language governing permissions and | ||||
# limitations under the License. | # limitations under the License. | ||||
# ============================================================================ | # ============================================================================ | ||||
#cmake_minimum_required(VERSION 2.8) | |||||
project(parser_slog_stub) | |||||
file(GLOB_RECURSE SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} | file(GLOB_RECURSE SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} | ||||
"src/*.cc" | "src/*.cc" | ||||
) | ) | ||||
include_directories(${PARSER_DIR}/metadef/third_party/fwkacllib/inc) | |||||
add_library(parser_slog_stub SHARED ${SRC_FILES}) | add_library(parser_slog_stub SHARED ${SRC_FILES}) | ||||
target_link_libraries(parser_slog_stub PRIVATE | |||||
$<BUILD_INTERFACE:intf_pub> | |||||
target_link_libraries(parser_slog_stub | |||||
PRIVATE | |||||
intf_pub | |||||
PUBLIC | |||||
slog_headers | |||||
) | ) |
@@ -12,8 +12,6 @@ | |||||
# See the License for the specific language governing permissions and | # See the License for the specific language governing permissions and | ||||
# limitations under the License. | # limitations under the License. | ||||
# ============================================================================ | # ============================================================================ | ||||
project(st_parser) | |||||
set(CMAKE_CXX_STANDARD 11) | set(CMAKE_CXX_STANDARD 11) | ||||
################################################################################ | ################################################################################ | ||||
@@ -54,7 +52,7 @@ target_compile_options(st_parser_proto PRIVATE | |||||
) | ) | ||||
target_link_libraries(st_parser_proto PRIVATE | target_link_libraries(st_parser_proto PRIVATE | ||||
$<BUILD_INTERFACE:intf_pub> | |||||
intf_pub | |||||
ascend_protobuf | ascend_protobuf | ||||
) | ) | ||||
@@ -148,12 +146,6 @@ include_directories(${PARSER_DIR}/metadef/inc/external) | |||||
include_directories(${PARSER_DIR}/metadef/inc/external/graph) | include_directories(${PARSER_DIR}/metadef/inc/external/graph) | ||||
include_directories(${PARSER_DIR}/metadef/register/op_tiling) | include_directories(${PARSER_DIR}/metadef/register/op_tiling) | ||||
include_directories(${PARSER_DIR}/metadef/graph) | include_directories(${PARSER_DIR}/metadef/graph) | ||||
include_directories(${PARSER_DIR}/metadef/third_party) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc/external) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc/external/ge) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/fwkacllib/inc) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/transformer/inc) | |||||
include_directories(${PARSER_DIR}/metadef) | include_directories(${PARSER_DIR}/metadef) | ||||
include_directories(${CMAKE_BINARY_DIR}/proto/ge) | include_directories(${CMAKE_BINARY_DIR}/proto/ge) | ||||
include_directories(${CMAKE_BINARY_DIR}/proto/ge/proto) | include_directories(${CMAKE_BINARY_DIR}/proto/ge/proto) | ||||
@@ -172,7 +164,10 @@ target_compile_options(st_parser_graph PRIVATE | |||||
) | ) | ||||
target_link_libraries(st_parser_graph PRIVATE | target_link_libraries(st_parser_graph PRIVATE | ||||
$<BUILD_INTERFACE:intf_pub> | |||||
intf_pub | |||||
metadef_headers | |||||
air_headers | |||||
slog_headers | |||||
c_sec ascend_protobuf | c_sec ascend_protobuf | ||||
) | ) | ||||
@@ -215,10 +210,6 @@ include_directories(${PARSER_DIR}/metadef/register) | |||||
include_directories(${PARSER_DIR}/metadef/inc) | include_directories(${PARSER_DIR}/metadef/inc) | ||||
include_directories(${PARSER_DIR}/metadef/inc/external) | include_directories(${PARSER_DIR}/metadef/inc/external) | ||||
include_directories(${PARSER_DIR}/metadef/inc/register) | include_directories(${PARSER_DIR}/metadef/inc/register) | ||||
include_directories(${PARSER_DIR}/metadef/third_party/fwkacllib/inc) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc/external) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc/framework) | |||||
############ libst_parser_register.a ############ | ############ libst_parser_register.a ############ | ||||
add_library(st_parser_register STATIC | add_library(st_parser_register STATIC | ||||
@@ -234,7 +225,12 @@ target_compile_options(st_parser_register PRIVATE | |||||
) | ) | ||||
target_link_libraries(st_parser_register PRIVATE | target_link_libraries(st_parser_register PRIVATE | ||||
$<BUILD_INTERFACE:intf_pub> | |||||
intf_pub | |||||
metadef_headers | |||||
air_headers | |||||
slog_headers | |||||
runtime_headers | |||||
msprof_headers | |||||
c_sec ascend_protobuf json | c_sec ascend_protobuf json | ||||
) | ) | ||||
@@ -324,10 +320,6 @@ include_directories(${PARSER_DIR}/tests) | |||||
include_directories(${PARSER_DIR}/metadef/inc) | include_directories(${PARSER_DIR}/metadef/inc) | ||||
include_directories(${PARSER_DIR}/metadef/inc/external) | include_directories(${PARSER_DIR}/metadef/inc/external) | ||||
include_directories(${PARSER_DIR}/metadef/inc/register) | include_directories(${PARSER_DIR}/metadef/inc/register) | ||||
include_directories(${PARSER_DIR}/metadef/third_party/fwkacllib/inc) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc/external) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc/framework) | |||||
set(PARSER_ST_FILES | set(PARSER_ST_FILES | ||||
@@ -353,7 +345,10 @@ target_compile_options(st_parser_common PRIVATE | |||||
) | ) | ||||
target_link_libraries(st_parser_common PRIVATE | target_link_libraries(st_parser_common PRIVATE | ||||
$<BUILD_INTERFACE:intf_pub> | |||||
intf_pub | |||||
air_headers | |||||
metadef_headers | |||||
slog_headers | |||||
st_parser_proto st_parser_graph c_sec | st_parser_proto st_parser_graph c_sec | ||||
ascend_protobuf | ascend_protobuf | ||||
json | json | ||||
@@ -373,11 +368,17 @@ target_compile_definitions(st_parser PRIVATE | |||||
google=ascend_private | google=ascend_private | ||||
) | ) | ||||
target_link_libraries(st_parser | |||||
$<BUILD_INTERFACE:intf_pub> | |||||
target_link_libraries(st_parser PRIVATE | |||||
intf_pub | |||||
metadef_headers | |||||
air_headers | |||||
slog_headers | |||||
cce_headers | |||||
runtime_headers | |||||
msprof_headers | |||||
st_parser_proto | st_parser_proto | ||||
json | json | ||||
-Wl,--whole-archive st_parser_common -Wl,--no-whole-archive | -Wl,--whole-archive st_parser_common -Wl,--no-whole-archive | ||||
st_parser_graph st_parser_register error_manager_stub parser_mmpa_stub attr_util_stub | st_parser_graph st_parser_register error_manager_stub parser_mmpa_stub attr_util_stub | ||||
gtest gtest_main parser_slog_stub ascend_protobuf c_sec -lrt -ldl -lgcov | |||||
GTest::gtest GTest::gtest_main parser_slog_stub ascend_protobuf c_sec -lrt -ldl -lgcov | |||||
) | ) |
@@ -26,7 +26,7 @@ | |||||
#include "st/parser_st_utils.h" | #include "st/parser_st_utils.h" | ||||
#include "tests/depends/ops_stub/ops_stub.h" | #include "tests/depends/ops_stub/ops_stub.h" | ||||
#include "parser/common/acl_graph_parser_util.h" | #include "parser/common/acl_graph_parser_util.h" | ||||
#include "metadef/third_party/graphengine/inc/external/ge/ge_api_types.h" | |||||
#include "external/ge/ge_api_types.h" | |||||
#include "omg/parser/parser_factory.h" | #include "omg/parser/parser_factory.h" | ||||
#include "common/pre_checker.h" | #include "common/pre_checker.h" | ||||
#include "common/util.h" | #include "common/util.h" | ||||
@@ -12,9 +12,6 @@ | |||||
# See the License for the specific language governing permissions and | # See the License for the specific language governing permissions and | ||||
# limitations under the License. | # limitations under the License. | ||||
# ============================================================================ | # ============================================================================ | ||||
project(ut CXX C) | |||||
if (ENABLE_PARSER_COV) | if (ENABLE_PARSER_COV) | ||||
set(COVERAGE_COMPILER_FLAGS "-g --coverage -fprofile-arcs -fPIC -O0 -ftest-coverage") | set(COVERAGE_COMPILER_FLAGS "-g --coverage -fprofile-arcs -fPIC -O0 -ftest-coverage") | ||||
set(CMAKE_CXX_FLAGS "${COVERAGE_COMPILER_FLAGS}") | set(CMAKE_CXX_FLAGS "${COVERAGE_COMPILER_FLAGS}") | ||||
@@ -12,9 +12,6 @@ | |||||
# See the License for the specific language governing permissions and | # See the License for the specific language governing permissions and | ||||
# limitations under the License. | # limitations under the License. | ||||
# ============================================================================ | # ============================================================================ | ||||
project(ut_parser) | |||||
set(CMAKE_CXX_STANDARD 11) | set(CMAKE_CXX_STANDARD 11) | ||||
################################################################################ | ################################################################################ | ||||
@@ -55,7 +52,7 @@ target_compile_options(ut_parser_proto PRIVATE | |||||
) | ) | ||||
target_link_libraries(ut_parser_proto PRIVATE | target_link_libraries(ut_parser_proto PRIVATE | ||||
$<BUILD_INTERFACE:intf_pub> | |||||
intf_pub | |||||
ascend_protobuf | ascend_protobuf | ||||
) | ) | ||||
@@ -149,12 +146,6 @@ include_directories(${PARSER_DIR}/metadef/inc/external) | |||||
include_directories(${PARSER_DIR}/metadef/inc/external/graph) | include_directories(${PARSER_DIR}/metadef/inc/external/graph) | ||||
include_directories(${PARSER_DIR}/metadef/graph) | include_directories(${PARSER_DIR}/metadef/graph) | ||||
include_directories(${PARSER_DIR}/metadef/register) | include_directories(${PARSER_DIR}/metadef/register) | ||||
include_directories(${PARSER_DIR}/metadef/third_party) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc/external) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc/external/ge) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/fwkacllib/inc) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/transformer/inc) | |||||
include_directories(${PARSER_DIR}/metadef) | include_directories(${PARSER_DIR}/metadef) | ||||
include_directories(${CMAKE_BINARY_DIR}/proto/ge) | include_directories(${CMAKE_BINARY_DIR}/proto/ge) | ||||
include_directories(${CMAKE_BINARY_DIR}/proto/ge/proto) | include_directories(${CMAKE_BINARY_DIR}/proto/ge/proto) | ||||
@@ -173,7 +164,10 @@ target_compile_options(ut_parser_graph PRIVATE | |||||
) | ) | ||||
target_link_libraries(ut_parser_graph PRIVATE | target_link_libraries(ut_parser_graph PRIVATE | ||||
$<BUILD_INTERFACE:intf_pub> | |||||
intf_pub | |||||
metadef_headers | |||||
air_headers | |||||
slog_headers | |||||
c_sec ascend_protobuf | c_sec ascend_protobuf | ||||
) | ) | ||||
@@ -216,10 +210,6 @@ include_directories(${PARSER_DIR}/metadef/register) | |||||
include_directories(${PARSER_DIR}/metadef/inc) | include_directories(${PARSER_DIR}/metadef/inc) | ||||
include_directories(${PARSER_DIR}/metadef/inc/external) | include_directories(${PARSER_DIR}/metadef/inc/external) | ||||
include_directories(${PARSER_DIR}/metadef/inc/register) | include_directories(${PARSER_DIR}/metadef/inc/register) | ||||
include_directories(${PARSER_DIR}/metadef/third_party/fwkacllib/inc) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc/external) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc/framework) | |||||
############ libut_parser_register.a ############ | ############ libut_parser_register.a ############ | ||||
add_library(ut_parser_register STATIC | add_library(ut_parser_register STATIC | ||||
@@ -235,7 +225,11 @@ target_compile_options(ut_parser_register PRIVATE | |||||
) | ) | ||||
target_link_libraries(ut_parser_register PRIVATE | target_link_libraries(ut_parser_register PRIVATE | ||||
$<BUILD_INTERFACE:intf_pub> | |||||
intf_pub | |||||
air_headers | |||||
slog_headers | |||||
runtime_headers | |||||
msprof_headers | |||||
c_sec ascend_protobuf json | c_sec ascend_protobuf json | ||||
) | ) | ||||
@@ -325,11 +319,6 @@ include_directories(${PARSER_DIR}/tests) | |||||
include_directories(${PARSER_DIR}/metadef/inc) | include_directories(${PARSER_DIR}/metadef/inc) | ||||
include_directories(${PARSER_DIR}/metadef/inc/external) | include_directories(${PARSER_DIR}/metadef/inc/external) | ||||
include_directories(${PARSER_DIR}/metadef/inc/register) | include_directories(${PARSER_DIR}/metadef/inc/register) | ||||
include_directories(${PARSER_DIR}/metadef/third_party/fwkacllib/inc) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc/external) | |||||
include_directories(${PARSER_DIR}/metadef/third_party/graphengine/inc/framework) | |||||
set(PARSER_UT_FILES | set(PARSER_UT_FILES | ||||
"parser_ut_utils.cc" | "parser_ut_utils.cc" | ||||
@@ -357,7 +346,9 @@ target_compile_options(ut_parser_common PRIVATE | |||||
) | ) | ||||
target_link_libraries(ut_parser_common PRIVATE | target_link_libraries(ut_parser_common PRIVATE | ||||
$<BUILD_INTERFACE:intf_pub> | |||||
intf_pub | |||||
air_headers | |||||
slog_headers | |||||
ut_parser_proto ut_parser_graph c_sec | ut_parser_proto ut_parser_graph c_sec | ||||
ascend_protobuf | ascend_protobuf | ||||
json | json | ||||
@@ -378,9 +369,15 @@ target_compile_definitions(ut_parser PRIVATE | |||||
) | ) | ||||
target_link_libraries(ut_parser | target_link_libraries(ut_parser | ||||
$<BUILD_INTERFACE:intf_pub> | |||||
intf_pub | |||||
metadef_headers | |||||
air_headers | |||||
slog_headers | |||||
cce_headers | |||||
runtime_headers | |||||
msprof_headers | |||||
ut_parser_proto | ut_parser_proto | ||||
-Wl,--whole-archive ut_parser_common -Wl,--no-whole-archive | -Wl,--whole-archive ut_parser_common -Wl,--no-whole-archive | ||||
ut_parser_graph ut_parser_register error_manager_stub parser_mmpa_stub attr_util_stub | ut_parser_graph ut_parser_register error_manager_stub parser_mmpa_stub attr_util_stub | ||||
gtest gtest_main parser_slog_stub ascend_protobuf c_sec json -lrt -ldl -lgcov | |||||
GTest::gtest GTest::gtest_main parser_slog_stub ascend_protobuf c_sec json -lrt -ldl -lgcov | |||||
) | ) |
@@ -27,7 +27,7 @@ | |||||
#include "external/register/register.h" | #include "external/register/register.h" | ||||
#include "tests/depends/ops_stub/ops_stub.h" | #include "tests/depends/ops_stub/ops_stub.h" | ||||
#include "parser/common/acl_graph_parser_util.h" | #include "parser/common/acl_graph_parser_util.h" | ||||
#include "metadef/third_party/graphengine/inc/external/ge/ge_api_types.h" | |||||
#include "external/ge/ge_api_types.h" | |||||
#include "omg/parser/parser_factory.h" | #include "omg/parser/parser_factory.h" | ||||
#include "common/pre_checker.h" | #include "common/pre_checker.h" | ||||
#include "common/util.h" | #include "common/util.h" | ||||