Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] python3-numpy: Use OpenBLAS when available.
@ 2021-01-09 22:16 olafmersmann
  2021-01-09 22:20 ` [PR PATCH] [Updated] " olafmersmann
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: olafmersmann @ 2021-01-09 22:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]

There is a new pull request by olafmersmann against master on the void-packages repository

https://github.com/olafmersmann/void-packages python3-numpy
https://github.com/void-linux/void-packages/pull/27797

python3-numpy: Use OpenBLAS when available.
Just like `python3-scipy`, `python3-numpy` should use OpenBLAS when available and fall back to BLAS/LAPACK otherwise.

A patch file from https://github.com/void-linux/void-packages/pull/27797.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-python3-numpy-27797.patch --]
[-- Type: text/x-diff, Size: 7098 bytes --]

From dccefd67847566208fa9d5849efc924a2ce54c0d Mon Sep 17 00:00:00 2001
From: Olaf Mersmann <olafm@p-value.net>
Date: Sat, 9 Jan 2021 01:44:35 +0100
Subject: [PATCH 1/6] shutils/chroot.sh: move homedir to /tmp/fake-home.

starship tests fail if /tmp is $HOME because they create files inside
/tmp and compare the shortend path to an expected path. If /tmp is
$HOME, starship contracts it to ~ which does not match the expected
value.
---
 common/xbps-src/shutils/chroot.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/common/xbps-src/shutils/chroot.sh b/common/xbps-src/shutils/chroot.sh
index 8646d758549..e4bf4129826 100644
--- a/common/xbps-src/shutils/chroot.sh
+++ b/common/xbps-src/shutils/chroot.sh
@@ -88,7 +88,7 @@ PATH=/void-packages:/usr/bin
 
 exec env -i -- SHELL=/bin/sh PATH="\$PATH" DISTCC_HOSTS="\$XBPS_DISTCC_HOSTS" DISTCC_DIR="/host/distcc" \
     ${XBPS_ARCH+XBPS_ARCH=$XBPS_ARCH} ${XBPS_CHECK_PKGS+XBPS_CHECK_PKGS=$XBPS_CHECK_PKGS} \
-    CCACHE_DIR="/host/ccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 TERM=linux HOME="/tmp" \
+    CCACHE_DIR="/host/ccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 TERM=linux HOME="/tmp/fake-home" \
     PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h
 _EOF
 
@@ -119,7 +119,9 @@ chroot_prepare() {
 
     # Copy /etc/passwd and /etc/group from base-files.
     cp -f $XBPS_SRCPKGDIR/base-files/files/passwd $XBPS_MASTERDIR/etc
-    echo "$(whoami):x:$(id -u):$(id -g):$(whoami) user:/tmp:/bin/xbps-shell" \
+    mkdir -p $XBPS_MASTERDIR/tmp/fake-home
+    chown $(id -u):$(id -g) $XBPS_MASTERDIR/tmp/fake-home
+    echo "$(whoami):x:$(id -u):$(id -g):$(whoami) user:/tmp/fake-home:/bin/xbps-shell" \
         >> $XBPS_MASTERDIR/etc/passwd
     cp -f $XBPS_SRCPKGDIR/base-files/files/group $XBPS_MASTERDIR/etc
     echo "$(whoami):x:$(id -g):" >> $XBPS_MASTERDIR/etc/group
@@ -166,7 +168,7 @@ chroot_handler() {
         rv=$?
     else
         env -i -- PATH="/usr/bin:$PATH" SHELL=/bin/sh \
-            HOME=/tmp IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 \
+            HOME=/tmp/fake-home IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 \
             ${HTTP_PROXY:+HTTP_PROXY="${HTTP_PROXY}"} \
             ${HTTPS_PROXY:+HTTPS_PROXY="${HTTPS_PROXY}"} \
             ${FTP_PROXY:+FTP_PROXY="${FTP_PROXY}"} \

From 92bc76e4361963c0b4cc2534d44be60311dd27c6 Mon Sep 17 00:00:00 2001
From: Olaf Mersmann <olafm@p-value.net>
Date: Sat, 9 Jan 2021 01:56:44 +0100
Subject: [PATCH 2/6] starship: cleanup do_check.

---
 srcpkgs/starship/template | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/srcpkgs/starship/template b/srcpkgs/starship/template
index 0eae193aece..cdf8bcc97dd 100644
--- a/srcpkgs/starship/template
+++ b/srcpkgs/starship/template
@@ -22,11 +22,7 @@ post_build() {
 }
 
 do_check() {
-	mkdir -p fake-home
-	local OLDHOME=$HOME
-	export HOME=$(pwd)/fake-home
 	cargo test -q --release --target ${RUST_TARGET}
-	export HOME=$OLDHOME
 }
 
 post_install() {

From 6101e4de3a203bf99c956fb0854694dfa2694b85 Mon Sep 17 00:00:00 2001
From: Olaf Mersmann <olafm@p-value.net>
Date: Sat, 9 Jan 2021 01:58:12 +0100
Subject: [PATCH 3/6] passmenu: simplify do_check.

---
 srcpkgs/pass/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/pass/template b/srcpkgs/pass/template
index 33f0811c76d..82fae4d661f 100644
--- a/srcpkgs/pass/template
+++ b/srcpkgs/pass/template
@@ -16,7 +16,7 @@ checksum=2b6c65846ebace9a15a118503dcd31b6440949a30d3b5291dfb5b1615b99a3f4
 
 do_check() {
 	mkdir -p fake-home
-	HOME=$(pwd)/fake-home make test
+	make test
 }
 
 passmenu_package() {

From 066fe8c0f49ae57e9bf66d63b51a4477bcf57257 Mon Sep 17 00:00:00 2001
From: Olaf Mersmann <olafm@p-value.net>
Date: Sat, 9 Jan 2021 01:59:23 +0100
Subject: [PATCH 4/6] pygtk: simplify do_check.

---
 srcpkgs/pygtk/template | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/srcpkgs/pygtk/template b/srcpkgs/pygtk/template
index 41554b81763..e205ca332fc 100644
--- a/srcpkgs/pygtk/template
+++ b/srcpkgs/pygtk/template
@@ -28,10 +28,7 @@ pre_configure() {
 }
 
 do_check() {
-	export HOME="$(mktemp -d)"
-	mkdir -p "$HOME/.local/share"
 	xvfb-run make check
-	rm -r "$HOME"
 }
 
 post_install() {

From be7041bebbadbdb342f1ab23f2e4840e11380b7b Mon Sep 17 00:00:00 2001
From: Olaf Mersmann <olafm@p-value.net>
Date: Sat, 9 Jan 2021 02:06:59 +0100
Subject: [PATCH 5/6] pass: simplify do_check.

---
 srcpkgs/pass/template | 1 -
 1 file changed, 1 deletion(-)

diff --git a/srcpkgs/pass/template b/srcpkgs/pass/template
index 82fae4d661f..57493f0862c 100644
--- a/srcpkgs/pass/template
+++ b/srcpkgs/pass/template
@@ -15,7 +15,6 @@ distfiles="https://git.zx2c4.com/password-store/snapshot/password-store-${versio
 checksum=2b6c65846ebace9a15a118503dcd31b6440949a30d3b5291dfb5b1615b99a3f4
 
 do_check() {
-	mkdir -p fake-home
 	make test
 }
 

From 8415ff2569159f3c6c16f56bc7c165967c9a41d3 Mon Sep 17 00:00:00 2001
From: Olaf Mersmann <olafm@p-value.net>
Date: Sat, 9 Jan 2021 23:11:42 +0100
Subject: [PATCH 6/6] python3-numpy: Use OpenBLAS on platforms that support it.

---
 srcpkgs/python3-numpy/files/site.cfg.openblas |  4 ++++
 srcpkgs/python3-numpy/template                | 20 +++++++++++++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/python3-numpy/files/site.cfg.openblas

diff --git a/srcpkgs/python3-numpy/files/site.cfg.openblas b/srcpkgs/python3-numpy/files/site.cfg.openblas
new file mode 100644
index 00000000000..a83f9155faf
--- /dev/null
+++ b/srcpkgs/python3-numpy/files/site.cfg.openblas
@@ -0,0 +1,4 @@
+[openblas]
+libraries = openblas
+library_dirs = /usr/lib
+include_dirs = /usr/include
diff --git a/srcpkgs/python3-numpy/template b/srcpkgs/python3-numpy/template
index 619040f2892..e032c99ae67 100644
--- a/srcpkgs/python3-numpy/template
+++ b/srcpkgs/python3-numpy/template
@@ -1,11 +1,12 @@
 # Template file for 'python3-numpy'
 pkgname=python3-numpy
 version=1.19.5
-revision=1
+revision=2
 wrksrc="numpy-${version}"
 build_style=python3-module
 hostmakedepends="python3-setuptools python3-Cython gcc-fortran"
-makedepends="python3-devel lapack-devel cblas-devel"
+makedepends="python3-devel 
+ $(vopt_if openblas 'openblas-devel' 'lapack-devel cblas-devel')"
 depends="python3-setuptools"
 short_desc="Fast and sophisticated array facility to Python3"
 maintainer="bra1nwave <bra1nwave@protonmail.com>"
@@ -15,7 +16,22 @@ distfiles="https://github.com/numpy/numpy/archive/v${version}.tar.gz"
 checksum=43fe3bcdf27a2eb27196a1d140385aeece71c8b1a6eda18d2c6365239e50c60f
 alternatives="numpy:f2py:/usr/bin/f2py3"
 
+build_options="openblas"
+desc_option_openblas="Enable support for openblas accelerated linear algebra"
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|i686*|aarch64*|armv[67]*|ppc64*)
+		# Prefer accelerated routines where available
+		build_options_default="openblas"
+		;;
+	*) ;;
+esac
+
 post_patch() {
+	if [ -n "$build_option_openblas" ] ; then
+		cp "${FILESDIR}/site.cfg.openblas" site.cfg
+	fi
+
 	case "${XBPS_TARGET_MACHINE}" in
 		armv5tel-musl)
 			cp "${FILESDIR}/fenv-constants.h" numpy/core/src/npymath/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR PATCH] [Updated] python3-numpy: Use OpenBLAS when available.
  2021-01-09 22:16 [PR PATCH] python3-numpy: Use OpenBLAS when available olafmersmann
@ 2021-01-09 22:20 ` olafmersmann
  2021-01-10 15:38 ` olafmersmann
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: olafmersmann @ 2021-01-09 22:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 466 bytes --]

There is an updated pull request by olafmersmann against master on the void-packages repository

https://github.com/olafmersmann/void-packages python3-numpy
https://github.com/void-linux/void-packages/pull/27797

python3-numpy: Use OpenBLAS when available.
Just like `python3-scipy`, `python3-numpy` should use OpenBLAS when available and fall back to BLAS/LAPACK otherwise.

A patch file from https://github.com/void-linux/void-packages/pull/27797.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-python3-numpy-27797.patch --]
[-- Type: text/x-diff, Size: 2250 bytes --]

From b2f84191455db64d562e820a2ab89b30dffa70a3 Mon Sep 17 00:00:00 2001
From: Olaf Mersmann <olafm@p-value.net>
Date: Sat, 9 Jan 2021 23:11:42 +0100
Subject: [PATCH] python3-numpy: Use OpenBLAS on platforms that support it.

---
 srcpkgs/python3-numpy/files/site.cfg.openblas |  4 ++++
 srcpkgs/python3-numpy/template                | 20 +++++++++++++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/python3-numpy/files/site.cfg.openblas

diff --git a/srcpkgs/python3-numpy/files/site.cfg.openblas b/srcpkgs/python3-numpy/files/site.cfg.openblas
new file mode 100644
index 00000000000..a83f9155faf
--- /dev/null
+++ b/srcpkgs/python3-numpy/files/site.cfg.openblas
@@ -0,0 +1,4 @@
+[openblas]
+libraries = openblas
+library_dirs = /usr/lib
+include_dirs = /usr/include
diff --git a/srcpkgs/python3-numpy/template b/srcpkgs/python3-numpy/template
index 619040f2892..a3e33570d9b 100644
--- a/srcpkgs/python3-numpy/template
+++ b/srcpkgs/python3-numpy/template
@@ -1,11 +1,12 @@
 # Template file for 'python3-numpy'
 pkgname=python3-numpy
 version=1.19.5
-revision=1
+revision=2
 wrksrc="numpy-${version}"
 build_style=python3-module
 hostmakedepends="python3-setuptools python3-Cython gcc-fortran"
-makedepends="python3-devel lapack-devel cblas-devel"
+makedepends="python3-devel
+ $(vopt_if openblas 'openblas-devel' 'lapack-devel cblas-devel')"
 depends="python3-setuptools"
 short_desc="Fast and sophisticated array facility to Python3"
 maintainer="bra1nwave <bra1nwave@protonmail.com>"
@@ -15,7 +16,22 @@ distfiles="https://github.com/numpy/numpy/archive/v${version}.tar.gz"
 checksum=43fe3bcdf27a2eb27196a1d140385aeece71c8b1a6eda18d2c6365239e50c60f
 alternatives="numpy:f2py:/usr/bin/f2py3"
 
+build_options="openblas"
+desc_option_openblas="Enable support for openblas accelerated linear algebra"
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|i686*|aarch64*|armv[67]*|ppc64*)
+		# Prefer accelerated routines where available
+		build_options_default="openblas"
+		;;
+	*) ;;
+esac
+
 post_patch() {
+	if [ -n "$build_option_openblas" ] ; then
+		cp "${FILESDIR}/site.cfg.openblas" site.cfg
+	fi
+
 	case "${XBPS_TARGET_MACHINE}" in
 		armv5tel-musl)
 			cp "${FILESDIR}/fenv-constants.h" numpy/core/src/npymath/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR PATCH] [Updated] python3-numpy: Use OpenBLAS when available.
  2021-01-09 22:16 [PR PATCH] python3-numpy: Use OpenBLAS when available olafmersmann
  2021-01-09 22:20 ` [PR PATCH] [Updated] " olafmersmann
@ 2021-01-10 15:38 ` olafmersmann
  2021-01-10 19:12 ` [PR REVIEW] " ahesford
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: olafmersmann @ 2021-01-10 15:38 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 466 bytes --]

There is an updated pull request by olafmersmann against master on the void-packages repository

https://github.com/olafmersmann/void-packages python3-numpy
https://github.com/void-linux/void-packages/pull/27797

python3-numpy: Use OpenBLAS when available.
Just like `python3-scipy`, `python3-numpy` should use OpenBLAS when available and fall back to BLAS/LAPACK otherwise.

A patch file from https://github.com/void-linux/void-packages/pull/27797.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-python3-numpy-27797.patch --]
[-- Type: text/x-diff, Size: 2250 bytes --]

From cc6142b175c2e64ac72a5e72c52340e2e178b33b Mon Sep 17 00:00:00 2001
From: Olaf Mersmann <olafm@p-value.net>
Date: Sat, 9 Jan 2021 23:11:42 +0100
Subject: [PATCH] python3-numpy: Use OpenBLAS on platforms that support it.

---
 srcpkgs/python3-numpy/files/site.cfg.openblas |  4 ++++
 srcpkgs/python3-numpy/template                | 20 +++++++++++++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/python3-numpy/files/site.cfg.openblas

diff --git a/srcpkgs/python3-numpy/files/site.cfg.openblas b/srcpkgs/python3-numpy/files/site.cfg.openblas
new file mode 100644
index 00000000000..a83f9155faf
--- /dev/null
+++ b/srcpkgs/python3-numpy/files/site.cfg.openblas
@@ -0,0 +1,4 @@
+[openblas]
+libraries = openblas
+library_dirs = /usr/lib
+include_dirs = /usr/include
diff --git a/srcpkgs/python3-numpy/template b/srcpkgs/python3-numpy/template
index 619040f2892..a3e33570d9b 100644
--- a/srcpkgs/python3-numpy/template
+++ b/srcpkgs/python3-numpy/template
@@ -1,11 +1,12 @@
 # Template file for 'python3-numpy'
 pkgname=python3-numpy
 version=1.19.5
-revision=1
+revision=2
 wrksrc="numpy-${version}"
 build_style=python3-module
 hostmakedepends="python3-setuptools python3-Cython gcc-fortran"
-makedepends="python3-devel lapack-devel cblas-devel"
+makedepends="python3-devel
+ $(vopt_if openblas 'openblas-devel' 'lapack-devel cblas-devel')"
 depends="python3-setuptools"
 short_desc="Fast and sophisticated array facility to Python3"
 maintainer="bra1nwave <bra1nwave@protonmail.com>"
@@ -15,7 +16,22 @@ distfiles="https://github.com/numpy/numpy/archive/v${version}.tar.gz"
 checksum=43fe3bcdf27a2eb27196a1d140385aeece71c8b1a6eda18d2c6365239e50c60f
 alternatives="numpy:f2py:/usr/bin/f2py3"
 
+build_options="openblas"
+desc_option_openblas="Enable support for openblas accelerated linear algebra"
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|i686*|aarch64*|armv[67]*|ppc64*)
+		# Prefer accelerated routines where available
+		build_options_default="openblas"
+		;;
+	*) ;;
+esac
+
 post_patch() {
+	if [ -n "$build_option_openblas" ] ; then
+		cp "${FILESDIR}/site.cfg.openblas" site.cfg
+	fi
+
 	case "${XBPS_TARGET_MACHINE}" in
 		armv5tel-musl)
 			cp "${FILESDIR}/fenv-constants.h" numpy/core/src/npymath/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR REVIEW] python3-numpy: Use OpenBLAS when available.
  2021-01-09 22:16 [PR PATCH] python3-numpy: Use OpenBLAS when available olafmersmann
  2021-01-09 22:20 ` [PR PATCH] [Updated] " olafmersmann
  2021-01-10 15:38 ` olafmersmann
@ 2021-01-10 19:12 ` ahesford
  2021-01-10 20:59 ` [PR PATCH] [Updated] " olafmersmann
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ahesford @ 2021-01-10 19:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 273 bytes --]

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/27797#discussion_r554609916

Comment:
This will not work properly for cross compilation. See what we do in `python3-scipy` for the right way to handle `site.cfg`. 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR PATCH] [Updated] python3-numpy: Use OpenBLAS when available.
  2021-01-09 22:16 [PR PATCH] python3-numpy: Use OpenBLAS when available olafmersmann
                   ` (2 preceding siblings ...)
  2021-01-10 19:12 ` [PR REVIEW] " ahesford
@ 2021-01-10 20:59 ` olafmersmann
  2021-01-10 21:02 ` [PR REVIEW] " olafmersmann
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: olafmersmann @ 2021-01-10 20:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 466 bytes --]

There is an updated pull request by olafmersmann against master on the void-packages repository

https://github.com/olafmersmann/void-packages python3-numpy
https://github.com/void-linux/void-packages/pull/27797

python3-numpy: Use OpenBLAS when available.
Just like `python3-scipy`, `python3-numpy` should use OpenBLAS when available and fall back to BLAS/LAPACK otherwise.

A patch file from https://github.com/void-linux/void-packages/pull/27797.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-python3-numpy-27797.patch --]
[-- Type: text/x-diff, Size: 2213 bytes --]

From 94ea348e9a3b6da3f0062d58236e8a0b0b1a0d05 Mon Sep 17 00:00:00 2001
From: Olaf Mersmann <olafm@p-value.net>
Date: Sat, 9 Jan 2021 23:11:42 +0100
Subject: [PATCH] python3-numpy: Use OpenBLAS on supported platforms.

---
 srcpkgs/python3-numpy/template | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/python3-numpy/template b/srcpkgs/python3-numpy/template
index 619040f2892..c021e885476 100644
--- a/srcpkgs/python3-numpy/template
+++ b/srcpkgs/python3-numpy/template
@@ -1,11 +1,12 @@
 # Template file for 'python3-numpy'
 pkgname=python3-numpy
 version=1.19.5
-revision=1
+revision=2
 wrksrc="numpy-${version}"
 build_style=python3-module
 hostmakedepends="python3-setuptools python3-Cython gcc-fortran"
-makedepends="python3-devel lapack-devel cblas-devel"
+makedepends="python3-devel
+ $(vopt_if openblas 'openblas-devel' 'lapack-devel cblas-devel')"
 depends="python3-setuptools"
 short_desc="Fast and sophisticated array facility to Python3"
 maintainer="bra1nwave <bra1nwave@protonmail.com>"
@@ -15,6 +16,22 @@ distfiles="https://github.com/numpy/numpy/archive/v${version}.tar.gz"
 checksum=43fe3bcdf27a2eb27196a1d140385aeece71c8b1a6eda18d2c6365239e50c60f
 alternatives="numpy:f2py:/usr/bin/f2py3"
 
+build_options="openblas"
+desc_option_openblas="Enable support for openblas accelerated linear algebra"
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|i686*|aarch64*|armv[67]*|ppc64*)
+		# Prefer accelerated routines where available
+		build_options_default="openblas"
+		;;
+	*) ;;
+esac
+
+LDFLAGS+=" -shared"
+
+# Tell numpy to build in parallel
+export NPY_NUM_BUILD_JOBS="${XBPS_MAKEJOBS}"
+
 post_patch() {
 	case "${XBPS_TARGET_MACHINE}" in
 		armv5tel-musl)
@@ -26,6 +43,17 @@ post_patch() {
 
 pre_build() {
 	make_build_args+=" ${makejobs}"
+	# Find the right linear algebra subroutines on the target arch
+	: > site.cfg
+	for _blaslib in $(vopt_if openblas openblas "lapack blas"); do
+		cat >> site.cfg <<-EOF
+		[$_blaslib]
+		libraries = ${_blaslib}
+		include_dirs = ${XBPS_CROSS_BASE}/usr/include
+		library_dirs = ${XBPS_CROSS_BASE}/usr/lib
+		runtime_library_dirs = ${XBPS_CROSS_BASE}/usr/lib
+		EOF
+	done
 }
 
 do_check() {

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR REVIEW] python3-numpy: Use OpenBLAS when available.
  2021-01-09 22:16 [PR PATCH] python3-numpy: Use OpenBLAS when available olafmersmann
                   ` (3 preceding siblings ...)
  2021-01-10 20:59 ` [PR PATCH] [Updated] " olafmersmann
@ 2021-01-10 21:02 ` olafmersmann
  2021-01-12 23:53 ` [PR PATCH] [Updated] " olafmersmann
  2021-01-17 18:12 ` [PR PATCH] [Closed]: " ahesford
  6 siblings, 0 replies; 8+ messages in thread
From: olafmersmann @ 2021-01-10 21:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 207 bytes --]

New review comment by olafmersmann on void-packages repository

https://github.com/void-linux/void-packages/pull/27797#discussion_r554622289

Comment:
Changed it to generate the `site.cfg` file dynamically.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR PATCH] [Updated] python3-numpy: Use OpenBLAS when available.
  2021-01-09 22:16 [PR PATCH] python3-numpy: Use OpenBLAS when available olafmersmann
                   ` (4 preceding siblings ...)
  2021-01-10 21:02 ` [PR REVIEW] " olafmersmann
@ 2021-01-12 23:53 ` olafmersmann
  2021-01-17 18:12 ` [PR PATCH] [Closed]: " ahesford
  6 siblings, 0 replies; 8+ messages in thread
From: olafmersmann @ 2021-01-12 23:53 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 466 bytes --]

There is an updated pull request by olafmersmann against master on the void-packages repository

https://github.com/olafmersmann/void-packages python3-numpy
https://github.com/void-linux/void-packages/pull/27797

python3-numpy: Use OpenBLAS when available.
Just like `python3-scipy`, `python3-numpy` should use OpenBLAS when available and fall back to BLAS/LAPACK otherwise.

A patch file from https://github.com/void-linux/void-packages/pull/27797.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-python3-numpy-27797.patch --]
[-- Type: text/x-diff, Size: 2393 bytes --]

From dd199cc610834dff033ba9f5675fbe8048fdc8fd Mon Sep 17 00:00:00 2001
From: Olaf Mersmann <olafm@p-value.net>
Date: Sat, 9 Jan 2021 23:11:42 +0100
Subject: [PATCH] python3-numpy: Use OpenBLAS on supported platforms.

---
 srcpkgs/python3-numpy/template | 36 ++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/python3-numpy/template b/srcpkgs/python3-numpy/template
index 619040f2892..de1dfe62be4 100644
--- a/srcpkgs/python3-numpy/template
+++ b/srcpkgs/python3-numpy/template
@@ -1,11 +1,12 @@
 # Template file for 'python3-numpy'
 pkgname=python3-numpy
 version=1.19.5
-revision=1
+revision=2
 wrksrc="numpy-${version}"
 build_style=python3-module
 hostmakedepends="python3-setuptools python3-Cython gcc-fortran"
-makedepends="python3-devel lapack-devel cblas-devel"
+makedepends="python3-devel
+ $(vopt_if openblas 'openblas-devel' 'lapack-devel cblas-devel')"
 depends="python3-setuptools"
 short_desc="Fast and sophisticated array facility to Python3"
 maintainer="bra1nwave <bra1nwave@protonmail.com>"
@@ -15,6 +16,22 @@ distfiles="https://github.com/numpy/numpy/archive/v${version}.tar.gz"
 checksum=43fe3bcdf27a2eb27196a1d140385aeece71c8b1a6eda18d2c6365239e50c60f
 alternatives="numpy:f2py:/usr/bin/f2py3"
 
+build_options="openblas"
+desc_option_openblas="Enable support for openblas accelerated linear algebra"
+
+case "$XBPS_TARGET_MACHINE" in
+	x86_64*|i686*|aarch64*|armv[67]*|ppc64*)
+		# Prefer accelerated routines where available
+		build_options_default="openblas"
+		;;
+	*) ;;
+esac
+
+LDFLAGS+=" -shared"
+
+# Tell numpy to build in parallel
+export NPY_NUM_BUILD_JOBS="${XBPS_MAKEJOBS}"
+
 post_patch() {
 	case "${XBPS_TARGET_MACHINE}" in
 		armv5tel-musl)
@@ -22,10 +39,25 @@ post_patch() {
 			patch -Np0 -i "${FILESDIR}/fenv-constants.patch"
 			;;
 	esac
+
+	if [ "$XBPS_TARGET_LIBC" = musl ] ; then
+		vsed -i 's|"backtrace",||' numpy/core/setup_common.py
+	fi
 }
 
 pre_build() {
 	make_build_args+=" ${makejobs}"
+	# Find the right linear algebra subroutines on the target arch
+	: > site.cfg
+	for _blaslib in $(vopt_if openblas openblas "lapack blas"); do
+		cat >> site.cfg <<-EOF
+		[$_blaslib]
+		libraries = ${_blaslib}
+		include_dirs = ${XBPS_CROSS_BASE}/usr/include
+		library_dirs = ${XBPS_CROSS_BASE}/usr/lib
+		runtime_library_dirs = ${XBPS_CROSS_BASE}/usr/lib
+		EOF
+	done
 }
 
 do_check() {

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PR PATCH] [Closed]: python3-numpy: Use OpenBLAS when available.
  2021-01-09 22:16 [PR PATCH] python3-numpy: Use OpenBLAS when available olafmersmann
                   ` (5 preceding siblings ...)
  2021-01-12 23:53 ` [PR PATCH] [Updated] " olafmersmann
@ 2021-01-17 18:12 ` ahesford
  6 siblings, 0 replies; 8+ messages in thread
From: ahesford @ 2021-01-17 18:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 294 bytes --]

There's a closed pull request on the void-packages repository

python3-numpy: Use OpenBLAS when available.
https://github.com/void-linux/void-packages/pull/27797

Description:
Just like `python3-scipy`, `python3-numpy` should use OpenBLAS when available and fall back to BLAS/LAPACK otherwise.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-01-17 18:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-09 22:16 [PR PATCH] python3-numpy: Use OpenBLAS when available olafmersmann
2021-01-09 22:20 ` [PR PATCH] [Updated] " olafmersmann
2021-01-10 15:38 ` olafmersmann
2021-01-10 19:12 ` [PR REVIEW] " ahesford
2021-01-10 20:59 ` [PR PATCH] [Updated] " olafmersmann
2021-01-10 21:02 ` [PR REVIEW] " olafmersmann
2021-01-12 23:53 ` [PR PATCH] [Updated] " olafmersmann
2021-01-17 18:12 ` [PR PATCH] [Closed]: " ahesford

Github messages for voidlinux

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/voidlinux-github

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 voidlinux-github voidlinux-github/ http://inbox.vuxu.org/voidlinux-github \
		voidlinux-github@inbox.vuxu.org
	public-inbox-index voidlinux-github

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.github.voidlinux


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git