summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorChih-Hsuan Yen2019-07-12 19:06:38 +0800
committerChih-Hsuan Yen2019-07-12 19:06:38 +0800
commitbf4ab12fef0e2ba440d2321fc09f7ee5e73b18f4 (patch)
treeca91634bb90d00f44c49b5a6d078d6cda3713798
downloadaur-bf4ab12fef0e2ba440d2321fc09f7ee5e73b18f4.tar.gz
new package, version 0.4.0
-rw-r--r--.SRCINFO46
-rw-r--r--PKGBUILD98
-rw-r--r--build-fixes.patch93
3 files changed, 237 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..8bafa0f7146
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,46 @@
+pkgbase = python-onnxruntime
+ pkgdesc = Cross-platform, high performance scoring engine for ML models
+ pkgver = 0.4.0
+ pkgrel = 1
+ url = https://github.com/microsoft/onnxruntime
+ arch = x86_64
+ license = MIT
+ makedepends = git
+ makedepends = cmake
+ makedepends = cuda
+ makedepends = cudnn
+ makedepends = gtest
+ makedepends = gmock
+ makedepends = pybind11
+ makedepends = python-setuptools
+ depends = protobuf>=3.7.1
+ depends = re2
+ depends = python-numpy
+ source = git+https://github.com/microsoft/onnxruntime#tag=v0.4.0
+ source = git+https://github.com/HowardHinnant/date.git
+ source = eigen::git+https://github.com/eigenteam/eigen-git-mirror.git
+ source = git+https://github.com/google/gemmlowp.git
+ source = gsl::git+https://github.com/Microsoft/GSL.git
+ source = git+https://github.com/google/nsync.git
+ source = git+https://github.com/onnx/onnx.git
+ source = build-fixes.patch
+ sha512sums = SKIP
+ sha512sums = SKIP
+ sha512sums = SKIP
+ sha512sums = SKIP
+ sha512sums = SKIP
+ sha512sums = SKIP
+ sha512sums = SKIP
+ sha512sums = 4901a35f1c8687555c63aaa9d0dddab9becd59b4779dd1040c19bb7dcf690773df103cffac94228f7019644d0cca03c09df525b8188fc3eef65557af07e25a26
+
+pkgname = python-onnxruntime
+
+pkgname = python-onnxruntime-cuda
+ depends = protobuf>=3.7.1
+ depends = re2
+ depends = python-numpy
+ depends = cuda
+ depends = cudnn
+ provides = python-onnxruntime=0.4.0
+ conflicts = python-onnxruntime
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..bb16dcb7736
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,98 @@
+# Maintainer: Chih-Hsuan Yen <yan12125@gmail.com>
+
+pkgbase=python-onnxruntime
+pkgname=(python-onnxruntime python-onnxruntime-cuda)
+pkgver=0.4.0
+pkgdesc='Cross-platform, high performance scoring engine for ML models'
+pkgrel=1
+arch=(x86_64)
+url='https://github.com/microsoft/onnxruntime'
+license=(MIT)
+# protobuf 3.7.0 has an issue, which breaks building of onnxruntime
+# https://github.com/protocolbuffers/protobuf/issues/5869
+depends=('protobuf>=3.7.1' re2 python-numpy)
+makedepends=(git cmake cuda cudnn gtest gmock pybind11 python-setuptools)
+# not de-vendored libraries
+# eigen: API changes a lot since extra/eigen 3.3.7 to the commit onnxruntime uses
+# onnx: onnxruntime requires headers, which are not installed in python-onnx
+source=("git+https://github.com/microsoft/onnxruntime#tag=v$pkgver"
+ "git+https://github.com/HowardHinnant/date.git"
+ "eigen::git+https://github.com/eigenteam/eigen-git-mirror.git"
+ "git+https://github.com/google/gemmlowp.git"
+ "gsl::git+https://github.com/Microsoft/GSL.git"
+ "git+https://github.com/google/nsync.git"
+ "git+https://github.com/onnx/onnx.git"
+ build-fixes.patch)
+sha512sums=('SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ '4901a35f1c8687555c63aaa9d0dddab9becd59b4779dd1040c19bb7dcf690773df103cffac94228f7019644d0cca03c09df525b8188fc3eef65557af07e25a26')
+
+prepare() {
+ cd onnxruntime
+ patch -Np1 -i ../build-fixes.patch
+
+ git submodule init
+ for mod in date eigen gemmlowp gsl nsync onnx ; do
+ git config submodule.cmake/external/$mod.url "$srcdir"/$mod
+ git submodule update cmake/external/$mod
+ done
+
+ mkdir build build-cuda
+}
+
+_build() {
+ # Uses the same compiler as CUDA, or there will be linker errors due to
+ # attempts on linking object files with libstdc++ from older GCC
+ CC=/opt/cuda/bin/gcc CXX=/opt/cuda/bin/g++ \
+ cmake ../cmake \
+ -Donnxruntime_ENABLE_PYTHON=ON \
+ -DONNX_CUSTOM_PROTOC_EXECUTABLE=/usr/bin/protoc \
+ $@
+ make
+ python ../setup.py build
+}
+
+build() {
+ cd "$srcdir"/onnxruntime/build
+ _build
+
+ cd "$srcdir"/onnxruntime/build-cuda
+ _build -Donnxruntime_USE_CUDA=ON -Donnxruntime_CUDNN_HOME=/usr
+}
+
+check() {
+ cd "$srcdir"/onnxruntime/build
+ make test
+
+ cd "$srcdir"/onnxruntime/build-cuda
+ # make test # requires machines with CUDA-compatible devices
+}
+
+_package() {
+ python ../setup.py install --root="$pkgdir" --skip-build --optimize=1
+
+ PY_SITE_DIR="$(python -c 'import site; print(site.getsitepackages()[0])')"
+ install -Ddm755 "$pkgdir"/usr/share/licenses/$pkgname
+ for f in LICENSE ThirdPartyNotices.txt ; do
+ ln -s "$PY_SITE_DIR/onnxruntime/$f" "$pkgdir"/usr/share/licenses/$pkgname/$f
+ done
+}
+
+package_python-onnxruntime() {
+ cd onnxruntime/build
+ _package
+}
+
+package_python-onnxruntime-cuda() {
+ depends+=(cuda cudnn)
+ conflicts=(python-onnxruntime)
+ provides=("python-onnxruntime=$pkgver")
+
+ cd onnxruntime/build-cuda
+ _package
+}
diff --git a/build-fixes.patch b/build-fixes.patch
new file mode 100644
index 00000000000..7276d69d9d4
--- /dev/null
+++ b/build-fixes.patch
@@ -0,0 +1,93 @@
+diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
+index 96c89fef..0e37e487 100644
+--- a/cmake/CMakeLists.txt
++++ b/cmake/CMakeLists.txt
+@@ -229,18 +229,10 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/external)
+ #2. if ONNX_CUSTOM_PROTOC_EXECUTABLE is not set, Compile everything(including protoc) from source code.
+
+
+-# use protobuf as a submodule
+-add_subdirectory(${PROJECT_SOURCE_DIR}/external/protobuf/cmake EXCLUDE_FROM_ALL)
+-set_target_properties(libprotobuf PROPERTIES FOLDER "External/Protobuf")
+-set_target_properties(libprotobuf-lite PROPERTIES FOLDER "External/Protobuf")
+-set_target_properties(libprotoc PROPERTIES FOLDER "External/Protobuf")
+-set_target_properties(protoc PROPERTIES FOLDER "External/Protobuf")
+-if (onnxruntime_USE_FULL_PROTOBUF)
+- add_library(protobuf::libprotobuf ALIAS libprotobuf)
+-else()
+- add_library(protobuf::libprotobuf ALIAS libprotobuf-lite)
+-endif()
+-add_executable(protobuf::protoc ALIAS protoc)
++find_package(PkgConfig)
++pkg_check_modules(PROTOBUF REQUIRED IMPORTED_TARGET GLOBAL protobuf)
++add_library(libprotobuf ALIAS PkgConfig::PROTOBUF)
++add_library(protobuf::libprotobuf ALIAS PkgConfig::PROTOBUF)
+ include(protobuf_function.cmake)
+
+
+@@ -282,8 +274,6 @@ set(ONNXRUNTIME_INCLUDE_DIR ${REPO_ROOT}/include/onnxruntime)
+
+ add_subdirectory(external/date EXCLUDE_FROM_ALL)
+ add_subdirectory(external/gsl EXCLUDE_FROM_ALL)
+-add_subdirectory(external/re2 EXCLUDE_FROM_ALL)
+-set_target_properties(re2 PROPERTIES FOLDER "External/re2")
+ add_library(gsl ALIAS GSL)
+
+ # bounds checking behavior.
+@@ -306,7 +296,7 @@ function(onnxruntime_add_include_to_target dst_target)
+ endforeach()
+ endfunction()
+
+-set(onnxruntime_EXTERNAL_DEPENDENCIES gsl onnx_proto re2)
++set(onnxruntime_EXTERNAL_DEPENDENCIES gsl onnx_proto)
+
+ # TVM
+ if (onnxruntime_USE_TVM)
+@@ -620,11 +605,10 @@ if (onnxruntime_BUILD_UNIT_TESTS)
+ # turned ON by the previous step when building a shared lib
+ set(CMAKE_SKIP_BUILD_RPATH OFF)
+ # gtest and gmock
+- add_subdirectory(${PROJECT_SOURCE_DIR}/external/googletest EXCLUDE_FROM_ALL)
+- set_target_properties(gmock PROPERTIES FOLDER "External/GTest")
+- set_target_properties(gmock_main PROPERTIES FOLDER "External/GTest")
+- set_target_properties(gtest PROPERTIES FOLDER "External/GTest")
+- set_target_properties(gtest_main PROPERTIES FOLDER "External/GTest")
++ pkg_check_modules(GTEST REQUIRED IMPORTED_TARGET GLOBAL gtest)
++ pkg_check_modules(GMOCK REQUIRED IMPORTED_TARGET GLOBAL gmock)
++ add_library(gtest ALIAS PkgConfig::GTEST)
++ add_library(gmock ALIAS PkgConfig::GMOCK)
+ include(onnxruntime_unittests.cmake)
+ endif()
+
+diff --git a/cmake/onnxruntime_python.cmake b/cmake/onnxruntime_python.cmake
+index ace16b1b..c76ebde4 100644
+--- a/cmake/onnxruntime_python.cmake
++++ b/cmake/onnxruntime_python.cmake
+@@ -1,7 +1,6 @@
+ # Copyright (c) Microsoft Corporation. All rights reserved.
+ # Licensed under the MIT License.
+
+-include(pybind11)
+ FIND_PACKAGE(NumPy)
+
+ if(NOT PYTHON_INCLUDE_DIR)
+@@ -83,7 +82,6 @@ set(onnxruntime_pybind11_state_libs
+
+ set(onnxruntime_pybind11_state_dependencies
+ ${onnxruntime_EXTERNAL_DEPENDENCIES}
+- pybind11
+ )
+
+ add_dependencies(onnxruntime_pybind11_state ${onnxruntime_pybind11_state_dependencies})
+diff --git a/onnxruntime/core/util/protobuf_parsing_utils.cc b/onnxruntime/core/util/protobuf_parsing_utils.cc
+index 4e46d0ef..8638f353 100644
+--- a/onnxruntime/core/util/protobuf_parsing_utils.cc
++++ b/onnxruntime/core/util/protobuf_parsing_utils.cc
+@@ -49,7 +49,6 @@
+ #include <google/protobuf/stubs/common.h>
+ #include <google/protobuf/stubs/logging.h>
+ #include <google/protobuf/stubs/stl_util.h>
+-#include <google/protobuf/stubs/io_win32.h>
+ #include "protobuf_parsing_utils.h"
+ #include <string.h>
+