mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
Fix issues with ArmNN build setup (#6495)
* ArmNN build fixes * Update BUILD.md to document that the ACL paths must be specified to build ArmNN * Fix CUDA build error. We don't setup the link libraries correctly/consistently so improve that.
This commit is contained in:
parent
f2872ffd64
commit
e5cbcec17f
5 changed files with 22 additions and 28 deletions
7
BUILD.md
7
BUILD.md
|
|
@ -596,11 +596,13 @@ See more information on the ArmNN Execution Provider [here](./docs/execution_pro
|
|||
source /opt/fsl-imx-xwayland/4.*/environment-setup-aarch64-poky-linux
|
||||
alias cmake="/usr/bin/cmake -DCMAKE_TOOLCHAIN_FILE=$OECORE_NATIVE_SYSROOT/usr/share/cmake/OEToolchainConfig.cmake"
|
||||
```
|
||||
|
||||
* See [Build ARM](#ARM) below for information on building for ARM devices
|
||||
|
||||
#### Build Instructions
|
||||
```
|
||||
./build.sh --use_armnn
|
||||
|
||||
```
|
||||
The Relu operator is set by default to use the CPU execution provider for better performance. To use the ArmNN implementation build with --armnn_relu flag
|
||||
```
|
||||
|
|
@ -611,9 +613,10 @@ The Batch Normalization operator is set by default to use the CPU execution prov
|
|||
./build.sh --use_armnn --armnn_bn
|
||||
```
|
||||
|
||||
To use a library outside the normal environment you can set a custom path by using --armnn_home and --armnn_libs tags that defines the path to the ArmNN home directory and the build directory respectively.
|
||||
To use a library outside the normal environment you can set a custom path by providing the --armnn_home and --armnn_libs parameters to define the path to the ArmNN home directory and build directory respectively.
|
||||
The ARM Compute Library home directory and build directory must also be available, and can be specified if needed using --acl_home and --acl_libs respectively.
|
||||
```
|
||||
./build.sh --use_armnn --armnn_home /path/to/ComputeLibrary --armnn_libs /path/to/build
|
||||
./build.sh --use_armnn --armnn_home /path/to/armnn --armnn_libs /path/to/armnn/build --acl_home /path/to/ComputeLibrary --acl_libs /path/to/acl/build
|
||||
```
|
||||
|
||||
---
|
||||
|
|
|
|||
|
|
@ -732,7 +732,6 @@ if (onnxruntime_USE_ACL OR onnxruntime_USE_ACL_1902 OR onnxruntime_USE_ACL_1905
|
|||
endif()
|
||||
|
||||
if (NOT ${onnxruntime_ACL_LIBS} STREQUAL "")
|
||||
|
||||
add_library(arm_compute SHARED IMPORTED)
|
||||
set_target_properties(arm_compute PROPERTIES
|
||||
IMPORTED_NO_SONAME 1
|
||||
|
|
@ -747,11 +746,9 @@ if (onnxruntime_USE_ACL OR onnxruntime_USE_ACL_1902 OR onnxruntime_USE_ACL_1905
|
|||
set_target_properties(arm_compute_graph PROPERTIES
|
||||
IMPORTED_NO_SONAME 1
|
||||
IMPORTED_LOCATION "${onnxruntime_ACL_LIBS}/libarm_compute_graph.so")
|
||||
|
||||
link_libraries(arm_compute arm_compute_core arm_compute_graph)
|
||||
endif()
|
||||
|
||||
list(APPEND onnxruntime_EXTERNAL_LIBRARIES arm_compute arm_compute_graph arm_compute_core)
|
||||
list(APPEND onnxruntime_EXTERNAL_LIBRARIES arm_compute arm_compute_core arm_compute_graph)
|
||||
|
||||
endif()
|
||||
|
||||
|
|
@ -765,7 +762,6 @@ if (onnxruntime_USE_ARMNN)
|
|||
endif()
|
||||
|
||||
if (NOT onnxruntime_USE_ACL AND NOT ${onnxruntime_ACL_LIBS} STREQUAL "")
|
||||
|
||||
add_library(arm_compute SHARED IMPORTED)
|
||||
set_target_properties(arm_compute PROPERTIES
|
||||
IMPORTED_NO_SONAME 1
|
||||
|
|
@ -780,20 +776,16 @@ if (onnxruntime_USE_ARMNN)
|
|||
set_target_properties(arm_compute_graph PROPERTIES
|
||||
IMPORTED_NO_SONAME 1
|
||||
IMPORTED_LOCATION "${onnxruntime_ACL_LIBS}/libarm_compute_graph.so")
|
||||
|
||||
link_libraries(arm_compute arm_compute_core arm_compute_graph)
|
||||
endif()
|
||||
|
||||
if (NOT ${onnxruntime_ARMNN_LIBS} STREQUAL "")
|
||||
|
||||
find_library(ARMNN_LIBRARY NAMES armnn
|
||||
PATHS ${onnxruntime_ARMNN_LIBS}
|
||||
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
|
||||
|
||||
link_libraries(armnn)
|
||||
add_library(armnn SHARED IMPORTED)
|
||||
set_target_properties(armnn PROPERTIES
|
||||
IMPORTED_NO_SONAME 1
|
||||
IMPORTED_LOCATION "${onnxruntime_ARMNN_LIBS}/libarmnn.so")
|
||||
endif()
|
||||
|
||||
list(APPEND onnxruntime_EXTERNAL_LIBRARIES armnn pthread arm_compute_core arm_compute arm_compute_graph)
|
||||
list(APPEND onnxruntime_EXTERNAL_LIBRARIES armnn arm_compute arm_compute_core arm_compute_graph)
|
||||
endif()
|
||||
|
||||
if (onnxruntime_USE_DNNL)
|
||||
|
|
@ -1136,7 +1128,9 @@ if (onnxruntime_USE_CUDA)
|
|||
list(APPEND ONNXRUNTIME_CUDA_LIBRARIES cublas cudnn curand cufft)
|
||||
endif()
|
||||
|
||||
# CUDA_HOME and CUDNN_HOME may differ, so need to add both to the link directories
|
||||
if (WIN32)
|
||||
link_directories(${onnxruntime_CUDA_HOME}/lib/x64)
|
||||
link_directories(${onnxruntime_CUDNN_HOME}/lib/x64)
|
||||
|
||||
# delayload causes crash on exit, so disable for now
|
||||
|
|
@ -1149,8 +1143,10 @@ if (onnxruntime_USE_CUDA)
|
|||
#endforeach(cuda_dll_path)
|
||||
|
||||
else()
|
||||
link_directories(${onnxruntime_CUDA_HOME}/lib64)
|
||||
link_directories(${onnxruntime_CUDNN_HOME}/lib64)
|
||||
endif()
|
||||
|
||||
list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${ONNXRUNTIME_CUDA_LIBRARIES})
|
||||
if(NOT CMAKE_CUDA_ARCHITECTURES)
|
||||
if(CMAKE_LIBRARY_ARCHITECTURE STREQUAL "aarch64-linux-gnu")
|
||||
|
|
|
|||
|
|
@ -925,7 +925,7 @@ if (onnxruntime_USE_ARMNN)
|
|||
onnxruntime_add_include_to_target(onnxruntime_providers_armnn onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf flatbuffers)
|
||||
add_dependencies(onnxruntime_providers_armnn ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
set_target_properties(onnxruntime_providers_armnn PROPERTIES FOLDER "ONNXRuntime")
|
||||
target_include_directories(onnxruntime_providers_armnn PRIVATE ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS} ${onnxruntime_ARMNN_HOME} ${onnxruntime_ARMNN_HOME}/include)
|
||||
target_include_directories(onnxruntime_providers_armnn PRIVATE ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS} ${onnxruntime_ARMNN_HOME} ${onnxruntime_ARMNN_HOME}/include ${onnxruntime_ACL_HOME} ${onnxruntime_ACL_HOME}/include)
|
||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/providers/armnn DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core/providers)
|
||||
set_target_properties(onnxruntime_providers_armnn PROPERTIES LINKER_LANGUAGE CXX)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -30,14 +30,6 @@ function(AddTest)
|
|||
|
||||
if(_UT_LIBS)
|
||||
list(REMOVE_DUPLICATES _UT_LIBS)
|
||||
list (FIND _UT_LIBS "cudart" _index)
|
||||
if (${_index} GREATER -1)
|
||||
if(WIN32)
|
||||
target_link_directories(${_UT_TARGET} PRIVATE ${onnxruntime_CUDA_HOME}/x64/lib64)
|
||||
else()
|
||||
target_link_directories(${_UT_TARGET} PRIVATE ${onnxruntime_CUDA_HOME}/lib64)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
source_group(TREE ${REPO_ROOT} FILES ${_UT_SOURCES})
|
||||
|
|
@ -822,9 +814,11 @@ if (WIN32)
|
|||
endif()
|
||||
|
||||
if (onnxruntime_BUILD_SHARED_LIB)
|
||||
set(onnxruntime_perf_test_libs onnx_test_runner_common onnxruntime_test_utils onnxruntime_common re2::re2
|
||||
onnx_test_data_proto onnx_proto ${PROTOBUF_LIB} ${GETOPT_LIB_WIDE} onnxruntime onnxruntime_flatbuffers
|
||||
${SYS_PATH_LIB} ${CMAKE_DL_LIBS})
|
||||
set(onnxruntime_perf_test_libs
|
||||
onnx_test_runner_common onnxruntime_test_utils onnxruntime_common
|
||||
onnxruntime onnxruntime_flatbuffers onnx_test_data_proto
|
||||
${onnxruntime_EXTERNAL_LIBRARIES}
|
||||
${GETOPT_LIB_WIDE} ${SYS_PATH_LIB} ${CMAKE_DL_LIBS})
|
||||
if(NOT WIN32)
|
||||
list(APPEND onnxruntime_perf_test_libs nsync_cpp)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "core/util/math.h"
|
||||
#include "core/util/math_cpuonly.h"
|
||||
#include "core/providers/cpu/math/gemm.h"
|
||||
#include "core/providers/cpu/math/gemm_helper.h"
|
||||
#include "core/providers/armnn/armnn_execution_provider.h"
|
||||
|
||||
namespace onnxruntime {
|
||||
|
|
|
|||
Loading…
Reference in a new issue