Github messages for voidlinux
 help / color / mirror / Atom feed
From: olafmersmann <olafmersmann@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] python3-numpy: Use OpenBLAS when available.
Date: Sun, 10 Jan 2021 21:59:17 +0100	[thread overview]
Message-ID: <20210110205917.NaxQdfcJhJYjhw4M0BJFPba7aHcWyoZPjQspISA9IbQ@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-27797@inbox.vuxu.org>

[-- 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() {

  parent reply	other threads:[~2021-01-10 20:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-09 22:16 [PR PATCH] " 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 ` olafmersmann [this message]
2021-01-10 21:02 ` olafmersmann
2021-01-12 23:53 ` [PR PATCH] [Updated] " olafmersmann
2021-01-17 18:12 ` [PR PATCH] [Closed]: " ahesford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210110205917.NaxQdfcJhJYjhw4M0BJFPba7aHcWyoZPjQspISA9IbQ@z \
    --to=olafmersmann@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).