pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk mk/blas.bl3, Netlib and OpenBLAS packages, NumPy: C...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/7fd4904d55f9
branches:  trunk
changeset: 454691:7fd4904d55f9
user:      thor <thor%pkgsrc.org@localhost>
date:      Tue Jun 15 04:41:51 2021 +0000

description:
mk/blas.bl3, Netlib and OpenBLAS packages, NumPy: C fixup and 64 bits

This delivers 64 bit index BLAS libraries alongside 32 bit ones. This is often
called ILP64 in the BLAS world, as opposed to LP64 where integers are 32 bit
due to the Fortran default integer type, not to be confused with the basic
system ABI used by C. For really large vectors on modern machines, you want
an 'ILP64' BLAS and layers on top of it.

In preparation of better support for vendor BLAS libraries, I had to realize
that you better use the C interfaces supplied by them, not the netlib one
strapped on. A simple reason of practicability: The vendor blas libraries,
just like openblas, like to ship all symbols in one library, so you get them
whether you want it or not. Also implementations may skip Fortran and implement
the underlying functionality directly in C anyway, so one might skip a
layer of indirection. Future will tell if other layers will follow. We still
have the framework of individual layers from Netlib to combine with certain
implementations that miss them (Accelerate framework comes to mind, which
needs further work).

The framework of netlib reference packages for the separate libraries
is instructive and helps keeping things small when you not need all of them.
The installation location of the headers is now in a subdirectory to be able
to have 32 and 64 bit variants independently. The 32 bit ones are linked to
${PREFIX}/include to keep the old picture. We could be brave and remove
those, but there is some value in a build just trying -lcblas and
inclusion of <cblas.h> to be happy.

There is one blas.buildlink3.mk that is supposed to be used only once and
so avoids a combination of conflicting libraries (as the 64 bit index symbols
have the same names as the 32 bit ones).

Basic usage for getting LAPACK+BLAS is still the same as before. You get
CBLAS and LAPACKE by setting BLAS_C_INTERFACE=yes in the package. The 64 bit
indices are selected via BLAS_INDEX64=yes.

Due to the special nature of the Accelerate framework, a package has to
explicitly indicate support for it and it will also not appear on the
list of implementations by default. The reason is that it does provide
mainly CBLAS and CLAPACK (another version of C interface to LAPACK, f2c-based)
and BLAS/LAPACK with f2c/g77 calling conventions. A default build with
gfortran would not like that

This commit also fixes up math/py-numpy and math/py-numpy16 to follow the
new scheme, as that are the only packages directly affected by the change
in CBLAS providership.

diffstat:

 math/blas/Makefile                    |    6 +-
 math/blas64/DESCR                     |    9 ++
 math/blas64/Makefile                  |   14 +++
 math/blas64/PLIST                     |    6 +
 math/blas64/buildlink3.mk             |   13 +++
 math/cblas/Makefile                   |   14 +-
 math/cblas/PLIST                      |    6 +-
 math/cblas/buildlink3.mk              |    6 +-
 math/cblas64/DESCR                    |    2 +
 math/cblas64/Makefile                 |   17 ++++
 math/cblas64/PLIST                    |   10 ++
 math/cblas64/buildlink3.mk            |   14 +++
 math/lapack/Makefile.common           |   37 ++++++++-
 math/lapack64/DESCR                   |   22 +++++
 math/lapack64/Makefile                |   17 ++++
 math/lapack64/PLIST                   |    6 +
 math/lapack64/buildlink3.mk           |   16 ++++
 math/lapack64/version.mk              |    3 +
 math/lapacke/Makefile                 |   14 ++-
 math/lapacke/PLIST                    |    7 +-
 math/lapacke/buildlink3.mk            |    5 +-
 math/lapacke64/DESCR                  |    2 +
 math/lapacke64/Makefile               |   18 ++++
 math/lapacke64/PLIST                  |   11 ++
 math/lapacke64/buildlink3.mk          |   14 +++
 math/openblas/Makefile                |    5 +-
 math/openblas/Makefile.common         |   38 +++++++--
 math/openblas/PLIST                   |   17 +++-
 math/openblas/buildlink3.mk           |    3 +-
 math/openblas64/DESCR                 |    6 +
 math/openblas64/Makefile              |    7 +
 math/openblas64/buildlink3.mk         |   12 +++
 math/openblas64_openmp/DESCR          |    6 +
 math/openblas64_openmp/Makefile       |    7 +
 math/openblas64_openmp/buildlink3.mk  |   12 +++
 math/openblas64_pthread/DESCR         |    6 +
 math/openblas64_pthread/Makefile      |    7 +
 math/openblas64_pthread/buildlink3.mk |   12 +++
 math/openblas_openmp/Makefile         |    3 +-
 math/openblas_openmp/buildlink3.mk    |    3 +-
 math/openblas_pthread/Makefile        |    3 +-
 math/openblas_pthread/buildlink3.mk   |    3 +-
 math/py-numpy/Makefile                |   10 +-
 math/py-numpy/Makefile.make_env       |    8 +-
 math/py-numpy/buildlink3.mk           |   13 ++-
 math/py-numpy16/Makefile              |   10 +-
 mk/blas.buildlink3.mk                 |  126 +++++++++++++++++++++++++++------
 47 files changed, 519 insertions(+), 87 deletions(-)

diffs (truncated from 1117 to 300 lines):

diff -r 42f989f79856 -r 7fd4904d55f9 math/blas/Makefile
--- a/math/blas/Makefile        Tue Jun 15 04:07:33 2021 +0000
+++ b/math/blas/Makefile        Tue Jun 15 04:41:51 2021 +0000
@@ -1,7 +1,6 @@
-# $NetBSD: Makefile,v 1.39 2021/05/12 14:32:52 thor Exp $
+# $NetBSD: Makefile,v 1.40 2021/06/15 04:41:51 thor Exp $
 
-.include "../../math/lapack/Makefile.common"
-
+MAINTAINER=    thomas.orgis%uni-hamburg.de@localhost
 COMMENT=       Basic Linear Algebra System (Netlib reference implementation)
 
 LAPACK_COMPONENT=      blas
@@ -9,4 +8,5 @@
        -DUSE_OPTIMIZED_BLAS=OFF \
        -DCBLAS=OFF -DLAPACKE=OFF -DLAPACK=OFF
 
+.include "../../math/lapack/Makefile.common"
 .include "../../mk/bsd.pkg.mk"
diff -r 42f989f79856 -r 7fd4904d55f9 math/blas64/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/math/blas64/DESCR Tue Jun 15 04:41:51 2021 +0000
@@ -0,0 +1,9 @@
+The BLAS (Basic Linear Algebra Subprograms) are high quality "building
+block" routines for performing basic vector and matrix
+operations. Level 1 BLAS do vector-vector operations, Level 2 BLAS do
+matrix-vector operations, and Level 3 BLAS do matrix-matrix
+operations. Because the BLAS are efficient, portable, and widely
+available, they're commonly used in the development of high quality
+linear algebra software, LINPACK and LAPACK for example.
+
+This package contains the Fortran 77 reference implementation of BLAS.
diff -r 42f989f79856 -r 7fd4904d55f9 math/blas64/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/math/blas64/Makefile      Tue Jun 15 04:41:51 2021 +0000
@@ -0,0 +1,14 @@
+# $NetBSD: Makefile,v 1.1 2021/06/15 04:41:51 thor Exp $
+
+
+MAINTAINER=    thomas.orgis%uni-hamburg.de@localhost
+COMMENT=       Reference Basic Linear Algebra System with 64 bit indices
+
+LAPACK_COMPONENT=      blas64
+LAPACK_COMPONENT_CMAKE_ARGS=   \
+       -DBUILD_INDEX64=ON \
+       -DUSE_OPTIMIZED_BLAS=OFF \
+       -DCBLAS=OFF -DLAPACKE=OFF -DLAPACK=OFF
+
+.include "../../math/lapack/Makefile.common"
+.include "../../mk/bsd.pkg.mk"
diff -r 42f989f79856 -r 7fd4904d55f9 math/blas64/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/math/blas64/PLIST Tue Jun 15 04:41:51 2021 +0000
@@ -0,0 +1,6 @@
+@comment $NetBSD: PLIST,v 1.1 2021/06/15 04:41:51 thor Exp $
+lib/libblas64.a
+lib/libblas64.so
+lib/libblas64.so.3
+lib/libblas64.so.${PKGVERSION}
+lib/pkgconfig/blas64.pc
diff -r 42f989f79856 -r 7fd4904d55f9 math/blas64/buildlink3.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/math/blas64/buildlink3.mk Tue Jun 15 04:41:51 2021 +0000
@@ -0,0 +1,13 @@
+# $NetBSD: buildlink3.mk,v 1.1 2021/06/15 04:41:51 thor Exp $
+
+BUILDLINK_TREE+=       blas64
+
+.if !defined(BLAS64_BUILDLINK3_MK)
+BLAS64_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.blas64+= blas64>=3.9.0
+BUILDLINK_ABI_DEPENDS.blas64+= blas64>=3.9.0
+BUILDLINK_PKGSRCDIR.blas64?=   ../../math/blas64
+.endif # BLAS64_BUILDLINK3_MK
+
+BUILDLINK_TREE+=       -blas64
diff -r 42f989f79856 -r 7fd4904d55f9 math/cblas/Makefile
--- a/math/cblas/Makefile       Tue Jun 15 04:07:33 2021 +0000
+++ b/math/cblas/Makefile       Tue Jun 15 04:41:51 2021 +0000
@@ -1,17 +1,17 @@
-# $NetBSD: Makefile,v 1.2 2021/06/10 00:18:52 thor Exp $
+# $NetBSD: Makefile,v 1.3 2021/06/15 04:41:52 thor Exp $
 
-COMMENT=       C interface to a BLAS library
+MAINTAINER=    thomas.orgis%uni-hamburg.de@localhost
+COMMENT=       C interface to the reference BLAS library
 PKGREVISION=   1
 
 LAPACK_COMPONENT=      cblas
 LAPACK_COMPONENT_CMAKE_ARGS=   \
        -DUSE_OPTIMIZED_BLAS=ON \
-       -DBLAS_LIBRARIES=${BLAS_LIBS:Q} \
-       -DUSE_OPTIMIZED_LAPACK=ON \
-       -DLAPACK_LIBRARIES=${LAPACK_LIBS:Q} \
-       -DCBLAS=ON -DLAPACKE=OFF \
+       -DBLAS_LIBRARIES=-lblas \
+       -DCBLAS=ON -DLAPACKE=OFF -DLAPACK=OFF \
        -DCMAKE_VERBOSE=ON
 
-.include "../../mk/blas.buildlink3.mk"
+.include "../../math/blas/buildlink3.mk"
+
 .include "../../math/lapack/Makefile.common"
 .include "../../mk/bsd.pkg.mk"
diff -r 42f989f79856 -r 7fd4904d55f9 math/cblas/PLIST
--- a/math/cblas/PLIST  Tue Jun 15 04:07:33 2021 +0000
+++ b/math/cblas/PLIST  Tue Jun 15 04:41:51 2021 +0000
@@ -1,8 +1,12 @@
-@comment $NetBSD: PLIST,v 1.2 2021/06/10 00:18:52 thor Exp $
+@comment $NetBSD: PLIST,v 1.3 2021/06/15 04:41:52 thor Exp $
 include/cblas.h
 include/cblas_f77.h
 include/cblas_mangling.h
 include/cblas_test.h
+include/netlib/cblas.h
+include/netlib/cblas_f77.h
+include/netlib/cblas_mangling.h
+include/netlib/cblas_test.h
 lib/libcblas.a
 lib/libcblas.so
 lib/libcblas.so.3
diff -r 42f989f79856 -r 7fd4904d55f9 math/cblas/buildlink3.mk
--- a/math/cblas/buildlink3.mk  Tue Jun 15 04:07:33 2021 +0000
+++ b/math/cblas/buildlink3.mk  Tue Jun 15 04:41:51 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: buildlink3.mk,v 1.1 2021/04/20 20:37:03 thor Exp $
+# $NetBSD: buildlink3.mk,v 1.2 2021/06/15 04:41:52 thor Exp $
 
 BUILDLINK_TREE+=       cblas
 
@@ -6,10 +6,10 @@
 CBLAS_BUILDLINK3_MK:=
 
 BUILDLINK_API_DEPENDS.cblas+=  cblas>=3.9.0
+BUILDLINK_ABI_DEPENDS.cblas?=  cblas>=3.9.1nb1
 BUILDLINK_PKGSRCDIR.cblas?=    ../../math/cblas
 
-.include       "../../mk/blas.buildlink3.mk"
+.include       "../../math/blas/buildlink3.mk"
 .endif
 
-
 BUILDLINK_TREE+=       -cblas
diff -r 42f989f79856 -r 7fd4904d55f9 math/cblas64/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/math/cblas64/DESCR        Tue Jun 15 04:41:51 2021 +0000
@@ -0,0 +1,2 @@
+This is the C wrapper to the Basic Linear Algebra Support library
+(CBLAS), extracted from the Netlib reference implementation of LAPACK.
diff -r 42f989f79856 -r 7fd4904d55f9 math/cblas64/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/math/cblas64/Makefile     Tue Jun 15 04:41:51 2021 +0000
@@ -0,0 +1,17 @@
+# $NetBSD: Makefile,v 1.1 2021/06/15 04:41:52 thor Exp $
+
+MAINTAINER=    thomas.orgis%uni-hamburg.de@localhost
+COMMENT=       C interface to the reference BLAS with 64 bit indices
+
+LAPACK_COMPONENT=      cblas64
+LAPACK_COMPONENT_CMAKE_ARGS=   \
+       -DBUILD_INDEX64=ON \
+       -DUSE_OPTIMIZED_BLAS=ON \
+       -DBLAS_LIBRARIES=-lblas64 \
+       -DCBLAS=ON -DLAPACKE=OFF -DLAPACK=OFF \
+       -DCMAKE_VERBOSE=ON
+
+.include "../../math/blas64/buildlink3.mk"
+
+.include "../../math/lapack/Makefile.common"
+.include "../../mk/bsd.pkg.mk"
diff -r 42f989f79856 -r 7fd4904d55f9 math/cblas64/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/math/cblas64/PLIST        Tue Jun 15 04:41:51 2021 +0000
@@ -0,0 +1,10 @@
+@comment $NetBSD: PLIST,v 1.1 2021/06/15 04:41:52 thor Exp $
+include/netlib64/cblas.h
+include/netlib64/cblas_f77.h
+include/netlib64/cblas_mangling.h
+include/netlib64/cblas_test.h
+lib/libcblas64.a
+lib/libcblas64.so
+lib/libcblas64.so.3
+lib/libcblas64.so.${PKGVERSION}
+lib/pkgconfig/cblas64.pc
diff -r 42f989f79856 -r 7fd4904d55f9 math/cblas64/buildlink3.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/math/cblas64/buildlink3.mk        Tue Jun 15 04:41:51 2021 +0000
@@ -0,0 +1,14 @@
+# $NetBSD: buildlink3.mk,v 1.1 2021/06/15 04:41:52 thor Exp $
+
+BUILDLINK_TREE+=       cblas64
+
+.if !defined(CBLAS64_BUILDLINK3_MK)
+CBLAS64_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.cblas64+=        cblas64>=3.9.0
+BUILDLINK_PKGSRCDIR.cblas64?=  ../../math/cblas64
+
+.include       "../../math/blas64/buildlink3.mk"
+.endif
+
+BUILDLINK_TREE+=       -cblas64
diff -r 42f989f79856 -r 7fd4904d55f9 math/lapack/Makefile.common
--- a/math/lapack/Makefile.common       Tue Jun 15 04:07:33 2021 +0000
+++ b/math/lapack/Makefile.common       Tue Jun 15 04:41:51 2021 +0000
@@ -1,13 +1,18 @@
-# $NetBSD: Makefile.common,v 1.13 2021/06/10 00:18:52 thor Exp $
+# $NetBSD: Makefile.common,v 1.14 2021/06/15 04:41:52 thor Exp $
 # used by math/blas/Makefile
 # used by math/cblas/Makefile
 # used by math/lapacke/Makefile
 # used by math/lapack/Makefile
+# used by math/blas64/Makefile
+# used by math/cblas64/Makefile
+# used by math/lapacke64/Makefile
+# used by math/lapack64/Makefile
 
 # Common Makefile for packages derived from the Netlib BLAS/LAPACK sources.
 # Package Makefile sets LAPACK_COMPONENT and LAPACK_COMPONENT_CMAKE_ARGS to
 # choose the library to install.
-# LAPACK_COMPONENT can be "lapack", "lapacke", or "cblas"
+# LAPACK_COMPONENT can be "lapack", "lapacke", or "cblas",
+# or any of those with 64 suffix for ILP64 mode (64 bit indexing).
 
 DISTNAME=      lapack-${NETLIB_BLAS_VERSION}
 PKGNAME=       ${LAPACK_COMPONENT}-${NETLIB_BLAS_VERSION}
@@ -30,18 +35,38 @@
 CONFIGURE_DIRS=        build
 CMAKE_ARG_PATH=        ${WRKSRC}
 
+.if !empty(LAPACK_COMPONENT:M*64)
+.  if empty(MACHINE_ARCH:M*64)
+PKG_FAIL_REASON+=      "${LAPACK_COMPONENT} incompatible with non-64-bit platform"
+.  endif
+HEADERDIR=             netlib64
+.else
+HEADERDIR=             netlib
+.endif
+
 # Note: We patch the build to install both static and
 # shared libraries.
 CMAKE_ARGS=    -DBUILD_DEPRECATED=ON \
                -DBUILD_SHARED_LIBS=ON \
                -DBUILD_STATIC_LIBS=ON \
+               -DCMAKE_INSTALL_INCLUDEDIR=${PREFIX}/include/${HEADERDIR} \
                ${LAPACK_COMPONENT_CMAKE_ARGS}
 
+# The cmake files are not ready for prime time.
+post-install:
+       rm -rf "${DESTDIR}${PREFIX}/lib/cmake"
+.if ${HEADERDIR} == netlib
+# Install all headers into subdirectories netlib or netlib64, link
+# the default ones to include, so that simple #include <cblas.h> works
+# as before, as well as with matching -Iincludedir.
+# This also gives us the option of selecting a different symlinked
+# default on the next reworking of BLAS stuff.
+       if ${TEST} -e "${DESTDIR}${PREFIX}/include/${HEADERDIR}"; then \
+         cd "${DESTDIR}${PREFIX}/include"; for f in ${HEADERDIR}/*.h; do ln -s $$f .; done \
+       fi
+.endif
+
 .include "../../math/lapack/version.mk"
 
 post-extract:
        ${RUN} ${MKDIR} ${WRKSRC}/build
-
-# The cmake files are not ready for prime time.
-post-install:
-       rm -rf "${DESTDIR}${PREFIX}/lib/cmake"
diff -r 42f989f79856 -r 7fd4904d55f9 math/lapack64/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/math/lapack64/DESCR       Tue Jun 15 04:41:51 2021 +0000
@@ -0,0 +1,22 @@
+The BLAS (Basic Linear Algebra Subprograms) are high quality "building
+block" routines for performing basic vector and matrix
+operations. Level 1 BLAS do vector-vector operations, Level 2 BLAS do
+matrix-vector operations, and Level 3 BLAS do matrix-matrix
+operations. Because the BLAS are efficient, portable, and widely
+available, they're commonly used in the development of high quality
+linear algebra software, LINPACK and LAPACK for example.
+
+LAPACK is a highly portable Fortran 77 library which provides routines
+for solving systems of simultaneous linear equations, least-squares
+solutions of linear systems of equations, eigenvalue problems, and
+singular value problems. The associated matrix factorizations (LU,
+Cholesky, QR, SVD, Schur, generalized Schur) are also provided, as are
+related computations such as reordering of the Schur factorizations
+and estimating condition numbers. Dense and banded matrices are
+handled, but not general sparse matrices. In all areas, similar
+functionality is provided for real and complex matrices, in both
+single and double precision.
+
+This package contains the Fortran 77 reference implementation of BLAS
+and LAPACK from Netlib. The C wrappers CBLAS and LAPACKE are provided
+in separate packages.
diff -r 42f989f79856 -r 7fd4904d55f9 math/lapack64/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/math/lapack64/Makefile    Tue Jun 15 04:41:51 2021 +0000
@@ -0,0 +1,17 @@



Home | Main Index | Thread Index | Old Index