stm32mpu-ai: onnxruntime: backport recipe from github st main
Current recipe build was failing due to dependencies with cpuinfo header files and libraries. This commit backports the recipe that is currently being built in the ST main branch in GitHub which clears these dependencies. The recipe was backported as it was in commit with SHA256: fc56201c67adf899080cff5b45ed33824e427609 https://onedigi.atlassian.net/browse/CCS-12 Signed-off-by: David Escalona <david.escalona@digi.com>
This commit is contained in:
parent
b461dd18ce
commit
5bf2f9b99c
|
|
@ -0,0 +1,47 @@
|
|||
From a17c1c5d0b4957b5b3a65fc5d211f5ba6764d404 Mon Sep 17 00:00:00 2001
|
||||
From: Vincent ABRIOU <vincent.abriou@st.com>
|
||||
Date: Fri, 24 Mar 2023 11:09:00 +0100
|
||||
Subject: [PATCH 1/5] onnxruntime: test: remove AVX specific micro benchmark
|
||||
|
||||
Signed-off-by: Vincent ABRIOU <vincent.abriou@st.com>
|
||||
|
||||
%% original patch: 0001-onnxruntime-test-remove-AVX-specific-micro-benchmark.patch
|
||||
---
|
||||
.../test/onnx/microbenchmark/reduceminmax.cc | 24 -------------------
|
||||
1 file changed, 24 deletions(-)
|
||||
|
||||
diff --git a/onnxruntime/test/onnx/microbenchmark/reduceminmax.cc b/onnxruntime/test/onnx/microbenchmark/reduceminmax.cc
|
||||
index 06a7f50c9a..eeaa9e0067 100644
|
||||
--- a/onnxruntime/test/onnx/microbenchmark/reduceminmax.cc
|
||||
+++ b/onnxruntime/test/onnx/microbenchmark/reduceminmax.cc
|
||||
@@ -91,28 +91,4 @@ BENCHMARK(BM_FindMinMaxMlasSSE2)
|
||||
->Arg(98304)
|
||||
->Arg(160000);
|
||||
|
||||
-// MLAS avx implementation
|
||||
-static void BM_FindMinMaxMlasAvx(benchmark::State& state) {
|
||||
- const size_t batch_size = static_cast<size_t>(state.range(0));
|
||||
- float* data = GenerateArrayWithRandomValue<float>(batch_size, -1, 1);
|
||||
- float min = std::numeric_limits<float>::max();
|
||||
- float max = std::numeric_limits<float>::lowest();
|
||||
- for (auto _ : state) {
|
||||
- MlasReduceMinimumMaximumF32KernelAvx(data, &min, &max, batch_size);
|
||||
- }
|
||||
- aligned_free(data);
|
||||
-}
|
||||
-
|
||||
-BENCHMARK(BM_FindMinMaxMlasAvx)
|
||||
- ->UseRealTime()
|
||||
- ->UseRealTime()
|
||||
- ->Unit(benchmark::TimeUnit::kNanosecond)
|
||||
- ->Arg(100)
|
||||
- ->Arg(1000)
|
||||
- ->Arg(10000)
|
||||
- ->Arg(20000)
|
||||
- ->Arg(40000)
|
||||
- ->Arg(80000)
|
||||
- ->Arg(98304)
|
||||
- ->Arg(160000);
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
From cb9bd5d833845a5e12c38b5b457fd232498efeb7 Mon Sep 17 00:00:00 2001
|
||||
From: Othmane AHL ZOUAOUI <othmane.ahlzouaoui@st.com>
|
||||
Date: Tue, 9 May 2023 13:33:14 +0200
|
||||
Subject: [PATCH 2/5] onnxruntime: add SONAME with MAJOR version
|
||||
|
||||
Signed-off-by: Othmane AHL ZOUAOUI <othmane.ahlzouaoui@st.com>
|
||||
|
||||
%% original patch: 0002-onnxruntime-add-SONAME-with-MAJOR-version.patch
|
||||
---
|
||||
cmake/CMakeLists.txt | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
|
||||
index a5d28fb516..08a4c6af52 100644
|
||||
--- a/cmake/CMakeLists.txt
|
||||
+++ b/cmake/CMakeLists.txt
|
||||
@@ -1617,3 +1617,6 @@ if (onnxruntime_ENABLE_EXTERNAL_CUSTOM_OP_SCHEMAS)
|
||||
COMMENT "Installing protobuf"
|
||||
)
|
||||
endif()
|
||||
+
|
||||
+message("ONNXRUNTIME_VERSION_MAJOR=${ONNXRUNTIME_VERSION_MAJOR}")
|
||||
+set_target_properties(onnxruntime PROPERTIES SOVERSION "${ONNXRUNTIME_VERSION_MAJOR}")
|
||||
--
|
||||
2.25.1
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
From e13955dec97f7635cb055e86cb2db026f74e4823 Mon Sep 17 00:00:00 2001
|
||||
From: Othmane AHL ZOUAOUI <othmane.ahlzouaoui@st.com>
|
||||
Date: Tue, 9 May 2023 13:50:46 +0200
|
||||
Subject: [PATCH 3/5] onnxruntime: test: libcustom library remove relative
|
||||
|
||||
Signed-off-by: Othmane AHL ZOUAOUI <othmane.ahlzouaoui@st.com>
|
||||
|
||||
%% original patch: 0003-onnxruntime-test-libcustom-library-remove-relative.patch
|
||||
---
|
||||
onnxruntime/test/python/onnxruntime_test_python.py | 4 ++--
|
||||
onnxruntime/test/shared_lib/test_inference.cc | 4 ++--
|
||||
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/onnxruntime/test/python/onnxruntime_test_python.py b/onnxruntime/test/python/onnxruntime_test_python.py
|
||||
index 89fd90ad3a..6bf0eb0399 100644
|
||||
--- a/onnxruntime/test/python/onnxruntime_test_python.py
|
||||
+++ b/onnxruntime/test/python/onnxruntime_test_python.py
|
||||
@@ -953,7 +953,7 @@ class TestInferenceSession(unittest.TestCase):
|
||||
raise FileNotFoundError("Unable to find '{0}'".format(shared_library))
|
||||
|
||||
else:
|
||||
- shared_library = "./libcustom_op_library.so"
|
||||
+ shared_library = "/usr/lib/libcustom_op_library.so"
|
||||
if not os.path.exists(shared_library):
|
||||
raise FileNotFoundError("Unable to find '{0}'".format(shared_library))
|
||||
|
||||
@@ -1312,7 +1312,7 @@ class TestInferenceSession(unittest.TestCase):
|
||||
return
|
||||
|
||||
else:
|
||||
- shared_library = "./libtest_execution_provider.so"
|
||||
+ shared_library = "/usr/lib/libtest_execution_provider.so"
|
||||
|
||||
if not os.path.exists(shared_library):
|
||||
raise FileNotFoundError("Unable to find '{0}'".format(shared_library))
|
||||
diff --git a/onnxruntime/test/shared_lib/test_inference.cc b/onnxruntime/test/shared_lib/test_inference.cc
|
||||
index 09219b40de..db4d73f4c0 100644
|
||||
--- a/onnxruntime/test/shared_lib/test_inference.cc
|
||||
+++ b/onnxruntime/test/shared_lib/test_inference.cc
|
||||
@@ -1302,7 +1302,7 @@ TEST(CApiTest, test_custom_op_library) {
|
||||
#elif defined(__APPLE__)
|
||||
lib_name = ORT_TSTR("libcustom_op_library.dylib");
|
||||
#else
|
||||
- lib_name = ORT_TSTR("./libcustom_op_library.so");
|
||||
+ lib_name = ORT_TSTR("libcustom_op_library.so");
|
||||
#endif
|
||||
|
||||
#ifdef USE_CUDA
|
||||
@@ -1329,7 +1329,7 @@ TEST(CApiTest, test_custom_op_library_registration_error) {
|
||||
#elif defined(__APPLE__)
|
||||
lib_name = ORT_TSTR("libcustom_op_invalid_library.dylib");
|
||||
#else
|
||||
- lib_name = ORT_TSTR("./libcustom_op_invalid_library.so");
|
||||
+ lib_name = ORT_TSTR("libcustom_op_invalid_library.so");
|
||||
#endif
|
||||
|
||||
Ort::SessionOptions session_options;
|
||||
--
|
||||
2.25.1
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
From 961ee9cf8510b4d9d87777105a338fa31a5d572a Mon Sep 17 00:00:00 2001
|
||||
From: Othmane AHL ZOUAOUI <othmane.ahlzouaoui@st.com>
|
||||
Date: Tue, 9 May 2023 14:03:04 +0200
|
||||
Subject: [PATCH 4/5] onnxruntime: fix imcompatibility with compiler GCC12.2.1
|
||||
bug
|
||||
|
||||
As stated in this issue below, the onnxruntime 14.4.0 release is
|
||||
not compatible with the version 12.2.1 of the GCC cross compiler.
|
||||
This patch is a workaround to fix this incompatibility bug.
|
||||
|
||||
Link to onnxruntime github issue:
|
||||
https://github.com/microsoft/onnxruntime/issues/14981
|
||||
|
||||
Signed-off-by: Othmane AHL ZOUAOUI <othmane.ahlzouaoui@st.com>
|
||||
|
||||
%% original patch: 0004-onnxruntime-fix-imcompatibility-with-compiler-GCC12..patch
|
||||
---
|
||||
onnxruntime/core/providers/cpu/tensor/scatter.cc | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/onnxruntime/core/providers/cpu/tensor/scatter.cc b/onnxruntime/core/providers/cpu/tensor/scatter.cc
|
||||
index 2d932dfe59..2e2f47d31f 100644
|
||||
--- a/onnxruntime/core/providers/cpu/tensor/scatter.cc
|
||||
+++ b/onnxruntime/core/providers/cpu/tensor/scatter.cc
|
||||
@@ -340,7 +340,11 @@ Status ScatterData(
|
||||
// and so on
|
||||
std::vector<int64_t> dim_block_size(num_dims);
|
||||
|
||||
+#if __GNUC__ >= 12
|
||||
+ dim_block_size[num_dims-1] = 1;
|
||||
+#else
|
||||
dim_block_size.back() = 1;
|
||||
+#endif
|
||||
if (num_dims > 1) {
|
||||
// We start at num_dims - 2 because we already pre-populated
|
||||
// the last element above
|
||||
--
|
||||
2.25.1
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
From 8195a2404f122d25814b851cd738cf0ff1e91d89 Mon Sep 17 00:00:00 2001
|
||||
From: Othmane AHL ZOUAOUI <othmane.ahlzouaoui@st.com>
|
||||
Date: Wed, 10 May 2023 10:39:00 +0200
|
||||
Subject: [PATCH 5/5] onnxruntime: avoid using unsupported Eigen headers
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This patch removes the suspected Unsupported/Eigen/CXX11 headers and
|
||||
uses Onnx internal headers instead. It enables also the pragma for
|
||||
HAS_CLASS_MEMACCESS to treat the class-memaccess as warnings.
|
||||
This allows fixing the following build error: ‘void* memcpy(void*,
|
||||
const void*, size_t)’ copying an object of non-trivial type
|
||||
‘Eigen::internal::Packet4c’{aka ‘const signed char’}
|
||||
[-Werror=class-memaccess]
|
||||
|
||||
Signed-off-by: Othmane AHL ZOUAOUI <othmane.ahlzouaoui@st.com>
|
||||
|
||||
%% original patch: 0006-onnxruntime-avoid-using-unsupported-Eigen-headers.patch
|
||||
---
|
||||
onnxruntime/test/onnx/microbenchmark/eigen.cc | 15 ++++++++++++---
|
||||
1 file changed, 12 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/onnxruntime/test/onnx/microbenchmark/eigen.cc b/onnxruntime/test/onnx/microbenchmark/eigen.cc
|
||||
index b3b2c55600..00c317da50 100644
|
||||
--- a/onnxruntime/test/onnx/microbenchmark/eigen.cc
|
||||
+++ b/onnxruntime/test/onnx/microbenchmark/eigen.cc
|
||||
@@ -6,6 +6,13 @@
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#pragma GCC diagnostic ignored "-Wunused-result"
|
||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
+// cmake/external/eigen/unsupported/Eigen/CXX11/../../../Eigen/src/Core/arch/NEON/PacketMath.h:1633:9:
|
||||
+// error: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘Eigen::internal::Packet4c’
|
||||
+// {aka ‘struct Eigen::internal::eigen_packet_wrapper<int, 2>’} from an array of ‘const int8_t’
|
||||
+// {aka ‘const signed char’} [-Werror=class-memaccess]
|
||||
+#ifdef HAS_CLASS_MEMACCESS
|
||||
+#pragma GCC diagnostic ignored "-Wclass-memaccess"
|
||||
+#endif
|
||||
#elif defined(_MSC_VER)
|
||||
// build\windows\debug\external\eigen3\unsupported\eigen\cxx11\src/Tensor/Tensor.h(76):
|
||||
// warning C4554: '&': check operator precedence for possible error; use parentheses to clarify precedence
|
||||
@@ -22,9 +29,11 @@
|
||||
#define EIGEN_USE_THREADS
|
||||
#endif
|
||||
|
||||
-#include <unsupported/Eigen/CXX11/ThreadPool>
|
||||
-#include <unsupported/Eigen/CXX11/Tensor>
|
||||
-#include <unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h>
|
||||
+#include "core/platform/threadpool.h"
|
||||
+#include "core/common/eigen_common_wrapper.h"
|
||||
+#include "core/util/thread_utils.h"
|
||||
+#include <benchmark/benchmark.h>
|
||||
+
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#elif defined(_MSC_VER)
|
||||
--
|
||||
2.25.1
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
From a313277345bb498f9a788b905ed3f4e37ba31b57 Mon Sep 17 00:00:00 2001
|
||||
From: Othmane AHL ZOUAOUI <othmane.ahlzouaoui@st.com>
|
||||
Date: Tue, 30 May 2023 17:17:39 +0200
|
||||
Subject: [PATCH 6/6] onnxruntime: xnnpack: Fix -mcpu compiler build failure
|
||||
|
||||
The "-mcpu=" switch is introduced externaly into CMake by Yocto
|
||||
buildsystem toolchain. This switch is not compatible with XNNPACK
|
||||
build mechanism and causes the XNNPACK compilation break due to
|
||||
"unsupported instructions".
|
||||
This switch needs to be removed for XNNPACK In order to isolate
|
||||
the changes only for XNNPACK and its depencencies, a subfolder and
|
||||
a fix are introduced through this patch.
|
||||
|
||||
Signed-off-by: Othmane AHL ZOUAOUI <othmane.ahlzouaoui@st.com>
|
||||
---
|
||||
cmake/external/xnnpack.cmake | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/cmake/external/xnnpack.cmake b/cmake/external/xnnpack.cmake
|
||||
index 1fc2c6ccdc..62fad6ce38 100644
|
||||
--- a/cmake/external/xnnpack.cmake
|
||||
+++ b/cmake/external/xnnpack.cmake
|
||||
@@ -11,6 +11,18 @@ if(CMAKE_ANDROID_ARCH_ABI STREQUAL armeabi-v7a)
|
||||
set(XNNPACK_ENABLE_ARM_BF16 OFF)
|
||||
ENDIF()
|
||||
|
||||
+string(REGEX REPLACE "-mcpu=[-a-zA-Z0-9_.^$*+?]*" "" _tmp ${CMAKE_C_FLAGS})
|
||||
+set(CMAKE_C_FLAGS ${_tmp})
|
||||
+message("CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
|
||||
+
|
||||
+string(REGEX REPLACE "-mcpu=[-a-zA-Z0-9_.^$*+?]*" "" _tmp ${CMAKE_ASM_FLAGS})
|
||||
+set(CMAKE_ASM_FLAGS ${_tmp})
|
||||
+message("CMAKE_ASM_FLAGS: ${CMAKE_ASM_FLAGS}")
|
||||
+
|
||||
+string(REGEX REPLACE "-mcpu=[-a-zA-Z0-9_.^$*+?]*" "" _tmp ${CMAKE_CXX_FLAGS})
|
||||
+set(CMAKE_CXX_FLAGS ${_tmp})
|
||||
+message("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
|
||||
+
|
||||
# fp16 depends on psimd
|
||||
FetchContent_Declare(psimd URL ${DEP_URL_psimd} URL_HASH SHA1=${DEP_SHA1_psimd})
|
||||
onnxruntime_fetchcontent_makeavailable(psimd)
|
||||
--
|
||||
2.25.1
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
From ce4219ad77d422b9b5adc032ab911824ef212c41 Mon Sep 17 00:00:00 2001
|
||||
From: Othmane AHL ZOUAOUI <othmane.ahlzouaoui@st.com>
|
||||
Date: Wed, 20 Mar 2024 15:59:12 +0100
|
||||
Subject: [PATCH 1/1] onnxruntime: cmake: change visibility compilation options
|
||||
|
||||
Changing the compile options of the libonnxruntime shared lib
|
||||
to export all the symbols of the lib and make them visible during
|
||||
the runtime.
|
||||
|
||||
Signed-off-by: Othmane AHL ZOUAOUI <othmane.ahlzouaoui@st.com>
|
||||
---
|
||||
cmake/CMakeLists.txt | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
|
||||
index 08a4c6af52..1336ceb19b 100644
|
||||
--- a/cmake/CMakeLists.txt
|
||||
+++ b/cmake/CMakeLists.txt
|
||||
@@ -1620,3 +1620,5 @@ endif()
|
||||
|
||||
message("ONNXRUNTIME_VERSION_MAJOR=${ONNXRUNTIME_VERSION_MAJOR}")
|
||||
set_target_properties(onnxruntime PROPERTIES SOVERSION "${ONNXRUNTIME_VERSION_MAJOR}")
|
||||
+target_compile_options(onnxruntime PRIVATE -fvisibility=hidden)
|
||||
+target_compile_options(onnxruntime PRIVATE -fvisibility=default)
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -1,45 +1,103 @@
|
|||
# Copyright (C) 2023, Digi International Inc.
|
||||
# Copyright (C) 2023-2024, Digi International Inc.
|
||||
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
|
||||
|
||||
PV = "1.14.0+git${SRCPV}"
|
||||
|
||||
SRCREV = "6ccaeddefa65ccac402a47fa4d9cad8229794bb2"
|
||||
SRC_URI = "gitsm://github.com/microsoft/onnxruntime.git;branch=rel-1.14.0;protocol=https"
|
||||
SRC_URI += " file://0001-onnxruntime-test-remove-AVX-specific-micro-benchmark.patch "
|
||||
SRC_URI += " file://0002-onnxruntime-add-SONAME-with-MAJOR-version.patch "
|
||||
SRC_URI += " file://0003-onnxruntime-test-libcustom-library-remove-relative.patch "
|
||||
SRC_URI += " file://0004-onnxruntime-fix-imcompatibility-with-compiler-GCC12.patch "
|
||||
SRC_URI += " file://0005-onnxruntime-avoid-using-unsupported-Eigen-headers.patch "
|
||||
SRC_URI += " file://0007-onnxruntime-cmake-change-visibility-compilation-opti.patch "
|
||||
SRC_URI:append:stm32mp2common = " file://0006-onnxruntime-xnnpack-Fix-mcpu-compiler-build-failure.patch "
|
||||
|
||||
PROTOC_VERSION = "3.20.2"
|
||||
SRC_URI += "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip;name=protoc;subdir=protoc-${PROTOC_VERSION}/"
|
||||
SRC_URI[protoc.sha256sum] = "d97227fd8bc840dcb1cf7332c8339a2d8f0fc381a98b028006e5c9a911d07c2a"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit python3-dir cmake
|
||||
|
||||
DEPENDS:append = "\
|
||||
${PYTHON_PN}-numpy \
|
||||
"
|
||||
|
||||
EXTRA_OECMAKE += " -DPython_NumPy_INCLUDE_DIR="${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include" \
|
||||
-DBENCHMARK_ENABLE_GTEST_TESTS=OFF \
|
||||
-Donnxruntime_USE_XNNPACK=ON \
|
||||
-Donnxruntime_BUILD_UNIT_TESTS=ON \
|
||||
"
|
||||
|
||||
ONNX_TARGET_ARCH:aarch64="${@bb.utils.contains('TUNE_FEATURES', 'cortexa35', 'aarch64', '', d)}"
|
||||
|
||||
do_install() {
|
||||
|
||||
# Install onnxruntime dynamic library
|
||||
install -d ${D}${libdir}
|
||||
install -d ${D}${prefix}/local/bin/${PN}-${PVB}/tools
|
||||
install -d ${D}${prefix}/local/bin/${PN}-${PVB}/unit-tests
|
||||
|
||||
install -m 0644 ${B}/libonnxruntime.so ${D}${libdir}/libonnxruntime.so.${PVB}
|
||||
|
||||
# This shared lib is used by onnxruntime_shared_lib_test and onnxruntime_test_python.py
|
||||
install -m 644 ${B}/libcustom_op_library.so ${D}${libdir}
|
||||
|
||||
# And this one only by onnxruntime_test_python.py
|
||||
install -m 644 ${B}/libtest_execution_provider.so ${D}${libdir}
|
||||
install -m 644 ${B}/libonnxruntime_providers_shared.so ${D}${libdir}/libonnxruntime_providers_shared.so
|
||||
install -m 644 ${B}/onnxruntime_pybind11_state.so ${D}${libdir}/onnxruntime_pybind11_state.so
|
||||
install -m 644 ${B}/libtest_execution_provider.so ${D}${libdir}
|
||||
install -m 644 ${B}/libonnxruntime_providers_shared.so ${D}${libdir}/libonnxruntime_providers_shared.so
|
||||
install -m 644 ${B}/libcustom_op_invalid_library.so ${D}${libdir}/libcustom_op_invalid_library.so
|
||||
install -m 644 ${B}/onnxruntime_pybind11_state.so ${D}${libdir}/onnxruntime_pybind11_state.so
|
||||
|
||||
# Install the symlinks.
|
||||
ln -sf libonnxruntime.so.${PVB} ${D}${libdir}/libonnxruntime.so.${MAJOR}
|
||||
ln -sf libonnxruntime.so.${PVB} ${D}${libdir}/libonnxruntime.so
|
||||
|
||||
# Digi: copy instead of moving to avoid QA errors
|
||||
# Copy the onnx_test_runner executable that was installed in /usr instead of /usr/local.
|
||||
cp ${B}/onnx_test_runner ${D}${prefix}/local/bin/${PN}-${PVB}/tools
|
||||
|
||||
# These are not included in the base installation, so we install them manually.
|
||||
install -m 755 ${B}/onnxruntime_perf_test ${D}${prefix}/local/bin/${PN}-${PVB}/tools
|
||||
install -m 755 ${B}/onnxruntime_test_all ${D}${prefix}/local/bin/${PN}-${PVB}/tools
|
||||
install -m 755 ${B}/onnxruntime_shared_lib_test ${D}${prefix}/local/bin/${PN}-${PVB}/tools
|
||||
install -m 755 ${B}/onnxruntime_api_tests_without_env ${D}${prefix}/local/bin/${PN}-${PVB}/tools
|
||||
install -m 755 ${B}/onnxruntime_global_thread_pools_test ${D}${prefix}/local/bin/${PN}-${PVB}/tools
|
||||
install -m 755 ${B}/onnxruntime_test_python.py ${D}${prefix}/local/bin/${PN}-${PVB}/tools
|
||||
install -m 755 ${B}/helper.py ${D}${prefix}/local/bin/${PN}-${PVB}/tools
|
||||
cp -r ${B}/testdata ${D}${prefix}/local/bin/${PN}-${PVB}/tools
|
||||
install -m 755 ${B}/onnx_test_runner ${D}${prefix}/local/bin/${PN}-${PVB}/unit-tests
|
||||
install -m 755 ${B}/onnxruntime_perf_test ${D}${prefix}/local/bin/${PN}-${PVB}/tools
|
||||
install -m 755 ${B}/onnxruntime_test_all ${D}${prefix}/local/bin/${PN}-${PVB}/unit-tests
|
||||
install -m 755 ${B}/onnxruntime_shared_lib_test ${D}${prefix}/local/bin/${PN}-${PVB}/unit-tests
|
||||
install -m 755 ${B}/onnxruntime_api_tests_without_env ${D}${prefix}/local/bin/${PN}-${PVB}/unit-tests
|
||||
install -m 755 ${B}/onnxruntime_global_thread_pools_test ${D}${prefix}/local/bin/${PN}-${PVB}/unit-tests
|
||||
install -m 755 ${B}/onnxruntime_test_python.py ${D}${prefix}/local/bin/${PN}-${PVB}/unit-tests
|
||||
install -m 755 ${B}/helper.py ${D}${prefix}/local/bin/${PN}-${PVB}/unit-tests
|
||||
cp -r ${B}/testdata ${D}${prefix}/local/bin/${PN}-${PVB}/unit-tests
|
||||
|
||||
# We have to change some of the RPATH as well.
|
||||
chrpath -r '$ORIGIN' ${D}${prefix}/local/bin/${PN}-${PVB}/tools/onnxruntime_perf_test
|
||||
chrpath -r '$ORIGIN' ${D}${prefix}/local/bin/${PN}-${PVB}/tools/onnxruntime_shared_lib_test
|
||||
chrpath -r '$ORIGIN' ${D}${prefix}/local/bin/${PN}-${PVB}/tools/onnxruntime_api_tests_without_env
|
||||
chrpath -r '$ORIGIN' ${D}${prefix}/local/bin/${PN}-${PVB}/tools/onnxruntime_global_thread_pools_test
|
||||
chrpath -r '$ORIGIN' ${D}${prefix}/local/bin/${PN}-${PVB}/unit-tests/onnxruntime_shared_lib_test
|
||||
chrpath -r '$ORIGIN' ${D}${prefix}/local/bin/${PN}-${PVB}/unit-tests/onnxruntime_api_tests_without_env
|
||||
chrpath -r '$ORIGIN' ${D}${prefix}/local/bin/${PN}-${PVB}/unit-tests/onnxruntime_global_thread_pools_test
|
||||
chrpath -r '$ORIGIN' ${D}${libdir}/libtest_execution_provider.so
|
||||
|
||||
# Install the Python package.
|
||||
mkdir -p ${D}${PYTHON_SITEPACKAGES_DIR}/onnxruntime
|
||||
cp -r ${B}/onnxruntime ${D}${PYTHON_SITEPACKAGES_DIR}
|
||||
|
||||
# Install header files
|
||||
install -d ${D}${includedir}/onnxruntime
|
||||
cd ${S}/onnxruntime
|
||||
cp --parents $(find . -name "*.h*" -not -path "*cmake_build/*") ${D}${includedir}/onnxruntime
|
||||
cp ${S}/include/onnxruntime/core/session/onnxruntime_cxx_api.h ${D}${includedir}/onnxruntime
|
||||
cp ${S}/include/onnxruntime/core/session/onnxruntime_c_api.h ${D}${includedir}/onnxruntime
|
||||
cp ${S}/include/onnxruntime/core/session/onnxruntime_cxx_inline.h ${D}${includedir}/onnxruntime
|
||||
}
|
||||
|
||||
# The package_qa() task does not like the fact that this library is present in both onnxruntime-tools
|
||||
# and python3-onnxruntime packages (the normal /usr/lib version and a copy placed inside the Python package).
|
||||
# So we simply mark the lib as a "private lib", to prevent the task from outputting an error.
|
||||
PRIVATE_LIBS = "libonnxruntime_providers_shared.so"
|
||||
|
||||
PACKAGES += "${PN}-unit-tests"
|
||||
PROVIDES += "${PN}-unit-tests"
|
||||
|
||||
FILES:${PN}-tools = "${prefix}/local/bin/${PN}-${PVB}/tools/onnxruntime_perf_test"
|
||||
FILES:${PN}-unit-tests = "${prefix}/local/bin/${PN}-${PVB}/unit-tests/* ${libdir}/libcustom_op_invalid_library.so ${libdir}/libtest_execution_provider.so ${libdir}/libcustom_op_library.so"
|
||||
|
||||
# onnxruntime_test_python.py unitary test requires python3-numpy and python3-onnxruntime packages
|
||||
RDEPENDS:${PN}-unit-tests += "${PYTHON_PN}-${PN}"
|
||||
RDEPENDS:${PYTHON_PN}-${PN} += "${PYTHON_PN}-numpy"
|
||||
|
|
|
|||
Loading…
Reference in New Issue