anakin_subgraph.cmake 1.4 KB
Newer Older
N
nhzlx 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
set(ANAKIN_ROOT "/usr" CACHE PATH "ANAKIN ROOT")
find_path(ANAKIN_INCLUDE_DIR anakin_config.h
    PATHS ${ANAKIN_ROOT} ${ANAKIN_ROOT}/include
    $ENV{ANAKIN_ROOT} $ENV{ANAKIN_ROOT}/include
    NO_DEFAULT_PATH
)

find_library(ANAKIN_LIBRARY NAMES libanakin_saber_common.so libanakin.so
    PATHS ${ANAKIN_ROOT}
    $ENV{ANAKIN_ROOT} $ENV{ANAKIN_ROOT}/lib
    NO_DEFAULT_PATH
    DOC "Path to ANAKIN library.")

if(ANAKIN_INCLUDE_DIR AND ANAKIN_LIBRARY)
    set(ANAKIN_FOUND ON)
else()
    set(ANAKIN_FOUND OFF)
endif()

if(ANAKIN_FOUND)
    message(STATUS "Current ANAKIN header is ${ANAKIN_INCLUDE_DIR}/anakin_config.h. ")
22
    include_directories(${ANAKIN_ROOT})
N
nhzlx 已提交
23
    include_directories(${ANAKIN_ROOT}/include)
24
    include_directories(${ANAKIN_ROOT}/saber)
N
nhzlx 已提交
25 26 27
    link_directories(${ANAKIN_ROOT})
    add_definitions(-DPADDLE_WITH_ANAKIN)
endif()
28

石晓伟 已提交
29 30 31 32 33 34 35 36 37 38 39 40 41
if(ANAKIN_FOUND)
  if (ANAKIN_MLU AND NOT WITH_GPU AND NOT ANAKIN_X86)
    message(STATUS "Compile with anakin mlu place.")
    add_definitions(-DANAKIN_MLU_PLACE)
  elseif(ANAKIN_BM AND NOT WITH_GPU AND NOT ANAKIN_X86)
    message(STATUS "Compile with anakin bm place.")
    add_definitions(-DANAKIN_BM_PLACE)
  elseif(ANAKIN_X86)
    message(STATUS "Compile with anakin x86 place.")
    add_definitions(-DANAKIN_X86_PLACE)
  endif()
endif()

42 43 44 45
if(ANAKIN_FOUND AND WITH_GPU AND WITH_DSO)
    message(STATUS "Compile with anakin subgraph.")
    set(ANAKIN_SUBGRAPH ON)
endif()