From 5907232d431970d3dd87c7c29e97da6e30173812 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Thu, 9 Nov 2023 16:11:25 +0000 Subject: [PATCH 1/4] Build onnxruntime 1.16.2 --- build-dependencies/vespa-build-dependencies.spec.tmpl | 6 +++--- onnxruntime-build-cuda/.copr/Makefile | 6 +++--- onnxruntime/.copr/Makefile | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build-dependencies/vespa-build-dependencies.spec.tmpl b/build-dependencies/vespa-build-dependencies.spec.tmpl index 8099354..1e0527c 100644 --- a/build-dependencies/vespa-build-dependencies.spec.tmpl +++ b/build-dependencies/vespa-build-dependencies.spec.tmpl @@ -45,7 +45,7 @@ Requires: vespa-openblas-devel >= 0.3.21 Requires: vespa-openssl-devel >= 3.1.2 Requires: vespa-gtest = 1.13.0 Requires: vespa-lz4-devel >= 1.9.4-1 -Requires: vespa-onnxruntime-devel = 1.16.1 +Requires: vespa-onnxruntime-devel = 1.16.2 Requires: vespa-protobuf-devel = 3.21.12 Requires: vespa-toolset-12-meta >= 12.0.1 %endif @@ -66,7 +66,7 @@ Requires: openblas-devel Requires: openssl-devel Requires: vespa-libzstd-devel >= 1.5.4-1 Requires: vespa-lz4-devel >= 1.9.4-1 -Requires: vespa-onnxruntime-devel = 1.16.1 +Requires: vespa-onnxruntime-devel = 1.16.2 Requires: vespa-protobuf-devel = 3.21.12 Requires: vespa-toolset-12-meta >= 12.0.1 %endif @@ -85,7 +85,7 @@ Requires: openblas-devel Requires: openssl-devel Requires: protobuf-devel Requires: vespa-lz4-devel >= 1.9.4-1 -Requires: vespa-onnxruntime-devel = 1.16.1 +Requires: vespa-onnxruntime-devel = 1.16.2 Requires: vespa-libzstd-devel >= 1.5.4-1 %endif diff --git a/onnxruntime-build-cuda/.copr/Makefile b/onnxruntime-build-cuda/.copr/Makefile index f712ef3..cd5c162 100644 --- a/onnxruntime-build-cuda/.copr/Makefile +++ b/onnxruntime-build-cuda/.copr/Makefile @@ -3,9 +3,9 @@ TOP = $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) # Version MAJOR=1 -MINOR=13 -PATCH=1 -RELEASE=2 +MINOR=16 +PATCH=2 +RELEASE=1 PKGNAME=vespa-onnxruntime PKGNV=$(PKGNAME)-$(VERSION) diff --git a/onnxruntime/.copr/Makefile b/onnxruntime/.copr/Makefile index 36fa57f..6e37e6c 100644 --- a/onnxruntime/.copr/Makefile +++ b/onnxruntime/.copr/Makefile @@ -4,8 +4,8 @@ TOP = $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) # Version MAJOR=1 MINOR=16 -PATCH=1 -RELEASE=3 +PATCH=2 +RELEASE=1 PKGNAME=vespa-onnxruntime RPMTOPDIR=$(TOP)/rpmbuild From c386b64aa84115da9c37b07b2dd4be755316bb20 Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Thu, 9 Nov 2023 18:30:58 +0000 Subject: [PATCH 2/4] bump patch number here too --- build-dependencies/.copr/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-dependencies/.copr/Makefile b/build-dependencies/.copr/Makefile index b5d61e0..eab998d 100644 --- a/build-dependencies/.copr/Makefile +++ b/build-dependencies/.copr/Makefile @@ -4,7 +4,7 @@ TOP = $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) # Version MAJOR=1 MINOR=2 -PATCH=1 +PATCH=2 RELEASE=1 PKGNAME=vespa-build-dependencies From 9bbb60853083e5b51dba68cd914839b38e045516 Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Thu, 9 Nov 2023 18:31:37 +0000 Subject: [PATCH 3/4] GC old experiment --- onnxruntime-build-cuda/.copr/Makefile | 52 ----- ...ches.use-origin-rpath-for-jni-library.diff | 12 -- .../vespa-onnxruntime.spec.tmpl | 196 ------------------ 3 files changed, 260 deletions(-) delete mode 100644 onnxruntime-build-cuda/.copr/Makefile delete mode 100644 onnxruntime-build-cuda/patches.use-origin-rpath-for-jni-library.diff delete mode 100644 onnxruntime-build-cuda/vespa-onnxruntime.spec.tmpl diff --git a/onnxruntime-build-cuda/.copr/Makefile b/onnxruntime-build-cuda/.copr/Makefile deleted file mode 100644 index cd5c162..0000000 --- a/onnxruntime-build-cuda/.copr/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -TOP = $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) - -# Version -MAJOR=1 -MINOR=16 -PATCH=2 -RELEASE=1 - -PKGNAME=vespa-onnxruntime -PKGNV=$(PKGNAME)-$(VERSION) -RPMTOPDIR=$(TOP)/rpmbuild -SOURCEDIR=$(RPMTOPDIR)/SOURCES -SPECDIR=$(RPMTOPDIR)/SPECS -SPECFILE=$(SPECDIR)/$(PKGNAME).spec -VERSION=$(MAJOR).$(MINOR).$(PATCH) -SRCTMPBASE=$(TOP)/tmp -SRCTMP_VENDOR=$(SRCTMPBASE)/onnxruntime -SRCTMP=$(SRCTMPBASE)/$(PKGNV) - -outdir ?= $(TOP) - -SEDCMD = s/_TMPL_VER_MAJOR/$(MAJOR)/;s/_TMPL_VER_MINOR/$(MINOR)/;s/_TMPL_VER_PATCH/$(PATCH)/;s/_TMPL_VER_RELEASE/$(RELEASE)/ - -srpm: - rpm -q rpmdevtools || dnf install -y rpmdevtools - rpm -q git || dnf install -y git - mkdir -p $(SPECDIR) $(SOURCEDIR) - : rm -rf $(SRCTMPBASE) - mkdir -p $(SRCTMPBASE) - cd $(SRCTMPBASE) && (cd onnxruntime && git fetch -p) || git clone https://github.com/microsoft/onnxruntime.git onnxruntime - cd $(SRCTMP_VENDOR) && git checkout v$(VERSION) -ifdef SUBMODULE_CHECKOUT_SCRIPT - cd $(SRCTMP_VENDOR) && $(SUBMODULE_CHECKOUT_SCRIPT) -else - cd $(SRCTMP_VENDOR) && git submodule sync --recursive - cd $(SRCTMP_VENDOR) && git submodule update --init --recursive -endif - mkdir -p $(SRCTMP) - cd $(SRCTMP_VENDOR) && git archive --format=tar HEAD | tar -C $(SRCTMP) -xf - - set -e; cd $(SRCTMP_VENDOR) && git submodule status --recursive | cut -d ' ' -f 3 | while read sm_path; do mkdir -p $(SRCTMP)/$$sm_path; ( cd $$sm_path && git archive --format=tar HEAD | tar -C $(SRCTMP)/$$sm_path -xf -); done - tar -C $(SRCTMPBASE) -czf $(SOURCEDIR)/$(PKGNV).tar.gz $(PKGNV) - : rm -rf $(SRCTMPBASE) - cat $(PKGNAME).spec.tmpl | sed "$(SEDCMD)" > $(SPECFILE) - cp -a *.diff $(SOURCEDIR) - rpmbuild -bs --define "_topdir $(RPMTOPDIR)" $(SPECFILE) - cp -a $(RPMTOPDIR)/SRPMS/* $(outdir) - -clean: - -rm -rf $(RPMTOPDIR) $(SRCTMPBASE) $(TOP)/*.rpm - -.PHONY: srpm clean diff --git a/onnxruntime-build-cuda/patches.use-origin-rpath-for-jni-library.diff b/onnxruntime-build-cuda/patches.use-origin-rpath-for-jni-library.diff deleted file mode 100644 index ffa1eb9..0000000 --- a/onnxruntime-build-cuda/patches.use-origin-rpath-for-jni-library.diff +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/cmake/onnxruntime_java.cmake b/cmake/onnxruntime_java.cmake -index d7b47f699..542f72b6f 100644 ---- a/cmake/onnxruntime_java.cmake -+++ b/cmake/onnxruntime_java.cmake -@@ -61,6 +61,7 @@ file(GLOB onnxruntime4j_native_src - # Build the JNI library - onnxruntime_add_shared_library_module(onnxruntime4j_jni ${onnxruntime4j_native_src}) - set_property(TARGET onnxruntime4j_jni PROPERTY CXX_STANDARD 11) -+set_target_properties(onnxruntime4j_jni PROPERTIES BUILD_RPATH_USE_ORIGIN TRUE) - - # depend on java sources. if they change, the JNI should recompile - add_dependencies(onnxruntime4j_jni onnxruntime4j) diff --git a/onnxruntime-build-cuda/vespa-onnxruntime.spec.tmpl b/onnxruntime-build-cuda/vespa-onnxruntime.spec.tmpl deleted file mode 100644 index ff08a86..0000000 --- a/onnxruntime-build-cuda/vespa-onnxruntime.spec.tmpl +++ /dev/null @@ -1,196 +0,0 @@ -# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -# Disable build id note requirement for now -%undefine _missing_build_ids_terminate_build - -# Force special prefix for Vespa -%define _prefix /opt/vespa-deps - -# Only strip debug info -%global _find_debuginfo_opts -g - -# Don't provide shared library or pkgconfig -%global __provides_exclude ^(lib.*\\.so(\\.[0-9.]*)?\\([A-Z._0-9]*\\)\\(64bit\\)|pkgconfig\\(.*)$ - -%global __requires_exclude ^libonnxruntime\\.so\\.[0-9.]*\\([A-Z._0-9]*\\)\\(64bit\\)$ - -# Version -%define ver_major _TMPL_VER_MAJOR -%define ver_minor _TMPL_VER_MINOR -%define ver_patch _TMPL_VER_PATCH -%define ver_release _TMPL_VER_RELEASE - -Summary: ONNX Runtime package for Vespa -Name: vespa-onnxruntime -Version: %{ver_major}.%{ver_minor}.%{ver_patch} -Release: %{ver_release}%{?dist} -License: MIT License -URL: https://microsoft.github.io/onnxruntime -Source0: vespa-onnxruntime-%{version}.tar.gz -Patch0: patches.use-origin-rpath-for-jni-library.diff - -BuildRequires: vespa-gradle -BuildRequires: which -%if 0%{?el8} -%define _devtoolset_enable /opt/rh/gcc-toolset-11/enable -BuildRequires: gcc-toolset-11-gcc-c++ -BuildRequires: make -BuildRequires: glibc-langpack-en -BuildRequires: wget -BuildRequires: cmake -%define _cmake_prog cmake -%define _ctest_prog ctest -%endif -%if 0%{?el9} -BuildRequires: gcc-c++ -BuildRequires: make -BuildRequires: glibc-langpack-en -BuildRequires: cmake -%define _cmake_prog cmake -%define _ctest_prog ctest -%endif -%if 0%{?fedora} -BuildRequires: gcc-c++ -BuildRequires: make -BuildRequires: cmake -BuildRequires: glibc-langpack-en -%define _cmake_prog cmake -%define _ctest_prog ctest -%endif -BuildRequires: zlib-devel -%if ! 0%{?el9} && ! 0%{?amzn2023} -BuildRequires: redhat-lsb-core -%endif -BuildRequires: expat-devel -BuildRequires: libcurl-devel -BuildRequires: python3-devel -BuildRequires: python3-numpy -%if ! 0%{?el9} -BuildRequires: libunwind -%endif -BuildRequires: python3-setuptools -BuildRequires: bzip2 -BuildRequires: cuda-libraries-devel-11-8 -BuildRequires: cuda-compiler-11-8 -BuildRequires: cuda-cudart-devel-11-8 -BuildRequires: cuda-command-line-tools-11-8 -BuildRequires: libcudnn8-devel -BuildRequires: ccache - -%description -ONNX Runtime package for Vespa. - -See https://github.com/vespa-engine/vespa-3rdparty-deps for details -about packaging. - -%package devel -Summary: ONNX Runtime dev package for Vespa. -Requires: %{name} = %{version}-%{release} - -%description devel -%{version} dev package for Vespa. - -See https://github.com/vespa-engine/vespa-3rdparty-deps for details -about packaging. -%prep -%setup -q -%patch0 -p1 - -%if 0%{?_download_cmake_tar} -# Download precompiled cmake version on CentOS 7, RHEL 7 and Amazon Linux 2 for now. -if test -f %{cmake_prog} -then - : -else - wget -O /tmp/cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v%{_cmake_version}/cmake-%{_cmake_version}-Linux-%{_arch}.tar.gz - tar xf /tmp/cmake.tar.gz - rm -f /tmp/cmake.tar.gz -fi -%endif - -%build - -%if 0%{?_devtoolset_enable:1} -source %{_devtoolset_enable} || true -%endif - -PATH=%{_prefix}/bin:$PATH - -./build.sh \ - --config RelWithDebInfo \ - --use_cuda --cuda_home=/usr/local/cuda-11.8 --cudnn_home=/usr \ - --build_java \ - --skip_tests \ - --build_shared_lib \ - --parallel \ - --cmake_path %{_cmake_prog} \ - --ctest_path %{_ctest_prog} \ - --skip_submodule_sync \ - --cmake_extra_defines \ - CMAKE_INSTALL_PREFIX=%{_prefix} \ - CMAKE_CXX_COMPILER_LAUNCHER=ccache \ - CMAKE_CUDA_ARCHITECTURES="60;70;75" \ - onnxruntime_DEV_MODE=OFF \ - onnxruntime_USE_OPENMP=OFF \ - %{?_toolset_compiler_cmake_args} - -%install -rm -rf $RPM_BUILD_ROOT - -%if 0%{?_devtoolset_enable:1} -source %{_devtoolset_enable} || true -%endif - -make -C build/Linux/RelWithDebInfo DESTDIR=%{buildroot} install - -cp -p build/Linux/RelWithDebInfo/lib*jni*.so* %{buildroot}%{_prefix}/lib64/. -mkdir -p %{buildroot}%{_prefix}/lib -cp -p build/Linux/RelWithDebInfo/java/build/libs/* %{buildroot}%{_prefix}/lib/. - -# Compat links with tarfile distribution -ln -s core/session/onnxruntime_c_api.h %{buildroot}%{_prefix}/include/onnxruntime/onnxruntime_c_api.h -ln -s core/session/onnxruntime_cxx_api.h %{buildroot}%{_prefix}/include/onnxruntime/onnxruntime_cxx_api.h -ln -s core/session/onnxruntime_cxx_inline.h %{buildroot}%{_prefix}/include/onnxruntime/onnxruntime_cxx_inline.h - -%files -%{_prefix}/lib64/ -%exclude %{_prefix}/lib64/*cuda* -%exclude %{_prefix}/bin/ -%license LICENSE - -%files devel -%{_prefix}/include/ -%license LICENSE - -%package java -Summary: ONNX java runtime support for Vespa. -Requires: %{name} = %{version}-%{release} - -%description java -%{version} java support package for Vespa. - -See https://github.com/vespa-engine/vespa-3rdparty-deps for details -about packaging. - -%files java -%{_prefix}/lib/ -%license LICENSE - -%package cuda -Summary: ONNX provider for CUDA (for Vespa). -Requires: %{name} = %{version}-%{release} -Requires: libcufft-11-8 -Requires: libcublas-11-8 -Requires: libcurand-11-8 - -%description cuda -CUDA support package for Vespa. - -See https://github.com/vespa-engine/vespa-3rdparty-deps for details -about packaging. - -%files cuda -%{_prefix}/lib64/*cuda* -%license LICENSE - -%changelog From 1bc07492064a2d4eb97acd85e0c00e450d1d93fb Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Thu, 9 Nov 2023 19:51:11 +0000 Subject: [PATCH 4/4] skip no-longer-relevant patch --- onnxruntime/vespa-onnxruntime.spec.tmpl | 2 -- 1 file changed, 2 deletions(-) diff --git a/onnxruntime/vespa-onnxruntime.spec.tmpl b/onnxruntime/vespa-onnxruntime.spec.tmpl index 6778d0c..e4d8d78 100644 --- a/onnxruntime/vespa-onnxruntime.spec.tmpl +++ b/onnxruntime/vespa-onnxruntime.spec.tmpl @@ -31,7 +31,6 @@ Patch0: patches.use-origin-rpath-for-jni-library.diff Patch1: patches.no-array-bounds.diff Patch2: patches.use-gradle.diff Patch3: patches.apply-cpuinfo.diff -Patch4: patches.no-asm-mrs.diff %if 0%{?fedora} && !0%{?amzn} BuildRequires: cmake @@ -112,7 +111,6 @@ about packaging. %patch1 -p1 %patch2 -p0 %patch3 -p1 -%patch4 -p0 %build