pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/math/py-numpy
Module Name: pkgsrc
Committed By: thor
Date: Tue Apr 20 20:53:49 UTC 2021
Modified Files:
pkgsrc/math/py-numpy: Makefile buildlink3.mk distinfo
pkgsrc/math/py-numpy/patches: patch-numpy_distutils_system__info.py
Added Files:
pkgsrc/math/py-numpy: Makefile.make_env
Log Message:
math/py-numpy: updated system_info patch to upstreamed version, use cblas
The patch to system_info.py got upstreamed in a modified form which is
now backported here. On updating to 1.21, it shall be dropped.
In the process of upstreaming the patch, I learned that numpy really
needs to use cblas for proper acceleration, so it does that now and
gets a PKGREVISION bump because of that.
To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 pkgsrc/math/py-numpy/Makefile
cvs rdiff -u -r0 -r1.1 pkgsrc/math/py-numpy/Makefile.make_env
cvs rdiff -u -r1.8 -r1.9 pkgsrc/math/py-numpy/buildlink3.mk
cvs rdiff -u -r1.59 -r1.60 pkgsrc/math/py-numpy/distinfo
cvs rdiff -u -r1.6 -r1.7 \
pkgsrc/math/py-numpy/patches/patch-numpy_distutils_system__info.py
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/math/py-numpy/Makefile
diff -u pkgsrc/math/py-numpy/Makefile:1.77 pkgsrc/math/py-numpy/Makefile:1.78
--- pkgsrc/math/py-numpy/Makefile:1.77 Wed Apr 7 11:57:30 2021
+++ pkgsrc/math/py-numpy/Makefile Tue Apr 20 20:53:48 2021
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.77 2021/04/07 11:57:30 thor Exp $
+# $NetBSD: Makefile,v 1.78 2021/04/20 20:53:48 thor Exp $
DISTNAME= numpy-1.19.5
-PKGREVISION= 3
+PKGREVISION= 4
PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
CATEGORIES= math python
MASTER_SITES= ${MASTER_SITE_PYPI:=n/numpy/}
@@ -18,11 +18,8 @@ TEST_DEPENDS+= ${PYPKGPREFIX}-test-[0-9]
# error: 'for' loop initial declarations are only allowed in C99 mode
USE_LANGUAGES= c99 fortran
-# Use our BLAS. The patch adds 'generic' as first entry anyway, but we
-# enforce it to fail early and for the case that upstream accepts the
-# patch, but with changed default order.
-MAKE_ENV+= BLAS_LIBS=${BLAS_LIBS:Q} LAPACK_LIBS=${LAPACK_LIBS:Q}
-MAKE_ENV+= NPY_BLAS_ORDER=generic NPY_LAPACK_ORDER=generic
+
+.include "../../math/py-numpy/Makefile.make_env"
REPLACE_PYTHON+= *.py */*.py */*/*.py */*/*/*.py */*/*/*/*.py
@@ -61,9 +58,6 @@ BUILDLINK_API_DEPENDS.py-cython+= ${PYPK
.include "../../devel/py-cython/buildlink3.mk"
.include "../../lang/python/application.mk"
.include "../../lang/python/egg.mk"
-# Consider allowing mk/blas.buildlink3.mk to handle Accelerate.framework
-.if ${OPSYS} != "Darwin"
-# blas and lapack are not needed; numpy will use Accelerate.framework
-.include "../../mk/blas.buildlink3.mk"
-.endif
+# BLAS with CBLAS is needed for proper acceleration.
+.include "../../math/cblas/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/math/py-numpy/buildlink3.mk
diff -u pkgsrc/math/py-numpy/buildlink3.mk:1.8 pkgsrc/math/py-numpy/buildlink3.mk:1.9
--- pkgsrc/math/py-numpy/buildlink3.mk:1.8 Thu Mar 25 21:47:50 2021
+++ pkgsrc/math/py-numpy/buildlink3.mk Tue Apr 20 20:53:48 2021
@@ -1,4 +1,4 @@
-# $NetBSD: buildlink3.mk,v 1.8 2021/03/25 21:47:50 thor Exp $
+# $NetBSD: buildlink3.mk,v 1.9 2021/04/20 20:53:48 thor Exp $
BUILDLINK_TREE+= py-numpy
@@ -18,13 +18,9 @@ BUILDLINK_PKGSRCDIR.py-numpy?= ../../ma
.include "../../mk/bsd.fast.prefs.mk"
-# Dependend python packages re-use the BLAS_LIBS logic and
-# need this in the environment.
-MAKE_ENV+= BLAS_LIBS=${BLAS_LIBS:Q} LAPACK_LIBS=${LAPACK_LIBS:Q}
+.include "../../math/py-numpy/Makefile.make_env"
+.include "../../math/cblas/buildlink3.mk"
-.if ${OPSYS} != "Darwin"
-.include "../../mk/blas.buildlink3.mk"
-.endif
.endif # PY_NUMPY_BUILDLINK3_MK
BUILDLINK_TREE+= -py-numpy
Index: pkgsrc/math/py-numpy/distinfo
diff -u pkgsrc/math/py-numpy/distinfo:1.59 pkgsrc/math/py-numpy/distinfo:1.60
--- pkgsrc/math/py-numpy/distinfo:1.59 Wed Apr 7 11:57:30 2021
+++ pkgsrc/math/py-numpy/distinfo Tue Apr 20 20:53:48 2021
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.59 2021/04/07 11:57:30 thor Exp $
+$NetBSD: distinfo,v 1.60 2021/04/20 20:53:48 thor Exp $
SHA1 (numpy-1.19.5.zip) = 61f0b3dad58ce97b14da9dccbee0722d36f26937
RMD160 (numpy-1.19.5.zip) = 3317c98790e8c2d1d9c36279b3451f09b6776935
@@ -7,5 +7,5 @@ Size (numpy-1.19.5.zip) = 7318340 bytes
SHA1 (patch-numpy_distutils_fcompiler_____init____.py) = 49d070da5b48bd9818b37ac3254341fa68503c53
SHA1 (patch-numpy_distutils_fcompiler_g95.py) = be73b64a3e551df998b6a904d6db762bf28a98ed
SHA1 (patch-numpy_distutils_fcompiler_gnu.py) = 1d62e1c5e35de0f2cf975de38f62df7f10c71d74
-SHA1 (patch-numpy_distutils_system__info.py) = 8322a9f27f61626812509e26c80cb9f9b49ced7e
+SHA1 (patch-numpy_distutils_system__info.py) = 6910006662d49408186ac5f687eb20114ff9eb89
SHA1 (patch-numpy_linalg_lapack__litemodule.c) = e97ec871c2f33c3121b3c8471a9e5a74c3c798c8
Index: pkgsrc/math/py-numpy/patches/patch-numpy_distutils_system__info.py
diff -u pkgsrc/math/py-numpy/patches/patch-numpy_distutils_system__info.py:1.6 pkgsrc/math/py-numpy/patches/patch-numpy_distutils_system__info.py:1.7
--- pkgsrc/math/py-numpy/patches/patch-numpy_distutils_system__info.py:1.6 Wed Apr 7 11:57:30 2021
+++ pkgsrc/math/py-numpy/patches/patch-numpy_distutils_system__info.py Tue Apr 20 20:53:49 2021
@@ -1,78 +1,88 @@
-$NetBSD: patch-numpy_distutils_system__info.py,v 1.6 2021/04/07 11:57:30 thor Exp $
+$NetBSD: patch-numpy_distutils_system__info.py,v 1.7 2021/04/20 20:53:49 thor Exp $
-Introduce new option 'generic' for BLAS and LAPACK
-TODO: The same for 64 bit offset versions, but we'd need repspective BLAS builds
-first in pkgsrc to test.
-
---- numpy/distutils/system_info.py.orig 2021-01-04 14:16:38.000000000 +0000
+--- numpy/distutils/system_info.py.orig 2021-04-20 18:13:28.992593008 +0000
+++ numpy/distutils/system_info.py
-@@ -114,6 +114,13 @@ Currently, the following classes are ava
+@@ -114,6 +114,19 @@ Currently, the following classes are ava
x11_info:x11
xft_info:xft
-+Note that blas_opt_info and lapack_opt_info honor the NPY_BLAS_ORDER and NPY_LAPACK_ORDER
-+environment variables to select a specific implementation. One possible implementation
-+is 'generic', which relies on the environment providing BLAS_LIBS and LAPACK_LIBS to
-+link to the customary plain f77 interface, supporting any standard-conforming BLAS
-+and LAPACK implementation (which might be different between build-time and run-time,
-+even).
++Note that blas_opt_info and lapack_opt_info honor the NPY_BLAS_ORDER
++and NPY_LAPACK_ORDER environment variables to determine the order in which
++specific BLAS and LAPACK libraries are searched for.
++
++This search (or autodetection) can be bypassed by defining the environment
++variables NPY_BLAS_LIBS and NPY_LAPACK_LIBS, which should then contain the
++exact linker flags to use (language will be set to F77). Building against
++Netlib BLAS/LAPACK or stub files, in order to be able to switch BLAS and LAPACK
++implementations at runtime. If using this to build NumPy itself, it is
++recommended to also define NPY_CBLAS_LIBS (assuming your BLAS library has a
++CBLAS interface) to enable CBLAS usage for matrix multiplication (unoptimized
++otherwise).
+
Example:
----------
[DEFAULT]
-@@ -1651,7 +1658,7 @@ def get_atlas_version(**config):
- class lapack_opt_info(system_info):
- notfounderror = LapackNotFoundError
- # List of all known BLAS libraries, in the default order
-- lapack_order = ['mkl', 'openblas', 'flame', 'atlas', 'accelerate', 'lapack']
-+ lapack_order = ['generic', 'mkl', 'openblas', 'flame', 'atlas', 'accelerate', 'lapack']
- order_env_var_name = 'NPY_LAPACK_ORDER'
-
- def _calc_info_mkl(self):
-@@ -1744,6 +1751,18 @@ class lapack_opt_info(system_info):
+@@ -1744,6 +1757,16 @@ class lapack_opt_info(system_info):
return True
return False
-+ def _calc_info_generic(self):
-+ if 'LAPACK_LIBS' in os.environ:
-+ info = {}
-+ info['language'] = 'f77'
-+ info['libraries'] = []
-+ info['include_dirs'] = []
-+ info['define_macros'] = []
-+ info['extra_link_args'] = os.environ['LAPACK_LIBS'].split()
-+ self.set_info(**info)
-+ return True
-+ return False
++ def _calc_info_from_envvar(self):
++ info = {}
++ info['language'] = 'f77'
++ info['libraries'] = []
++ info['include_dirs'] = []
++ info['define_macros'] = []
++ info['extra_link_args'] = os.environ['NPY_LAPACK_LIBS'].split()
++ self.set_info(**info)
++ return True
+
def _calc_info(self, name):
return getattr(self, '_calc_info_{}'.format(name))()
-@@ -1823,7 +1842,7 @@ class lapack64__opt_info(lapack_ilp64_op
- class blas_opt_info(system_info):
- notfounderror = BlasNotFoundError
- # List of all known BLAS libraries, in the default order
-- blas_order = ['mkl', 'blis', 'openblas', 'atlas', 'accelerate', 'blas']
-+ blas_order = ['generic', 'mkl', 'blis', 'openblas', 'atlas', 'accelerate', 'blas']
- order_env_var_name = 'NPY_BLAS_ORDER'
-
- def _calc_info_mkl(self):
-@@ -1889,6 +1908,18 @@ class blas_opt_info(system_info):
+@@ -1767,6 +1790,12 @@ class lapack_opt_info(system_info):
+ "LAPACK order has unacceptable "
+ "values: {}".format(non_existing))
+
++ if 'NPY_LAPACK_LIBS' in os.environ:
++ # Bypass autodetection, set language to F77 and use env var linker
++ # flags directly
++ self._calc_info_from_envvar()
++ return
++
+ for lapack in lapack_order:
+ if self._calc_info(lapack):
+ return
+@@ -1889,6 +1918,20 @@ class blas_opt_info(system_info):
self.set_info(**info)
return True
-+ def _calc_info_generic(self):
-+ if 'BLAS_LIBS' in os.environ:
-+ info = {}
-+ info['language'] = 'f77'
-+ info['libraries'] = []
-+ info['include_dirs'] = []
-+ info['define_macros'] = []
-+ info['extra_link_args'] = os.environ['BLAS_LIBS'].split()
-+ self.set_info(**info)
-+ return True
-+ return False
++ def _calc_info_from_envvar(self):
++ info = {}
++ info['language'] = 'f77'
++ info['libraries'] = []
++ info['include_dirs'] = []
++ info['define_macros'] = []
++ info['extra_link_args'] = os.environ['NPY_BLAS_LIBS'].split()
++ if 'NPY_CBLAS_LIBS' in os.environ:
++ info['define_macros'].append(('HAVE_CBLAS', None))
++ info['extra_link_args'].extend(
++ os.environ['NPY_CBLAS_LIBS'].split())
++ self.set_info(**info)
++ return True
+
def _calc_info(self, name):
return getattr(self, '_calc_info_{}'.format(name))()
+@@ -1910,6 +1953,12 @@ class blas_opt_info(system_info):
+ if len(non_existing) > 0:
+ raise ValueError("blas_opt_info user defined BLAS order has unacceptable values: {}".format(non_existing))
+
++ if 'NPY_BLAS_LIBS' in os.environ:
++ # Bypass autodetection, set language to F77 and use env var linker
++ # flags directly
++ self._calc_info_from_envvar()
++ return
++
+ for blas in blas_order:
+ if self._calc_info(blas):
+ return
Added files:
Index: pkgsrc/math/py-numpy/Makefile.make_env
diff -u /dev/null pkgsrc/math/py-numpy/Makefile.make_env:1.1
--- /dev/null Tue Apr 20 20:53:49 2021
+++ pkgsrc/math/py-numpy/Makefile.make_env Tue Apr 20 20:53:48 2021
@@ -0,0 +1,5 @@
+# Use the variables from blas.buildlink3.mk, pulled in via cblas.
+# Dependend python packages possiblly re-use the system_info logic and
+# might need this in the environment.
+MAKE_ENV+= NPY_BLAS_LIBS=${BLAS_LIBS:Q} NPY_LAPACK_LIBS=${LAPACK_LIBS:Q}
+MAKE_ENV+= NPY_CBLAS_LIBS=-lcblas
Home |
Main Index |
Thread Index |
Old Index