Browse Source

!182 modify acl compile

Merge pull request !182 from taoxudong/development
tags/v1.1.0
王涛 Gitee 4 years ago
parent
commit
a60840db6e
2 changed files with 22 additions and 7 deletions
  1. +5
    -3
      CMakeLists.txt
  2. +17
    -4
      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")
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()


+ 17
- 4
ge/CMakeLists.txt View File

@@ -719,10 +719,24 @@ 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 $<TARGET_OBJECTS:dummy_obj>)
#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)

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
@@ -737,7 +751,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


Loading…
Cancel
Save