Browse Source

update acl compile

tags/v1.1.0
t00456437 4 years ago
parent
commit
18e5aa7983
2 changed files with 20 additions and 8 deletions
  1. +5
    -3
      CMakeLists.txt
  2. +15
    -5
      ge/CMakeLists.txt

+ 5
- 3
CMakeLists.txt View File

@@ -41,6 +41,7 @@ if (ENABLE_OPEN_SRC)
message(FATAL_ERROR "Running on a unsupported architecture: ${SYSTEM_TYPE}, build terminated") message(FATAL_ERROR "Running on a unsupported architecture: ${SYSTEM_TYPE}, build terminated")
endif() endif()
set(GE_LIB_PATH ${GE_LIB_PATH}/${GE_SYS_ARCH}) 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(slog libslog.so ${GE_LIB_PATH})
find_module(mmpa libmmpa.so ${GE_LIB_PATH}) find_module(mmpa libmmpa.so ${GE_LIB_PATH})
find_module(msprof libmsprof.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(ascend_hal_stub libascend_hal.so ${GE_LIB_PATH})
find_module(error_manager_static liberror_manager.a ${GE_LIB_PATH}) find_module(error_manager_static liberror_manager.a ${GE_LIB_PATH})
find_module(msprofiler libmsprofiler.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() else()
if(DEFINED ENV{ASCEND_CUSTOM_PATH}) if(DEFINED ENV{ASCEND_CUSTOM_PATH})
set(ASCEND_DIR $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_RUNTIME_DIR ${ASCEND_DIR}/fwkacllib/lib64)
set(ASCEND_ATC_DIR ${ASCEND_DIR}/atc/lib64) set(ASCEND_ATC_DIR ${ASCEND_DIR}/atc/lib64)
set(ASCEND_ACL_DIR ${ASCEND_DIR}/acllib/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(slog libslog.so ${ASCEND_ATC_DIR})
find_module(mmpa libmmpa.so ${ASCEND_ATC_DIR}) find_module(mmpa libmmpa.so ${ASCEND_ATC_DIR})
if(PLATFORM STREQUAL "train") 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 liberror_manager.so ${ASCEND_ATC_DIR})
find_module(error_manager_static liberror_manager.a ${ASCEND_ACL_DIR}) find_module(error_manager_static liberror_manager.a ${ASCEND_ACL_DIR})
find_module(msprofiler libmsprofiler.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") if(PRODUCT STREQUAL "flr3")
find_module(msprof libmsprof.so ${ASCEND_DRIVER_SHARE_DIR}) find_module(msprof libmsprof.so ${ASCEND_DRIVER_SHARE_DIR})
elseif(PRODUCT STREQUAL "flr1") 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(error_manager_static liberror_manager.a ${ASCEND_ACL_DIR})
find_module(msprofiler libmsprofiler.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(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() else()
message(FATAL_ERROR "PLATFORM param is invalid, should be train or inference, build terminated") message(FATAL_ERROR "PLATFORM param is invalid, should be train or inference, build terminated")
endif() endif()


+ 15
- 5
ge/CMakeLists.txt View File

@@ -718,11 +718,22 @@ target_link_libraries(ge_compiler
) )


############ libascendcl.so ############ ############ 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(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>)


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 target_compile_options(opensrc_ascendcl PRIVATE
-O2 -O2
-fvisibility=hidden -fvisibility=hidden
@@ -737,7 +748,6 @@ target_link_options(opensrc_ascendcl PRIVATE
target_link_libraries(opensrc_ascendcl PRIVATE target_link_libraries(opensrc_ascendcl PRIVATE
-Wl,--whole-archive -Wl,--whole-archive
ge_executor ge_executor
ascendcl_static
ge_common_static ge_common_static
graph_static graph_static
protobuf_static protobuf_static


Loading…
Cancel
Save