diff --git a/cmake/external/anakin.cmake b/cmake/external/anakin.cmake index bbe811fb7b53ac8575fc036ac1c41cdcfe2cfbca..6ff54fe823a0cea5d2ccdfe80c627dcbf9ac39be 100644 --- a/cmake/external/anakin.cmake +++ b/cmake/external/anakin.cmake @@ -48,9 +48,12 @@ ExternalProject_Add( message(STATUS "Anakin for inference is enabled") message(STATUS "Anakin is set INCLUDE:${ANAKIN_INCLUDE} LIBRARY:${ANAKIN_LIBRARY}") -add_library(anakin SHARED IMPORTED GLOBAL) -set_property(TARGET anakin PROPERTY IMPORTED_LOCATION ${ANAKIN_SHARED_LIB}) -set_property(TARGET anakin PROPERTY IMPORTED_LOCATION ${ANAKIN_SABER_LIB}) -set_property(TARGET anakin PROPERTY IMPORTED_LOCATION ${CUDNN_LIBRARY}) -add_dependencies(anakin extern_anakin protobuf mklml) -list(APPEND external_project_dependencies anakin) +add_library(anakin_shared SHARED IMPORTED GLOBAL) +set_property(TARGET anakin_shared PROPERTY IMPORTED_LOCATION ${ANAKIN_SHARED_LIB}) +add_dependencies(anakin_shared extern_anakin protobuf mklml) + +add_library(anakin_saber SHARED IMPORTED GLOBAL) +set_property(TARGET anakin_saber PROPERTY IMPORTED_LOCATION ${ANAKIN_SABER_LIB}) +add_dependencies(anakin_saber extern_anakin protobuf mklml) + +list(APPEND external_project_dependencies anakin_shared anakin_saber) diff --git a/paddle/fluid/inference/api/CMakeLists.txt b/paddle/fluid/inference/api/CMakeLists.txt index e9bb1d1c4faaa892d4566f0c9064e8a20446e33e..3bef785b102f89519c5cb9004956f9ff0bcdb35a 100644 --- a/paddle/fluid/inference/api/CMakeLists.txt +++ b/paddle/fluid/inference/api/CMakeLists.txt @@ -62,22 +62,20 @@ endif() if (WITH_ANAKIN) # only needed in CI # compile the libinference_anakin_api.a and anakin.so. - nv_library(inference_anakin_api SRCS api.cc api_anakin_engine.cc DEPS anakin) - nv_library(inference_anakin_api_shared SHARED SRCS api.cc api_anakin_engine.cc DEPS anakin) - set(ANAKIN_DEPS_LIB ${ANAKIN_SHARED_LIB} ${ANAKIN_SABER_LIB} ${CUDNN_LIBRARY}) + nv_library(inference_anakin_api SRCS api.cc api_anakin_engine.cc DEPS anakin_shared anakin_saber) + #nv_library(inference_anakin_api_shared SHARED SRCS api.cc api_anakin_engine.cc DEPS anakin) function(anakin_target target_name) target_compile_options(${target_name} BEFORE PUBLIC ${ANAKIN_COMPILE_EXTRA_FLAGS}) - target_link_libraries(${target_name} ${ANAKIN_DEPS_LIB}) endfunction() anakin_target(inference_anakin_api) - anakin_target(inference_anakin_api_shared) + #anakin_target(inference_anakin_api_shared) if (WITH_TESTING) # TODO(luotao): anakin_model will move to demo_ci later set(ANAKIN_MODLE_URL "http://paddle-inference-dist.bj.bcebos.com/mobilenet_v2.anakin.bin") - execute_process(COMMAND bash -c "cd ${ANAKIN_INSTALL_DIR}; wget -q --no-check-certificate ${ANAKIN_MODLE_URL}") + execute_process(COMMAND bash -c "wget -q --no-check-certificate ${ANAKIN_MODLE_URL}") cc_test(inference_anakin_test SRCS api_anakin_engine_tester.cc - ARGS --model=${ANAKIN_INSTAL_DIR}/mobilenet_v2.anakin.bin - DEPS inference_anakin_api_shared dynload_cuda SERIAL) + ARGS --model=${CMAKE_CURRENT_BINARY_DIR}/mobilenet_v2.anakin.bin + DEPS inference_anakin_api dynload_cuda SERIAL) target_compile_options(inference_anakin_test BEFORE PUBLIC ${ANAKIN_COMPILE_EXTRA_FLAGS}) endif(WITH_TESTING) endif()