dependency_graphengine.cmake 3.5 KB
Newer Older
Z
zhunaipan 已提交
1 2 3 4 5 6 7 8 9 10 11
message(STATUS "ENABLE_GE set to FALSE, compiling GraphEngine")
set(GE_SOURCE_DIR ${CMAKE_SOURCE_DIR}/graphengine)

message(STATUS "ge dir: ${GE_SOURCE_DIR}")
# download json headers, rather than whole repository
include(${GE_SOURCE_DIR}/cmake/ge_utils.cmake)
include(${GE_SOURCE_DIR}/cmake/external_libs/json.cmake)
include(${GE_SOURCE_DIR}/cmake/external_libs/eigen.cmake)
include(${GE_SOURCE_DIR}/cmake/external_libs/gtest.cmake)
include(${GE_SOURCE_DIR}/cmake/external_libs/protobuf.cmake)
include(${GE_SOURCE_DIR}/cmake/external_libs/onnx.cmake)
C
caifubi 已提交
12
include(${GE_SOURCE_DIR}/cmake/external_libs/securec.cmake)
Z
zhunaipan 已提交
13

C
caifubi 已提交
14
# for CPU/GPU mode, find slog from local prebuild
Z
zhunaipan 已提交
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
if (NOT ENABLE_D)
    set(GE_PREBUILD_PATH ${GE_SOURCE_DIR}/third_party/prebuild/${CMAKE_HOST_SYSTEM_PROCESSOR})
    find_library(slog libslog.so ${GE_PREBUILD_PATH})
elseif (DEFINED ENV{D_LINK_PATH})
    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")
    endif()
    set(GE_LIB_PATH ${GE_LIB_PATH}/${GE_SYS_ARCH})
    find_library(slog libslog.so ${GE_LIB_PATH})
    find_library(mmpa libmmpa.so ${GE_LIB_PATH})
    find_library(runtime libruntime.so ${GE_LIB_PATH})
    find_library(msprof libmsprof.so ${GE_LIB_PATH})
    find_library(register libregister.so ${GE_LIB_PATH})
    find_library(hccl libhccl.so ${GE_LIB_PATH})
    find_library(cce libcce.so ${GE_LIB_PATH})
    find_library(resource libresource.so ${GE_LIB_PATH})
39
    find_library(error_manager liberror_manager.so ${GE_LIB_PATH})
Z
zhunaipan 已提交
40
else()
J
jjfeing 已提交
41
    # Ascend mode
42 43 44 45 46
    if(DEFINED ENV{ASCEND_CUSTOM_PATH})
        set(ASCEND_PATH $ENV{ASCEND_CUSTOM_PATH})
    else()
        set(ASCEND_PATH /usr/local/Ascend)
    endif()
J
jjfeing 已提交
47
    set(ASCEND_DRIVER_PATH ${ASCEND_PATH}/driver/lib64/common)
48 49 50 51 52
    if (DEFINED ENV{ASCEND_CUSTOM_FWK_PATH})
        set(ASCEND_RUNTIME_PATH $ENV{ASCEND_CUSTOM_FWK_PATH}/fwkacllib/lib64)
    else ()
        set(ASCEND_RUNTIME_PATH ${ASCEND_PATH}/fwkacllib/lib64)
    endif ()
J
jjfeing 已提交
53 54 55 56 57 58 59 60 61
    find_library(c_sec libc_sec.so ${ASCEND_DRIVER_PATH})
    find_library(slog libslog.so ${ASCEND_DRIVER_PATH})
    find_library(mmpa libmmpa.so ${ASCEND_DRIVER_PATH})
    find_library(cce libcce.so ${ASCEND_RUNTIME_PATH})
    find_library(hccl libhccl.so ${ASCEND_RUNTIME_PATH})
    find_library(runtime libruntime.so ${ASCEND_RUNTIME_PATH})
    find_library(msprof libmsprof.so ${ASCEND_RUNTIME_PATH})
    find_library(register libregister.so ${ASCEND_RUNTIME_PATH})
    find_library(resource libresource.so ${ASCEND_RUNTIME_PATH})
62
    find_library(error_manager liberror_manager.so ${ASCEND_RUNTIME_PATH})
Z
zhunaipan 已提交
63 64 65 66 67 68 69 70 71
endif()

# compile libraries from following directories
# this cmake file is called only when NOT ENABLE_GE is set
set(_ge_tmp_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})

string(REPLACE " -Wall" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE " -Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
# force __FILE__ to show relative path of file, from source directory
72
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILE__='\"$(subst $(realpath ${CMAKE_SOURCE_DIR})/,,$(abspath $<))\"' -Wno-builtin-macro-redefined")
Z
zhunaipan 已提交
73 74 75 76 77 78 79
add_subdirectory(${GE_SOURCE_DIR}/src/common/graph)
if(ENABLE_D)
    add_subdirectory(${GE_SOURCE_DIR}/src/ge/common)
    add_subdirectory(${GE_SOURCE_DIR}/src/ge/ge_runtime)
endif()

set(CMAKE_CXX_FLAGS ${_ge_tmp_CMAKE_CXX_FLAGS})