From 22bc32895184630abe606f5443a3f5d9b29be682 Mon Sep 17 00:00:00 2001 From: luotao1 Date: Sat, 11 Aug 2018 19:31:30 +0800 Subject: [PATCH] fix anakin-NOTFOUND compiler error --- cmake/external/anakin.cmake | 15 +++++++++------ paddle/fluid/inference/api/CMakeLists.txt | 14 ++++++-------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/cmake/external/anakin.cmake b/cmake/external/anakin.cmake index bbe811fb7b5..6ff54fe823a 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 e9bb1d1c4fa..3bef785b102 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() -- GitLab