diff options
author | sL1pKn07 | 2023-07-10 17:39:47 +0200 |
---|---|---|
committer | sL1pKn07 | 2023-07-10 17:39:47 +0200 |
commit | f1dea8ed2ab5252becdb5b165cc851f0828f961c (patch) | |
tree | 44423e4aab100d7ab44a0fb6253055a3b9b373c9 /PKGBUILD | |
parent | 98c30989b8669a56f38bd55991bd6a745068be51 (diff) | |
download | aur-f1dea8ed2ab5252becdb5b165cc851f0828f961c.tar.gz |
Update to 1.15.1
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 237 |
1 files changed, 128 insertions, 109 deletions
@@ -1,7 +1,8 @@ -# Maintainer: Chih-Hsuan Yen <yan12125@gmail.com> - +# Maintainer: Gustavo Alvarez <sl1pkn07@gmail.com> +# Contributor: Chih-Hsuan Yen <yan12125@gmail.com> +# MAKEFLAGS=-j18 _ENABLE_CUDA=1 -_ENABLE_TENSORRT=0 +_ENABLE_TENSORRT=0 #NOTE: not working due https://github.com/microsoft/onnxruntime/issues/15131 pkgbase=python-onnxruntime # Not split DNNL EP to another package as it's needed unconditionally at runtime if built at compile time @@ -9,67 +10,69 @@ pkgbase=python-onnxruntime pkgname=('onnxruntime' 'python-onnxruntime' ) -pkgver=1.14.1 +pkgver=1.15.1 pkgdesc='Cross-platform, high performance scoring engine for ML models' pkgrel=1 arch=('x86_64') url='https://github.com/microsoft/onnxruntime' license=('MIT') -depends=('nsync' - 'libre2.so' - 'openmpi' - ) -if [[ $_ENABLE_TENSORRT = 1 ]]; then - depends+=('libprotobuf.so') -else - depends+=('libprotobuf-lite.so') -fi - -makedepends=('git' - 'cmake' - 'cxxopts' - 'pybind11' - 'abseil-cpp' - 'nlohmann-json' - 'chrono-date' - 'boost' - 'eigen' - 'flatbuffers' - 'onednn' - 're2' - 'python-coloredlogs' - 'python-flatbuffers' - 'python-numpy' - 'python-pip' - 'python-setuptools' - 'python-protobuf' - 'python-sympy' - 'chrpath' - ) +depends=( + 'nsync' + 'libre2.so' + 'openmpi' +) +# if [[ $_ENABLE_TENSORRT = 1 ]]; then +# depends+=('protobuf' 'libprotobuf.so') +# else +# depends+=('protobuf' 'libprotobuf-lite.so') +# fi + +makedepends=( + 'git' + 'cmake' + 'cxxopts' + 'pybind11' + 'abseil-cpp' + 'nlohmann-json' + 'chrono-date' + 'boost' + 'eigen' + 'flatbuffers' + 'onednn' + 're2' + 'python-coloredlogs' + 'python-flatbuffers' + 'python-numpy' + 'python-pip' + 'python-setuptools' + 'python-protobuf' + 'python-sympy' + 'chrpath' + 'nsync' +) # not de-vendored libraries # onnx: needs shared libonnx (https://github.com/onnx/onnx/issues/3030) -source=("git+https://github.com/microsoft/onnxruntime#tag=v${pkgver}" - '14267.diff' # 'https://patch-diff.githubusercontent.com/raw/microsoft/onnxruntime/pull/14267.diff' - '15089.diff' # 'https://patch-diff.githubusercontent.com/raw/microsoft/onnxruntime/pull/15089.diff' - 'install-orttraining-files.diff' - 'system-dnnl.diff' - 'system-flatbuffers.patch' - ) -sha512sums=('SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - ) +source=( + "git+https://github.com/microsoft/onnxruntime#tag=v${pkgver}" + 'install-orttraining-files.diff' + 'system-dnnl.diff' + 'system-flatbuffers.patch' +) +sha512sums=( + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' +) options=('debug') if [[ $_ENABLE_CUDA = 1 ]]; then pkgname+=('onnxruntime-cuda') - makedepends+=('cuda' - 'cudnn' - 'nccl' - ) + makedepends+=( + 'cuda' + 'cudnn' + 'nccl' + ) fi if [[ $_ENABLE_TENSORRT = 1 ]]; then @@ -81,53 +84,54 @@ fi _CUDA_ARCHITECTURES="52-real;53-real;60-real;61-real;62-real;70-real;72-real;75-real;80-real;86-real;87-real;89-real;90-real;90-virtual" prepare() { + echo $MAKEFLAGS cd onnxruntime - # DNNL +3.x.x - patch -Np1 -i "${srcdir}/14267.diff" + # Use System Dlnn patch -Np1 -i "${srcdir}/system-dnnl.diff" - # find system nlohmann-json + # Find system nlohmann-json sed 's|3.10 ||g' \ -i cmake/external/onnxruntime_external_deps.cmake - # find system chrono-date + # Find system chrono-date sed -e 's|${DEP_SHA1_date}|&\n \ \ \ \ \ \FIND_PACKAGE_ARGS NAMES date|g' \ -e 's|date_interface|date::date-tz|g' \ -i cmake/external/onnxruntime_external_deps.cmake \ -i cmake/onnxruntime_common.cmake \ -i cmake/onnxruntime_unittests.cmake - # find system abseil-cpp + # Find system abseil-cpp sed 's|ABSL_PATCH_COMMAND}|&\n\ \ \ \ \FIND_PACKAGE_ARGS NAMES absl|g' \ -i cmake/external/abseil-cpp.cmake - # find system cxxopts + # Find system cxxopts sed 's|${DEP_SHA1_cxxopts}|&\n\ \ \ \ \FIND_PACKAGE_ARGS NAMES cxxopts|g' \ -i cmake/external/onnxruntime_external_deps.cmake - # update boost mp11 - sed -e 's|boost-1.79.0|boost-1.81.0|g' \ - -e 's|c8f04e378535ededbe5af52c8f969d2dedbe73d5|fdad7d98d7239423e357bb49e725382a814f695c|g' \ - -i cmake/deps.txt + # Find system nsync + sed -e 's|NAMES nsync|&_cpp|g' \ + -e '282aadd_library(nsync::nsync_cpp ALIAS nsync_cpp)' \ + -i cmake/external/onnxruntime_external_deps.cmake \ if [[ $_ENABLE_TENSORRT = 1 ]]; then - # Tensorrt 8.6 EA - patch -Np1 -i "${srcdir}/15089.diff" - # Update Tensorboard 00d59e65d866a6d4b9fe855dce81ee6ba8b40c4f sed -e 's|373eb09e4c5d2b3cc2493f0949dc4be6b6a45e81|00d59e65d866a6d4b9fe855dce81ee6ba8b40c4f|g' \ -e 's|67b833913605a4f3f499894ab11528a702c2b381|ff427b6a135344d86b65fa2928fbd29886eefaec|g' \ -i cmake/deps.txt # Update onnx_tensorrt 6872a9473391a73b96741711d52b98c2c3e25146 - sed -e 's|369d6676423c2a6dbf4a5665c4b5010240d99d3c|6872a9473391a73b96741711d52b98c2c3e25146|g' \ + sed -e 's|ba6a4fb34fdeaa3613bf981610c657e7b663a699|6872a9473391a73b96741711d52b98c2c3e25146|g' \ -e 's|62119892edfb78689061790140c439b111491275|75462057c95f7fdbc256179f0a0e9e4b7be28ae3|g' \ -i cmake/deps.txt fi patch -Np1 -i "${srcdir}/install-orttraining-files.diff" - patch -Np1 -i "${srcdir}/system-flatbuffers.patch" + # Force use bundled flatbuffers due fail build + sed '/NAMES Flatbuffers/s/^/#/g' -i cmake/external/onnxruntime_external_deps.cmake + # Same with Protobuf + sed '/NAMES Protobuf/s/^/#/g' -i cmake/external/onnxruntime_external_deps.cmake +# patch -Np1 -i "${srcdir}/system-flatbuffers.patch" # fix build with gcc12(?), take idea from https://github.com/microsoft/onnxruntime/pull/11667 and https://github.com/microsoft/onnxruntime/pull/10014 sed 's|dims)|TensorShape(dims))|g' \ @@ -137,8 +141,13 @@ prepare() { sed '11a#include <iostream>' \ -i orttraining/orttraining/test/training_api/trainer/trainer.cc - cd onnxruntime/core/flatbuffers/schema - python compile_schema.py --flatc /usr/bin/flatc + # Silence cmake warning + sed -e 's|PRIVATE |PRIVATE |g' \ + -e 's|2">|2>"|g' \ + -i cmake/onnxruntime_mlas.cmake + +# cd onnxruntime/core/flatbuffers/schema +# python compile_schema.py --flatc /usr/bin/flatc } build() { @@ -151,6 +160,9 @@ build() { # Gcc 12+ CXXFLAGS+=" -Wno-maybe-uninitialized" + CFLAGS="${CFLAGS/_FORTIFY_SOURCE=2/_FORTIFY_SOURCE=0}" + CXXFLAGS="${CXXFLAGS/_FORTIFY_SOURCE=2/_FORTIFY_SOURCE=0}" + # Use -Donnxruntime_ENABLE_LAZY_TENSOR=OFF as it requires patched python-pytorch # See: https://github.com/microsoft/onnxruntime/pull/10460 https://github.com/pytorch/pytorch/pulls/wschin @@ -168,6 +180,7 @@ build() { -Donnxruntime_USE_DNNL=ON -Donnxruntime_USE_PREINSTALLED_EIGEN=ON -Deigen_SOURCE_PATH=$(pkg-config --cflags eigen3 | sed 's|-I||g') + -DCMAKE_CXX_STANDARD=17 ) # Use protobuf-lite instead of full protobuf to workaround symbol conflicts @@ -195,11 +208,13 @@ build() { ) fi - cmake -S onnxruntime/cmake -B build \ + cd onnxruntime/cmake + cmake -S . -B ../../build \ "${_cmake_args[@]}" \ "$@" + cd "${srcdir}" - cmake --build build -v + LC_ALL=C cmake --build build -v ( cd build; @@ -209,9 +224,10 @@ build() { } package_onnxruntime() { - depends+=('onednn' - 'abseil-cpp' - ) + depends+=( + 'onednn' + 'abseil-cpp' + ) DESTDIR="${pkgdir}" cmake --install build @@ -226,30 +242,31 @@ package_onnxruntime() { } package_python-onnxruntime() { - depends=('onnxruntime' - 'python-coloredlogs' - 'python-flatbuffers' - 'python-numpy' - 'python-protobuf' - 'python-sympy' - 'python-packaging' - ) + depends=( + 'onnxruntime' + 'python-coloredlogs' + 'python-flatbuffers' + 'python-numpy' + 'python-protobuf' + 'python-sympy' + 'python-packaging' + ) optdepends=( - # https://github.com/microsoft/onnxruntime/pull/9969 - 'python-onnx: for the backend API, quantization, orttraining, transformers and various tools' - 'python-psutil: for transformers' - 'python-py-cpuinfo: for transformers' - 'python-py3nvml: for transformers' - 'python-transformers: for transformers' - 'python-scipy: for transformers and various tools' - 'python-pytorch: for transformers, orttraining and various tools' - 'python-pytorch-cuda' - 'python-cerberus: for orttraining' - 'python-h5py: for orttraining' - 'python-matplotlib' - 'python-tensorflow-opt-cuda' - 'python-importlib-metadata' - ) + # https://github.com/microsoft/onnxruntime/pull/9969 + 'python-onnx: for the backend API, quantization, orttraining, transformers and various tools' + 'python-psutil: for transformers' + 'python-py-cpuinfo: for transformers' + 'python-py3nvml: for transformers' + 'python-transformers: for transformers' + 'python-scipy: for transformers and various tools' + 'python-pytorch: for transformers, orttraining and various tools' + 'python-pytorch-cuda' + 'python-cerberus: for orttraining' + 'python-h5py: for orttraining' + 'python-matplotlib' + 'python-tensorflow-opt-cuda' + 'python-importlib-metadata' + ) pip install -I -U --root "${pkgdir}" --no-warn-script-location --no-deps dist/*.whl @@ -263,12 +280,13 @@ package_python-onnxruntime() { } package_onnxruntime-cuda() { - depends=('cudnn' - 'nccl' - 'openmpi' - 'nsync' - 'abseil-cpp' - ) + depends=( + 'cudnn' + 'nccl' + 'openmpi' + 'nsync' + 'abseil-cpp' + ) conflicts=('python-onnxruntime-cuda') replaces=('python-onnxruntime-cuda') pkgdesc+=' (CUDA execution provider)' @@ -281,11 +299,12 @@ package_onnxruntime-cuda() { } package_onnxruntime-tensorrt() { - depends=('tensorrt' - 'libprotobuf.so' - 'nsync' - 'flatbuffers' - ) + depends=( + 'tensorrt' +# 'protobuf' 'libprotobuf.so' + 'nsync' +# 'flatbuffers' + ) pkgdesc+=' (TENSORRT execution provider)' cd build |