summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Exequiel Pedone2024-05-02 20:13:44 -0300
committerGonzalo Exequiel Pedone2024-05-02 20:13:44 -0300
commitf925ad63bbfe111bf0ceb244f0331541398f4fa6 (patch)
tree4e25591598577531112069afacc513c86ddb1b06
downloadaur-f925ad63bbfe111bf0ceb244f0331541398f4fa6.tar.gz
New package.
-rw-r--r--.SRCINFO25
-rw-r--r--.gitignore6
-rw-r--r--PKGBUILD54
-rw-r--r--eigen-vectorized-reduction-half.patch46
4 files changed, 131 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..79b2b48b65be
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,25 @@
+pkgbase = android-x86-eigen
+ pkgdesc = Lightweight C++ template library for vector and matrix math, a.k.a. linear algebra (Android x86)
+ pkgver = 3.4.0
+ pkgrel = 1
+ url = https://eigen.tuxfamily.org
+ arch = any
+ license = MPL-2.0
+ license = Apache-2.0
+ license = BSD-3-Clause
+ license = Minpack
+ license = LGPL-2.1-only OR LGPL-2.1-or-later
+ makedepends = android-cmake
+ makedepends = android-x86-fftw
+ makedepends = android-x86-boost
+ depends = android-ndk
+ options = !strip
+ options = !buildflags
+ options = staticlibs
+ options = !emptydirs
+ source = https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz
+ source = eigen-vectorized-reduction-half.patch
+ sha256sums = 8586084f71f9bde545ee7fa6d00288b264a2b7ac3607b974e54d13e7162c1c72
+ sha256sums = SKIP
+
+pkgname = android-x86-eigen
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..b5b03b115225
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+pkg
+src
+*.tar.xz
+*.tar.gz
+*.tar.bz2
+*.asc
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..5a3392954c09
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,54 @@
+# Maintainer: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>
+# Contributor: Ronald van Haren <ronald@archlinux.org>
+# Contributor: Chirantan Ekbote <chirantan.ekbote at gmail.com>
+# Contributor: Kringel
+
+_android_arch=x86
+
+pkgname=android-${_android_arch}-eigen
+pkgver=3.4.0
+pkgrel=1
+arch=('any')
+pkgdesc="Lightweight C++ template library for vector and matrix math, a.k.a. linear algebra (Android ${_android_arch})"
+url='https://eigen.tuxfamily.org'
+license=('MPL-2.0'
+ 'Apache-2.0'
+ 'BSD-3-Clause'
+ 'Minpack'
+ 'LGPL-2.1-only OR LGPL-2.1-or-later')
+depends=('android-ndk')
+makedepends=('android-cmake'
+ "android-${_android_arch}-fftw"
+ "android-${_android_arch}-boost")
+options=(!strip !buildflags staticlibs !emptydirs)
+source=("https://gitlab.com/libeigen/eigen/-/archive/$pkgver/eigen-$pkgver.tar.gz"
+ 'eigen-vectorized-reduction-half.patch')
+sha256sums=('8586084f71f9bde545ee7fa6d00288b264a2b7ac3607b974e54d13e7162c1c72'
+ 'SKIP')
+
+prepare() {
+ cd "${srcdir}/eigen-$pkgver"
+
+ # Eigen installs all files in source dir, including the backup files of patch.
+ # With the first flag we disable the use of backup files.
+ patch --no-backup-if-mismatch -Np1 -i ../eigen-vectorized-reduction-half.patch
+}
+
+build() {
+ cd "${srcdir}/eigen-$pkgver"
+ source android-env ${_android_arch}
+
+ android-${_android_arch}-cmake \
+ -S . \
+ -B build \
+ -DBUILD_TESTING=OFF \
+ -DEIGEN_BUILD_DOC=OFF
+ make -C build $MAKEFLAGS
+}
+
+package() {
+ cd "${srcdir}/eigen-$pkgver"
+ source android-env ${_android_arch}
+
+ make -C build DESTDIR="$pkgdir" install
+}
diff --git a/eigen-vectorized-reduction-half.patch b/eigen-vectorized-reduction-half.patch
new file mode 100644
index 000000000000..217eef25feb0
--- /dev/null
+++ b/eigen-vectorized-reduction-half.patch
@@ -0,0 +1,46 @@
+From d0e3791b1a0e2db9edd5f1d1befdb2ac5a40efe0 Mon Sep 17 00:00:00 2001
+From: Alex Druinsky <adruinsky@google.com>
+Date: Wed, 20 Oct 2021 16:03:12 -0700
+Subject: [PATCH] Fix vectorized reductions for Eigen::half
+
+Fixes compiler errors in expressions that look like
+
+ Eigen::Matrix<Eigen::half, 3, 1>::Random().maxCoeff()
+
+The error comes from the code that creates the initial value for
+vectorized reductions. The fix is to specify the scalar type of the
+reduction's initial value.
+
+The cahnge is necessary for Eigen::half because unlike other types,
+Eigen::half scalars cannot be implicitly created from integers.
+---
+ Eigen/src/Core/PartialReduxEvaluator.h | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/Eigen/src/Core/PartialReduxEvaluator.h b/Eigen/src/Core/PartialReduxEvaluator.h
+index 4040ae726f..a179688815 100644
+--- a/Eigen/src/Core/PartialReduxEvaluator.h
++++ b/Eigen/src/Core/PartialReduxEvaluator.h
+@@ -56,12 +56,17 @@ struct packetwise_redux_traits
+ /* Value to be returned when size==0 , by default let's return 0 */
+ template<typename PacketType,typename Func>
+ EIGEN_DEVICE_FUNC
+-PacketType packetwise_redux_empty_value(const Func& ) { return pset1<PacketType>(0); }
++PacketType packetwise_redux_empty_value(const Func& ) {
++ const typename unpacket_traits<PacketType>::type zero(0);
++ return pset1<PacketType>(zero);
++}
+
+ /* For products the default is 1 */
+ template<typename PacketType,typename Scalar>
+ EIGEN_DEVICE_FUNC
+-PacketType packetwise_redux_empty_value(const scalar_product_op<Scalar,Scalar>& ) { return pset1<PacketType>(1); }
++PacketType packetwise_redux_empty_value(const scalar_product_op<Scalar,Scalar>& ) {
++ return pset1<PacketType>(Scalar(1));
++}
+
+ /* Perform the actual reduction */
+ template<typename Func, typename Evaluator,
+--
+GitLab
+