From 25770b26807b00e80294a370431d625c144a467b Mon Sep 17 00:00:00 2001 From: yuzhenhua Date: Sat, 17 Apr 2021 11:40:00 +0800 Subject: [PATCH] fix compile bug --- .../naml/ascend310_infer/CMakeLists.txt | 21 ++++++++++++++----- .../recommend/naml/script/run_infer_310.sh | 2 +- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/model_zoo/official/recommend/naml/ascend310_infer/CMakeLists.txt b/model_zoo/official/recommend/naml/ascend310_infer/CMakeLists.txt index 9027e4a6b09..a5a23bc8fe4 100644 --- a/model_zoo/official/recommend/naml/ascend310_infer/CMakeLists.txt +++ b/model_zoo/official/recommend/naml/ascend310_infer/CMakeLists.txt @@ -49,16 +49,27 @@ link_directories( ${LIB_PATH} ) +# Set output directory +set(PROJECT_SRC_ROOT ${CMAKE_CURRENT_LIST_DIR}/) + +# Set include directory and library directory +set(ACL_LIB_DIR $ENV{ASCEND_HOME}/acllib) +set(ATLAS_ACL_LIB_DIR $ENV{ASCEND_HOME}/ascend-toolkit/latest/acllib) +# Header path +include_directories(${ACL_LIB_DIR}/include/) +include_directories(${ATLAS_ACL_LIB_DIR}/include/) +include_directories(${PROJECT_SRC_ROOT}/../inc) + +# add host lib path +link_directories(${ACL_LIB_DIR}) +find_library(acl libascendcl.so ${ACL_LIB_DIR}/lib64 ${ATLAS_ACL_LIB_DIR}/lib64) + add_executable(main ./src/utils.cpp ./src/model_process.cpp ./src/sample_process.cpp ./src/main.cpp) -if(target STREQUAL "Simulator_Function") - target_link_libraries(main funcsim) -else() - target_link_libraries(main ascendcl stdc++ gflags) -endif() +target_link_libraries(main ${acl} stdc++ gflags) install(TARGETS main DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) diff --git a/model_zoo/official/recommend/naml/script/run_infer_310.sh b/model_zoo/official/recommend/naml/script/run_infer_310.sh index a56efcda823..69be76920c4 100755 --- a/model_zoo/official/recommend/naml/script/run_infer_310.sh +++ b/model_zoo/official/recommend/naml/script/run_infer_310.sh @@ -59,7 +59,7 @@ echo $device_id export ASCEND_HOME=/usr/local/Ascend/ if [ -d ${ASCEND_HOME}/ascend-toolkit ]; then export PATH=$ASCEND_HOME/ascend-toolkit/latest/fwkacllib/ccec_compiler/bin:$ASCEND_HOME/ascend-toolkit/latest/atc/bin:$PATH - export LD_LIBRARY_PATH=/usr/local/lib:$ASCEND_HOME/ascend-toolkit/latest/atc/lib64:$ASCEND_HOME/ascend-toolkit/latest/fwkacllib/lib64:$ASCEND_HOME/driver/lib64:$ASCEND_HOME/add-ons:$LD_LIBRARY_PATH + export LD_LIBRARY_PATH=/usr/local/lib:$ASCEND_HOME/ascend-toolkit/latest/atc/lib64:$ASCEND_HOME/ascend-toolkit/latest/acllib/lib64:$ASCEND_HOME/ascend-toolkit/latest/fwkacllib/lib64:$ASCEND_HOME/driver/lib64:$ASCEND_HOME/add-ons:$LD_LIBRARY_PATH export TBE_IMPL_PATH=$ASCEND_HOME/ascend-toolkit/latest/opp/op_impl/built-in/ai_core/tbe export PYTHONPATH=${TBE_IMPL_PATH}:$ASCEND_HOME/ascend-toolkit/latest/fwkacllib/python/site-packages:$PYTHONPATH export ASCEND_OPP_PATH=$ASCEND_HOME/ascend-toolkit/latest/opp