summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Ulyanov <disinbox@gmail.com>2023-02-19 18:41:16 +0300
committerIgor Ulyanov <disinbox@gmail.com>2023-02-19 18:42:11 +0300
commit5d81a10fbf0f11c8c6b08e372be4e3c66f609a29 (patch)
tree4897e1207904293d08c8ab2019fbfda6ba151158
parentold ebuilds removed (diff)
downloaddisplacer-5d81a10fbf0f11c8c6b08e372be4e3c66f609a29.tar.gz
displacer-5d81a10fbf0f11c8c6b08e372be4e3c66f609a29.tar.bz2
displacer-5d81a10fbf0f11c8c6b08e372be4e3c66f609a29.zip
onnxruntime added with repeatediterator patch
Signed-off-by: Igor Ulyanov <disinbox@gmail.com>
-rw-r--r--sci-libs/onnxruntime/Manifest12
-rw-r--r--sci-libs/onnxruntime/files/onnxruntime-1.9.1-fix-RepeatedIterator-compile-error.patch25
-rw-r--r--sci-libs/onnxruntime/files/onnxruntime-1.9.1-system_libs.patch92
-rw-r--r--sci-libs/onnxruntime/onnxruntime-1.9.1.ebuild97
4 files changed, 226 insertions, 0 deletions
diff --git a/sci-libs/onnxruntime/Manifest b/sci-libs/onnxruntime/Manifest
new file mode 100644
index 0000000..be3964f
--- /dev/null
+++ b/sci-libs/onnxruntime/Manifest
@@ -0,0 +1,12 @@
+AUX onnxruntime-1.9.1-fix-RepeatedIterator-compile-error.patch 1356 BLAKE2B 28f8c64f1092954b36726cd5550e3db9ce84aebfe158ed987b5e31104ae73c38c59a6e94d8fdaf15ca08ce186df3fae1e0f0e9c13c3d68ea45c8d9953d6218ab SHA512 97e59b8ce0ea217b77ffdac9167c7565fc6f72c6db1bbd68e71e5b3bdc616056c4abd0aa323e36b03f065202605ede0502e3ad112c5d092e1c1b707463817f5e
+AUX onnxruntime-1.9.1-system_libs.patch 3196 BLAKE2B b9107002944c53daaa9ac7da7daad84366f4e3ddfec6d7af677f960fc9cb95a8370dcd109c3942ab259e9193a93985514df653f10d5e6d66b993a3a9cb938396 SHA512 5b739446c8adc0dec6442577f6fbaca57a2c0f0acce83ae20a96cf3d12218118dbc318c979b69f03aeb21b02c8b02b1c64efb2c17bfc00d846698aa5af3494a4
+DIST SafeInt-a104e0cf23.tar.gz 541952 BLAKE2B 6a7d025dce9aae6090704783aef4d1e71298c6e99af1d322f2ecf6c1504bf1c0c38140255f77b6f178fe23edb61b23a633b191c1b7d2b736692ba33a27916843 SHA512 95a0784e0d79e1a712e454475d1863732b5cf03abd83687e84fc9f1b993ecf0d47a3a252cd5b86a2baea3c194406c8b4678d6d6f8d86e89a18602270ddee18b9
+DIST boost_mp11-21cace4e574.tar.gz 104182 BLAKE2B 9c4c103cab0a6d738a38bc0afd7752233592f47b55434de4af15f927f1b2711ca5fc47e8a2edb5e2991e9d554ae7303dd19a0386109b470f052089b25df79101 SHA512 82b32466c2287f87b16b3244793dac6eb1a34c52f3ebabf5a19f1f2527253e14f23349290e5ba9b5171503e2392debc7e1e4c75ce5fa0c7c9778afe658984423
+DIST flatbuffers-1.12.0.tar.gz 1145348 BLAKE2B 441123be124ad851efa30bda0d828a764ebaf79ba6692a6e5904000b33818e9de78c3a964037ac93ef562890980c58169141e55354dce86857c02bcd917150d6 SHA512 8a0b88d739fa4694a69d3630140fe89fdd70d50bba4dadd1758d9aa2920cda16700bcafb8d89fe2a09ac907d3f378240c3cb4abc7106318136799836aba4b063
+DIST onnx-1f63dcb7fc.tar.gz 9407541 BLAKE2B 6e701385a1c24c3f8f69427368ed79b3b190358a6496a1c45d59f096487edce893d567c934a768f1b64b65004baea9202266ac0d2fcd6a898cec3d4fcb0e333d SHA512 d42680f663951aa5168ee7cd5cfc59b67bf1831da3eadc400d360a2a9e2562d993467afadf2d8389a26c9b71f33faf7e18c20200ee846ece96ccca0c919986aa
+DIST onnxruntime-1.14.0.tar.gz 199507980 BLAKE2B 2a559c1be54f3c8a6cdec3b31e8847c23c32c30083da7699f429a7b6ecb2b8d4be7c9df87814f69bde3c5bfedd987733c6794835a15c93d397c1c09f72b6b029 SHA512 b250bea82fdfb99807c72c52a141df16ed9885b4e05bf1b64992537583c93a3eb85b5b3668296b4229b37ebdea41e30a97dcea3f58f651252467fc7e8e9caf76
+DIST onnxruntime-1.9.1.tar.gz 290241910 BLAKE2B c0bbd2f987978f1d995c652904a79af32b520a2160e486cdb4b002ae00f730f511d827998a2d9da32fc6582d7ced7ab6f712b60ee2ce94a6bdd640d3a8a9d693 SHA512 66c4bff4c4f633885ba7d0601337d0f16c0eeef7e3c1f492f2d21f27f06f748260e28105083b5defbebf624f4f26dc59355de7e3e0ef81c6c27b01b936a98ce9
+DIST optional-lite-4acf4553ba.tar.gz 48384 BLAKE2B 63c310bb115310df95a3a95fd917b2c9c0dd91533aec06390a285d923f8b80f1f6a9322fae6837d2bcc933e5b0261ea1262157f177960a47fad48fa4a0135aa9 SHA512 f3ab8dc3b6705ebd201943cbcdce5cf5c75b1ced317561890d74be351e707b65db4a6b3bce6bef91f94d28c68715e58be9c7b522adec93c1acbb31ceb8fc0447
+DIST pytorch-cpuinfo-5916273f79.tar.gz 3496223 BLAKE2B 4da452faf12138fbc1abd266d8ae6e0a0192f48a84faccb55fd05c3ac85d0bea2ecbd80b5eda69bb51c6704a223f90dd83d1f0fc79d56d35dd21cae5c5b8fab5 SHA512 50e537b61d991e8579577fb1ecf8d9ceb2171dbad96dfe159a062eadfdc0b2372b94988fc6f223c20e327453c7f55042ee06779f5b5fe0922f4470f746c9686b
+EBUILD onnxruntime-1.14.0.ebuild 2308 BLAKE2B f2eb8bd3eb866288c2f6369487a7e765ffe2bf718879856892b8fb57752cbbb71ff98bf1fad465b65ab473e8bb9abfffd0bddbda2441e88ba195056b1d395c82 SHA512 917297f36e05512756fd6f13f54ec0a413709585413320c9e6a26428a886c3c5935d8a91d3823109858392cd9173b3f72bd83a89f6453d3c83d0bc0bef2099e6
+EBUILD onnxruntime-1.9.1.ebuild 3202 BLAKE2B 979fe6931e88341ec468ad7a253b20c73f39eb6e04f80faa4156d4de62ed47b6b8c9cfe9ce25f0ec6d1621de99e736f344c95ad2356589f450d99ed894e1c81f SHA512 04152aaa6768dadc791bd1d6a3c0f7cd74ffb020f8a99796380d3b8b9ba14cb2a565774bcae80efa0f41f2c2f7d41b13c695760becf91e1f72cfded364f05076
diff --git a/sci-libs/onnxruntime/files/onnxruntime-1.9.1-fix-RepeatedIterator-compile-error.patch b/sci-libs/onnxruntime/files/onnxruntime-1.9.1-fix-RepeatedIterator-compile-error.patch
new file mode 100644
index 0000000..95fd603
--- /dev/null
+++ b/sci-libs/onnxruntime/files/onnxruntime-1.9.1-fix-RepeatedIterator-compile-error.patch
@@ -0,0 +1,25 @@
+From 35ff9ccba664d3d1f369163f9778739c6c36aab1 Mon Sep 17 00:00:00 2001
+From: Igor Ulyanov <disinbox@gmail.com>
+Date: Sat, 18 Feb 2023 21:13:37 +0300
+Subject: [PATCH] fix RepeatedIterator compile error
+
+---
+ onnxruntime/core/framework/tensorprotoutils.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/onnxruntime/core/framework/tensorprotoutils.cc b/onnxruntime/core/framework/tensorprotoutils.cc
+index ce23ae1de5..1472e430f5 100644
+--- a/onnxruntime-1.9.1/onnxruntime/core/framework/tensorprotoutils.cc
++++ b/onnxruntime-1.9.1/onnxruntime/core/framework/tensorprotoutils.cc
+@@ -256,7 +256,7 @@ Status UnpackTensor(const ONNX_NAMESPACE::TensorProto& tensor, const void* raw_d
+ ") does not match the data size(", tensor.field_size(), ") in proto"); \
+ auto& data = tensor.field_name(); \
+ for (auto data_iter = data.cbegin(); data_iter != data.cend(); ++data_iter) \
+- *p_data++ = *reinterpret_cast<const T*>(data_iter); \
++ *p_data++ = *(data_iter); \
+ return Status::OK(); \
+ }
+
+--
+2.39.1
+
diff --git a/sci-libs/onnxruntime/files/onnxruntime-1.9.1-system_libs.patch b/sci-libs/onnxruntime/files/onnxruntime-1.9.1-system_libs.patch
new file mode 100644
index 0000000..669eb18
--- /dev/null
+++ b/sci-libs/onnxruntime/files/onnxruntime-1.9.1-system_libs.patch
@@ -0,0 +1,92 @@
+diff --git a/CMakeLists.txt.old b/CMakeLists.txt
+index 2534b99..d144047 100644
+--- a/CMakeLists.txt.old
++++ b/CMakeLists.txt
+@@ -540,7 +540,7 @@ if (MSVC)
+ set(CMAKE_ASM_MASM_FLAGS "${CMAKE_ASM_MASM_FLAGS} /safeseh")
+ endif()
+ endif()
+-
++
+
+ #Always enable exception handling, even for Windows ARM
+ if(NOT onnxruntime_DISABLE_EXCEPTIONS)
+@@ -833,7 +833,13 @@ get_filename_component(ORTTRAINING_ROOT "${ORTTRAINING_ROOT}" ABSOLUTE)
+ get_filename_component(REPO_ROOT "${REPO_ROOT}" ABSOLUTE)
+ set(ONNXRUNTIME_INCLUDE_DIR ${REPO_ROOT}/include/onnxruntime)
+
+-add_subdirectory(external/date EXCLUDE_FROM_ALL)
++if(onnxruntime_PREFER_SYSTEM_LIB)
++ find_package(date REQUIRED)
++ add_library(date_interface ALIAS date::date)
++endif()
++if(NOT TARGET date::date)
++ add_subdirectory(external/date EXCLUDE_FROM_ALL)
++endif()
+
+ set(SAFEINT_INCLUDE_DIR ${REPO_ROOT}/cmake/external/SafeInt)
+ add_library(safeint_interface INTERFACE)
+@@ -844,16 +850,33 @@ if(onnxruntime_DISABLE_EXCEPTIONS)
+ add_compile_definitions(optional_CONFIG_NO_EXCEPTIONS=1)
+ endif()
+
+-add_subdirectory(external/mp11 EXCLUDE_FROM_ALL)
++if(onnxruntime_PREFER_SYSTEM_LIB)
++ find_package(boost_mp11)
++endif()
++if(NOT TARGET Boost::mp11)
++ add_subdirectory(external/mp11 EXCLUDE_FROM_ALL)
++endif()
+
+-set(JSON_BuildTests OFF CACHE INTERNAL "")
+-set(JSON_Install OFF CACHE INTERNAL "")
+-add_subdirectory(external/json EXCLUDE_FROM_ALL)
++if(onnxruntime_PREFER_SYSTEM_LIB)
++ find_package(nlohmann_json REQUIRED)
++endif()
++if(NOT TARGET nlohmann_json::nlohmann_json)
++ set(JSON_BuildTests OFF CACHE INTERNAL "")
++ set(JSON_Install OFF CACHE INTERNAL "")
++ add_subdirectory(external/json EXCLUDE_FROM_ALL)
++endif()
+
++find_package(PkgConfig)
+ if(onnxruntime_PREFER_SYSTEM_LIB)
+- find_package(re2)
++ pkg_check_modules(RE2 re2)
+ endif()
+-if(NOT TARGET re2::re2)
++if(RE2_FOUND)
++ add_library(re2::re2 INTERFACE IMPORTED)
++ set_target_properties(re2::re2 PROPERTIES
++ INTERFACE_COMPILE_OPTIONS "${RE2_CFLAGS}"
++ INTERFACE_LINK_LIBRARIES "${RE2_LDFLAGS}"
++ )
++else()
+ add_subdirectory(external/re2 EXCLUDE_FROM_ALL)
+ set_target_properties(re2 PROPERTIES FOLDER "External/re2")
+ set(RE2_INCLUDE_DIR ${REPO_ROOT}/cmake/external/re2)
+@@ -885,12 +908,12 @@ else()
+ elseif(WINDOWS_STORE OR (WIN32 AND NOT CMAKE_CXX_STANDARD_LIBRARIES MATCHES kernel32.lib))
+ message(WARNING "Cpuinfo not included in Windows Store or WCOS builds")
+ set(CPUINFO_SUPPORTED FALSE)
+- endif()
++ endif()
+ elseif(NOT ${onnxruntime_target_platform} MATCHES "^(i[3-6]86|AMD64|x86(_64)?|armv[5-8].*|aarch64|arm64)$")
+ message(WARNING
+ "Target processor architecture \"${onnxruntime_target_platform}\" is not supported in cpuinfo. "
+ "cpuinfo not included.")
+- set(CPUINFO_SUPPORTED FALSE)
++ set(CPUINFO_SUPPORTED FALSE)
+ endif()
+ endif()
+
+@@ -907,7 +930,7 @@ if(CPUINFO_SUPPORTED)
+ set(IOS ON CACHE INTERNAL "")
+ set(IOS_ARCH "${CMAKE_OSX_ARCHITECTURES}" CACHE INTERNAL "")
+ endif()
+-
++
+ string(APPEND CMAKE_CXX_FLAGS " -DCPUINFO_SUPPORTED")
+ add_subdirectory(external/pytorch_cpuinfo EXCLUDE_FROM_ALL)
+ if(MSVC)
diff --git a/sci-libs/onnxruntime/onnxruntime-1.9.1.ebuild b/sci-libs/onnxruntime/onnxruntime-1.9.1.ebuild
new file mode 100644
index 0000000..2bbde3b
--- /dev/null
+++ b/sci-libs/onnxruntime/onnxruntime-1.9.1.ebuild
@@ -0,0 +1,97 @@
+# Copyright 2021 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit cmake
+
+CPUINFO_COMMIT=5916273f79a21551890fd3d56fc5375a78d1598d
+ONNX_COMMIT=1f63dcb7fcc3a8bf5c3c8e326867ecd6f5c43f35
+MP11_COMMIT=21cace4e574180ba64d9307a5e4ea9e5e94d3e8d
+OPTIONAL_LITE_COMMIT=4acf4553baa886e10e6613fe1452b706b0250e78
+SAFEINT_COMMIT=a104e0cf23be4fe848f7ef1f3e8996fe429b06bb
+FLATBUFFERS_PV=1.12.0
+
+DESCRIPTION="cross-platform, high performance ML inferencing and training accelerator"
+HOMEPAGE="https://github.com/microsoft/onnxruntime"
+SRC_URI="
+ https://github.com/microsoft/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
+ https://github.com/pytorch/cpuinfo/archive/${CPUINFO_COMMIT}.tar.gz -> pytorch-cpuinfo-${CPUINFO_COMMIT:0:10}.tar.gz
+ https://github.com/onnx/onnx/archive/${ONNX_COMMIT}.tar.gz -> onnx-${ONNX_COMMIT:0:10}.tar.gz
+ https://github.com/boostorg/mp11/archive/${MP11_COMMIT}.tar.gz -> boost_mp11-${MP11_COMMIT:0:11}.tar.gz
+ https://github.com/google/flatbuffers/archive/v${FLATBUFFERS_PV}.tar.gz -> flatbuffers-${FLATBUFFERS_PV}.tar.gz
+ https://github.com/martinmoene/optional-lite/archive/${OPTIONAL_LITE_COMMIT}.tar.gz -> optional-lite-${OPTIONAL_LITE_COMMIT:0:10}.tar.gz
+ https://github.com/dcleblanc/SafeInt/archive/${SAFEINT_COMMIT}.tar.gz -> SafeInt-${SAFEINT_COMMIT:0:10}.tar.gz
+"
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="benchmark test"
+
+# libonnxruntime_framework.so: undefined reference to `onnx::AttributeProto_AttributeType_Name[abi:cxx11](onnx::AttributeProto_AttributeType)'
+RESTRICT="test"
+
+S="${WORKDIR}/${P}/cmake"
+
+# Needs https://gitlab.com/libeigen/eigen/-/commit/d0e3791b1a0e2db9edd5f1d1befdb2ac5a40efe0.patch on eigen-3.4.0
+RDEPEND="
+ dev-python/numpy
+ dev-libs/date:=
+ >=dev-libs/boost-1.66:=
+ dev-libs/protobuf:=
+ dev-libs/re2:=
+ dev-libs/flatbuffers:=
+ dev-cpp/nlohmann_json:=
+ dev-libs/nsync
+ dev-cpp/eigen:3
+ benchmark? ( dev-cpp/benchmark )
+"
+DEPEND="
+ ${RDEPEND}
+ test? ( dev-cpp/gtest )
+"
+
+PATCHES=(
+ "${FILESDIR}/${P}-system_libs.patch"
+)
+
+src_unpack() {
+ if [[ -n ${A} ]]; then
+ unpack ${A}
+ fi
+ eapply "${FILESDIR}/${P}-fix-RepeatedIterator-compile-error.patch"
+}
+
+src_prepare() {
+ cmake_src_prepare
+
+ rm -r "${S}/external/pytorch_cpuinfo" || die
+ mv "${WORKDIR}/cpuinfo-${CPUINFO_COMMIT}" "${S}/external/pytorch_cpuinfo" || die
+
+ rm -r "${S}/external/onnx" || die
+ mv "${WORKDIR}/onnx-${ONNX_COMMIT}" "${S}/external/onnx" || die
+
+ rm -r "${S}/external/mp11" || die
+ mv "${WORKDIR}/mp11-${MP11_COMMIT}" "${S}/external/mp11" || die
+
+ rm -r "${S}/external/flatbuffers" || die
+ mv "${WORKDIR}/flatbuffers-${FLATBUFFERS_PV}" "${S}/external/flatbuffers" || die
+
+ rm -r "${S}/external/optional-lite" || die
+ mv "${WORKDIR}/optional-lite-${OPTIONAL_LITE_COMMIT}" "${S}/external/optional-lite" || die
+
+ rm -r "${S}/external/SafeInt/safeint" || die
+ mv "${WORKDIR}/SafeInt-${SAFEINT_COMMIT}" "${S}/external/SafeInt/safeint" || die
+}
+
+src_configure() {
+ append-cppflags "-I/usr/include/eigen3"
+
+ local mycmakeargs=(
+ -Donnxruntime_PREFER_SYSTEM_LIB=ON
+ -Donnxruntime_BUILD_BENCHMARKS=$(usex benchmark)
+ -Donnxruntime_BUILD_UNIT_TESTS=$(usex test)
+ )
+
+ cmake_src_configure
+}