From 18e5aa79836310b1e251dc0a7444bcfcc5e50f3f Mon Sep 17 00:00:00 2001 From: t00456437 Date: Fri, 30 Oct 2020 09:39:33 +0800 Subject: [PATCH] update acl compile --- CMakeLists.txt | 8 +++++--- ge/CMakeLists.txt | 20 +++++++++++++++----- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41aad1a9..fb526f1b 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,7 @@ if (ENABLE_OPEN_SRC) 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}) @@ -53,7 +54,7 @@ if (ENABLE_OPEN_SRC) 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}) - find_module(ascendcl_static libascendcl.a ${GE_LIB_PATH}) + #find_module(ascendcl_static libascendcl.a ${GE_LIB_PATH}) else() if(DEFINED ENV{ASCEND_CUSTOM_PATH}) set(ASCEND_DIR $ENV{ASCEND_CUSTOM_PATH}) @@ -66,6 +67,7 @@ if (ENABLE_OPEN_SRC) 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") @@ -88,7 +90,7 @@ if (ENABLE_OPEN_SRC) find_module(error_manager liberror_manager.so ${ASCEND_ATC_DIR}) find_module(error_manager_static liberror_manager.a ${ASCEND_ACL_DIR}) find_module(msprofiler libmsprofiler.a ${ASCEND_ACL_DIR}) - find_module(ascendcl_static libascendcl.a ${ASCEND_ACL_DIR}) + #find_module(ascendcl_static libascendcl.a ${ASCEND_ACL_DIR}) if(PRODUCT STREQUAL "flr3") find_module(msprof libmsprof.so ${ASCEND_DRIVER_SHARE_DIR}) elseif(PRODUCT STREQUAL "flr1") @@ -111,7 +113,7 @@ if (ENABLE_OPEN_SRC) find_module(error_manager_static liberror_manager.a ${ASCEND_ACL_DIR}) find_module(msprofiler libmsprofiler.a ${ASCEND_ACL_DIR}) find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR}/driver) - find_module(ascendcl_static libascendcl.a ${ASCEND_ACL_DIR}) + #find_module(ascendcl_static libascendcl.a ${ASCEND_ACL_DIR}) else() message(FATAL_ERROR "PLATFORM param is invalid, should be train or inference, build terminated") endif() diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index a3f9a865..47d0dd7d 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -718,11 +718,22 @@ target_link_libraries(ge_compiler ) ############ libascendcl.so ############ -file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/dummy.c CONTENT "") -add_library(dummy_obj OBJECT ${CMAKE_BINARY_DIR}/dummy.c) -set(DUMMY_OBJ $) +#file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/dummy.c CONTENT "") +#add_library(dummy_obj OBJECT ${CMAKE_BINARY_DIR}/dummy.c) +#set(DUMMY_OBJ $) -add_library(opensrc_ascendcl SHARED ${DUMMY_OBJ}) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ascendcl_object) + +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) + +add_library(opensrc_ascendcl SHARED + ${OBJECT_LIST} +) target_compile_options(opensrc_ascendcl PRIVATE -O2 -fvisibility=hidden @@ -737,7 +748,6 @@ target_link_options(opensrc_ascendcl PRIVATE target_link_libraries(opensrc_ascendcl PRIVATE -Wl,--whole-archive ge_executor - ascendcl_static ge_common_static graph_static protobuf_static