summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2024-02-03 09:01:59 +0000
committerCoprDistGit <infra@openeuler.org>2024-02-03 09:01:59 +0000
commit67450a21ec7698b9969b62a7653161a813ea6659 (patch)
tree8118eb975b9aea24215cbec2ffc55c18d5852615
parent2e6205e7c427a3e0f79b954360d5309981308ecd (diff)
automatic import of onnxruntime
-rw-r--r--0001-remove-nsync.patch17
-rw-r--r--0001-versioned-onnxruntime-providers_shared.patch24
-rw-r--r--0001-versioned-onnxruntime_providers_shared.patch24
-rw-r--r--0002-remove-nsync.patch25
-rw-r--r--onnxruntime.spec43
5 files changed, 62 insertions, 71 deletions
diff --git a/0001-remove-nsync.patch b/0001-remove-nsync.patch
index 8bf253c..71af0b8 100644
--- a/0001-remove-nsync.patch
+++ b/0001-remove-nsync.patch
@@ -9,7 +9,8 @@ Subject: [PATCH] remove nsync
cmake/onnxruntime_unittests.cmake | 22 +++++++++----------
include/onnxruntime/core/platform/ort_mutex.h | 20 ++++++++---------
onnxruntime/core/platform/posix/ort_mutex.cc | 6 ++---
- 5 files changed, 28 insertions(+), 28 deletions(-)
+ cmake/onnxruntime_mlas.cmake | 2 +-
+ 6 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 82a4547..eaebef8 100644
@@ -216,6 +217,20 @@ index e124ce1..5397793 100644
-} // namespace onnxruntime
\ No newline at end of file
+} // namespace onnxruntime
+
+diff --git a/cmake/onnxruntime_mlas.cmake b/cmake/onnxruntime_mlas.cmake
+index e0ccc50..279d63d 100644
+--- a/cmake/onnxruntime_mlas.cmake
++++ b/cmake/onnxruntime_mlas.cmake
+@@ -611,7 +611,7 @@ if (NOT onnxruntime_ORT_MINIMAL_BUILD)
+ if (CPUINFO_SUPPORTED AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
+ target_link_libraries(onnxruntime_mlas_q4dq PRIVATE cpuinfo)
+ endif()
+- if(NOT WIN32)
++ if (FALSE AND NOT WIN32)
+ target_link_libraries(onnxruntime_mlas_q4dq PRIVATE nsync::nsync_cpp ${CMAKE_DL_LIBS})
+ endif()
+ if (CMAKE_SYSTEM_NAME STREQUAL "Android")
--
2.41.0
diff --git a/0001-versioned-onnxruntime-providers_shared.patch b/0001-versioned-onnxruntime-providers_shared.patch
new file mode 100644
index 0000000..3de85d6
--- /dev/null
+++ b/0001-versioned-onnxruntime-providers_shared.patch
@@ -0,0 +1,24 @@
+From 101625d62e2ce263ae3c2c8291a3925ada4ed8f0 Mon Sep 17 00:00:00 2001
+From: binsz <274620705z@gmail.com>
+Date: Sat, 3 Feb 2024 16:36:34 +0800
+Subject: [PATCH] versioned onnxruntime providers_shared
+
+---
+ cmake/onnxruntime_providers.cmake | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/cmake/onnxruntime_providers.cmake b/cmake/onnxruntime_providers.cmake
+index ac1fb4c..0363640 100644
+--- a/cmake/onnxruntime_providers.cmake
++++ b/cmake/onnxruntime_providers.cmake
+@@ -338,6 +338,7 @@ if (NOT onnxruntime_MINIMAL_BUILD AND NOT onnxruntime_EXTENDED_MINIMAL_BUILD
+ onnxruntime_add_shared_library(onnxruntime_providers_shared ${onnxruntime_providers_shared_cc_srcs} "${ONNXRUNTIME_ROOT}/core/dll/onnxruntime.rc")
+ set_target_properties(onnxruntime_providers_shared PROPERTIES FOLDER "ONNXRuntime")
+ set_target_properties(onnxruntime_providers_shared PROPERTIES LINKER_LANGUAGE CXX)
++ set_target_properties(onnxruntime_providers_shared PROPERTIES VERSION ${ORT_VERSION})
+
+ target_compile_definitions(onnxruntime_providers_shared PRIVATE VER_MAJOR=${VERSION_MAJOR_PART})
+ target_compile_definitions(onnxruntime_providers_shared PRIVATE VER_MINOR=${VERSION_MINOR_PART})
+--
+2.41.0
+
diff --git a/0001-versioned-onnxruntime_providers_shared.patch b/0001-versioned-onnxruntime_providers_shared.patch
deleted file mode 100644
index 21a44e6..0000000
--- a/0001-versioned-onnxruntime_providers_shared.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From 82ecf405121b4bccd75e99c913214ca695726eaa Mon Sep 17 00:00:00 2001
-From: binsz <274620705z@gmail.com>
-Date: Wed, 31 Jan 2024 13:25:01 +0800
-Subject: [PATCH] versioned-onnxruntime_providers_shared
-
----
- cmake/onnxruntime_providers.cmake | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/cmake/onnxruntime_providers.cmake b/cmake/onnxruntime_providers.cmake
-index 03360ff..ac1fb4c 100644
---- a/cmake/onnxruntime_providers.cmake
-+++ b/cmake/onnxruntime_providers.cmake
-@@ -634,6 +634,7 @@ if (onnxruntime_USE_DNNL)
- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/)
- set_target_properties(onnxruntime_providers_dnnl PROPERTIES FOLDER "ONNXRuntime")
- set_target_properties(onnxruntime_providers_dnnl PROPERTIES LINKER_LANGUAGE CXX)
-+ set_target_properties(onnxruntime_providers_shared PROPERTIES VERSION ${ORT_VERSION})
-
- # Needed for the provider interface, as it includes training headers when training is enabled
- if (onnxruntime_ENABLE_TRAINING_OPS)
---
-2.41.0
-
diff --git a/0002-remove-nsync.patch b/0002-remove-nsync.patch
deleted file mode 100644
index 3c53fa1..0000000
--- a/0002-remove-nsync.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From c285edeb9c5f8af7893fd4fd08dc803f33bafd3a Mon Sep 17 00:00:00 2001
-From: binsz <274620705z@gmail.com>
-Date: Tue, 30 Jan 2024 23:37:42 +0800
-Subject: [PATCH] remove nsync
-
----
- cmake/onnxruntime_mlas.cmake | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/cmake/onnxruntime_mlas.cmake b/cmake/onnxruntime_mlas.cmake
-index e0ccc50..279d63d 100644
---- a/cmake/onnxruntime_mlas.cmake
-+++ b/cmake/onnxruntime_mlas.cmake
-@@ -611,7 +611,7 @@ if (NOT onnxruntime_ORT_MINIMAL_BUILD)
- if (CPUINFO_SUPPORTED AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
- target_link_libraries(onnxruntime_mlas_q4dq PRIVATE cpuinfo)
- endif()
-- if(NOT WIN32)
-+ if (FALSE AND NOT WIN32)
- target_link_libraries(onnxruntime_mlas_q4dq PRIVATE nsync::nsync_cpp ${CMAKE_DL_LIBS})
- endif()
- if (CMAKE_SYSTEM_NAME STREQUAL "Android")
---
-2.41.0
-
diff --git a/onnxruntime.spec b/onnxruntime.spec
index f21b9d9..811c10a 100644
--- a/onnxruntime.spec
+++ b/onnxruntime.spec
@@ -16,11 +16,10 @@ Patch2: 0001-use-system-cpuinfo.patch
Patch3: 0001-use-system-protobuf.patch
Patch4: 0001-use-system-python.patch
Patch5: 0001-remove-nsync.patch
-Patch6: 0002-remove-nsync.patch
-Patch7: 0001-fix-forward-decl-flatbuffers.patch
-Patch8: 0001-add-onnxruntime_INSTALL_UNIT_TESTS-option.patch
-Patch9: 0001-gcc-false-positive.patch
-Patch10: 0001-versioned-onnxruntime_providers_shared.patch
+Patch6: 0001-fix-forward-decl-flatbuffers.patch
+Patch7: 0001-add-onnxruntime_INSTALL_UNIT_TESTS-option.patch
+Patch8: 0001-gcc-false-positive.patch
+Patch9: 0001-versioned-onnxruntime-providers_shared.patch
BuildRequires: python3-devel
BuildRequires: python3-setuptools
@@ -90,6 +89,7 @@ rm -v onnxruntime/test/optimizer/nhwc_transformer_test.cc
# all together into a single shared library when onnxruntime_BUILD_SHARED_LIB is ON.
# The array-bounds and dangling-reference checks have false positives.
%cmake \
+ %_cmake_skip_rpath \
-DCMAKE_INSTALL_LIBDIR=%{_lib} \
-DCMAKE_INSTALL_INCLUDEDIR=%{_includedir} \
-Donnxruntime_BUILD_SHARED_LIB=ON \
@@ -113,45 +113,46 @@ mv ./onnxruntime ./onnxruntime.src
cp -R %{__cmake_build_dir}/onnxruntime ./onnxruntime
cp %{__cmake_build_dir}/requirements.txt ./requirements.txt
-#mkdir -p %{buildroot}/.python_wheel
-#CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" TMPDIR="%{buildroot}/.pyproject-builddir" \
-# %{__python3} -m pip wheel --no-deps --use-pep517 --no-build-isolation --disable-pip-version-check \
-# --no-clean --progress-bar off --verbose \
-# --wheel-dir "%{buildroot}/pyproject-wheeldir"
%pyproject_build
%install
DESTDIR="%{buildroot}" %{__cmake} --install "%{__cmake_build_dir}"
+find %{__cmake_build_dir}/ -name "*.so" -exec cp {} "%{buildroot}/%{_libdir}" \;
+
mkdir -p "%{buildroot}/%{_docdir}/"
cp --preserve=timestamps -r "./docs/" "%{buildroot}/%{_docdir}/%{name}"
-# /usr/bin/python3 -m pip install --root /builddir/build/BUILDROOT/onnxruntime-1.16.3-1.x86_64 \
-# --prefix /usr --no-deps --disable-pip-version-check --progress-bar off --verbose \
-# --ignore-installed --no-warn-script-location --no-index --no-cache-dir \
-# --find-links /builddir/build/BUILD/%{name}-%{version}/build \
-# %{name}==%{version}
+
%pyproject_install
-# %pyproject_save_files onnxruntime
+
%check
export GTEST_FILTER=-CApiTensorTest.load_huge_tensor_with_external_data
-export LT_SYS_LIBRARY_PATH=/usr/lib64
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{buildroot}/usr/lib64/
/usr/bin/ctest --test-dir "%{__cmake_build_dir}" --output-on-failure --force-new-ctest-process %{?_smp_mflags}
-# %ctest
%files
%license LICENSE
%doc ThirdPartyNotices.txt
+%{_libdir}/libonnx.so
+%{_libdir}/libonnx_proto.so
%{_libdir}/libonnxruntime.so.%{version}
%{_libdir}/libonnxruntime_providers_shared.so.%{version}
%files devel
%dir %{_includedir}/onnxruntime/
%{_includedir}/onnxruntime/*
-%{_libdir}/libonnxruntime.so
-%{_libdir}/libonnxruntime_providers_shared.so
+%{_libdir}/cmake
+%{_libdir}/*.so*
+# %{_libdir}/libgmock.so.*
+# %{_libdir}/libgtest.so.*
+# %{_libdir}/libonnx_proto.so
+# %{_libdir}/libonnx.so
+# %{_libdir}/libonnxruntime.so
+# %{_libdir}/libonnxruntime_providers_shared.so
%{_libdir}/pkgconfig/libonnxruntime.pc
-%files -n python3-onnxruntime -f %{pyproject_files}
+%files -n python3-onnxruntime
+%{_libdir}/python3.11/site-packages/*
%{_bindir}/onnxruntime_test
%files doc