| @@ -129,6 +129,14 @@ if (ENABLE_OPEN_SRC) | |||
| #add_subdirectory(metadef/graph) | |||
| #add_subdirectory(metadef/register) | |||
| elseif (ENABLE_D OR ENABLE_ACL) | |||
| set(ASCEND_MS_RUNTIME_PATH ${ASCEND_RUNTIME_DIR} ${ASCEND_ACL_DIR} ${ASCEND_ATC_DIR}) | |||
| set(ASCEND_MS_DRIVER_PATH ${ASCEND_DRIVER_DIR} ${ASCEND_DRIVER_COMMON_DIR}) | |||
| set(ATLAS_RUNTIME_DIR ${ASCEND_DIR}/ascend-toolkit/latest/fwkacllib/lib64) | |||
| set(ATLAS_ACL_DIR ${ASCEND_DIR}/ascend-toolkit/latest/acllib/lib64) | |||
| set(ATLAS_ATC_DIR ${ASCEND_DIR}/ascend-toolkit/latest/atc/lib64) | |||
| set(ATLAS_MS_RUNTIME_PATH ${ATLAS_RUNTIME_DIR} ${ATLAS_ACL_DIR} ${ATLAS_ATC_DIR}) | |||
| # compiling with MindSpore | |||
| include(cmake/external_libs/protobuf_static.cmake) | |||
| include(cmake/external_libs/protoc.cmake) | |||
| @@ -137,23 +145,15 @@ elseif (ENABLE_D OR ENABLE_ACL) | |||
| include(cmake/FindModule.cmake) | |||
| include(cmake/intf_pub_linux.cmake) | |||
| # common modules | |||
| find_module(slog libslog.so ${ASCEND_DRIVER_COMMON_DIR}) | |||
| find_module(mmpa libmmpa.so ${ASCEND_DRIVER_COMMON_DIR}) | |||
| # common libraries | |||
| find_module(slog libslog.so ${ASCEND_MS_DRIVER_PATH}) | |||
| find_module(error_manager liberror_manager.so ${ASCEND_MS_RUNTIME_PATH} ${ATLAS_MS_RUNTIME_PATH}) | |||
| if (ENABLE_D) | |||
| # training | |||
| find_module(runtime libruntime.so ${ASCEND_RUNTIME_DIR}) | |||
| find_module(error_manager liberror_manager.so ${ASCEND_RUNTIME_DIR}) | |||
| find_module(register libregister.so ${ASCEND_RUNTIME_DIR}) | |||
| find_module(resource libresource.so ${ASCEND_RUNTIME_DIR}) | |||
| elseif(ENABLE_ACL) | |||
| # inference | |||
| find_module(msprof libmsprof.so ${ASCEND_DRIVER_COMMON_DIR}) | |||
| find_module(adump_server libadump_server.a ${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(mmpa libmmpa.so ${ASCEND_MS_DRIVER_PATH}) | |||
| find_module(runtime libruntime.so ${ASCEND_MS_RUNTIME_PATH} ${ATLAS_MS_RUNTIME_PATH}) | |||
| find_module(register libregister.so ${ASCEND_MS_RUNTIME_PATH} ${ATLAS_MS_RUNTIME_PATH}) | |||
| endif () | |||
| set(METADEF_DIR ${CMAKE_CURRENT_LIST_DIR}/metadef) | |||
| @@ -3,10 +3,16 @@ | |||
| name - find the library name | |||
| path - find the library path | |||
| #]] | |||
| function(find_module module name path) | |||
| function(find_module module name) | |||
| if (TARGET ${module}) | |||
| return() | |||
| endif() | |||
| set(options) | |||
| set(oneValueArgs) | |||
| set(multiValueArgs) | |||
| cmake_parse_arguments(MODULE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | |||
| set(path ${MODULE_UNPARSED_ARGUMENTS}) | |||
| find_library(${module}_LIBRARY_DIR NAMES ${name} NAMES_PER_DIR PATHS ${path} | |||
| PATH_SUFFIXES lib | |||
| ) | |||
| @@ -6,7 +6,7 @@ if (NOT ENABLE_D AND NOT ENABLE_ACL) | |||
| add_subdirectory(host_cpu_engine) | |||
| add_subdirectory(executor) | |||
| add_subdirectory(offline) | |||
| else() | |||
| elseif (ENABLE_D) | |||
| add_subdirectory(common) | |||
| add_subdirectory(ge_runtime) | |||
| endif () | |||
| @@ -925,70 +925,4 @@ install(FILES | |||
| ${CMAKE_CURRENT_BINARY_DIR}/optimizer_priority.pbtxt OPTIONAL | |||
| DESTINATION ${INSTALL_LIBRARY_DIR} | |||
| ) | |||
| elseif (ENABLE_ACL) | |||
| ############ libge_compiler.so w/static protobuf ############ | |||
| 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 | |||
| google=ascend_private | |||
| ) | |||
| 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 | |||
| ${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 | |||
| static_ascend_protobuf | |||
| register | |||
| c_sec | |||
| error_manager | |||
| slog | |||
| mmpa | |||
| runtime_compile | |||
| resource | |||
| -Wl,--as-needed | |||
| json | |||
| -lrt | |||
| -ldl | |||
| ) | |||
| ############ install libge_compiler for MindSpore############ | |||
| set(INSTALL_BASE_DIR "") | |||
| set(INSTALL_LIBRARY_DIR lib) | |||
| install(TARGETS ge_compiler OPTIONAL | |||
| LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} | |||
| ) | |||
| endif() | |||