diff options
47 files changed, 519 insertions, 87 deletions
diff --git a/math/blas/Makefile b/math/blas/Makefile index 8ddf2abcf24..1c9a2007936 100644 --- a/math/blas/Makefile +++ b/math/blas/Makefile @@ -1,7 +1,6 @@ -# $NetBSD: Makefile,v 1.39 2021/05/12 14:32:52 thor Exp $ - -.include "../../math/lapack/Makefile.common" +# $NetBSD: Makefile,v 1.40 2021/06/15 04:41:51 thor Exp $ +MAINTAINER= thomas.orgis@uni-hamburg.de COMMENT= Basic Linear Algebra System (Netlib reference implementation) LAPACK_COMPONENT= blas @@ -9,4 +8,5 @@ LAPACK_COMPONENT_CMAKE_ARGS= \ -DUSE_OPTIMIZED_BLAS=OFF \ -DCBLAS=OFF -DLAPACKE=OFF -DLAPACK=OFF +.include "../../math/lapack/Makefile.common" .include "../../mk/bsd.pkg.mk" diff --git a/math/blas64/DESCR b/math/blas64/DESCR new file mode 100644 index 00000000000..c74df4a651c --- /dev/null +++ b/math/blas64/DESCR @@ -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 --git a/math/blas64/Makefile b/math/blas64/Makefile new file mode 100644 index 00000000000..61728460916 --- /dev/null +++ b/math/blas64/Makefile @@ -0,0 +1,14 @@ +# $NetBSD: Makefile,v 1.1 2021/06/15 04:41:51 thor Exp $ + + +MAINTAINER= thomas.orgis@uni-hamburg.de +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 --git a/math/blas64/PLIST b/math/blas64/PLIST new file mode 100644 index 00000000000..00dde34d960 --- /dev/null +++ b/math/blas64/PLIST @@ -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 --git a/math/blas64/buildlink3.mk b/math/blas64/buildlink3.mk new file mode 100644 index 00000000000..d02c5c15747 --- /dev/null +++ b/math/blas64/buildlink3.mk @@ -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 --git a/math/cblas/Makefile b/math/cblas/Makefile index 4415d90a470..75e8ae10921 100644 --- a/math/cblas/Makefile +++ b/math/cblas/Makefile @@ -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 +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 --git a/math/cblas/PLIST b/math/cblas/PLIST index 099b42c166a..1b10758d9bd 100644 --- a/math/cblas/PLIST +++ b/math/cblas/PLIST @@ -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 --git a/math/cblas/buildlink3.mk b/math/cblas/buildlink3.mk index 07c8a28fd32..2ea69c8c5ed 100644 --- a/math/cblas/buildlink3.mk +++ b/math/cblas/buildlink3.mk @@ -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 @@ BUILDLINK_TREE+= cblas 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 --git a/math/cblas64/DESCR b/math/cblas64/DESCR new file mode 100644 index 00000000000..e3232c7f034 --- /dev/null +++ b/math/cblas64/DESCR @@ -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 --git a/math/cblas64/Makefile b/math/cblas64/Makefile new file mode 100644 index 00000000000..1e09f006e21 --- /dev/null +++ b/math/cblas64/Makefile @@ -0,0 +1,17 @@ +# $NetBSD: Makefile,v 1.1 2021/06/15 04:41:52 thor Exp $ + +MAINTAINER= thomas.orgis@uni-hamburg.de +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 --git a/math/cblas64/PLIST b/math/cblas64/PLIST new file mode 100644 index 00000000000..042ebfc97b3 --- /dev/null +++ b/math/cblas64/PLIST @@ -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 --git a/math/cblas64/buildlink3.mk b/math/cblas64/buildlink3.mk new file mode 100644 index 00000000000..43e5ad6009c --- /dev/null +++ b/math/cblas64/buildlink3.mk @@ -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 --git a/math/lapack/Makefile.common b/math/lapack/Makefile.common index 61868046984..69203013865 100644 --- a/math/lapack/Makefile.common +++ b/math/lapack/Makefile.common @@ -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 @@ WRKSRC= ${WRKDIR}/${DISTNAME} 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 --git a/math/lapack64/DESCR b/math/lapack64/DESCR new file mode 100644 index 00000000000..0ae22553729 --- /dev/null +++ b/math/lapack64/DESCR @@ -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 --git a/math/lapack64/Makefile b/math/lapack64/Makefile new file mode 100644 index 00000000000..932bba67d14 --- /dev/null +++ b/math/lapack64/Makefile @@ -0,0 +1,17 @@ +# $NetBSD: Makefile,v 1.1 2021/06/15 04:41:52 thor Exp $ + +MAINTAINER= thomas.orgis@uni-hamburg.de +COMMENT= Reference Linear Algebra PACKage with 64 bit indices + +LAPACK_COMPONENT= lapack64 +LAPACK_COMPONENT_CMAKE_ARGS= \ + -DBUILD_INDEX64=ON \ + -DUSE_OPTIMIZED_BLAS=ON \ + -DBLAS_LIBRARIES=-lblas64 \ + -DUSE_OPTIMIZED_LAPACK=OFF \ + -DCBLAS=OFF -DLAPACKE=OFF -DLAPACK=ON + +.include "../../math/blas64/buildlink3.mk" + +.include "../../math/lapack/Makefile.common" +.include "../../mk/bsd.pkg.mk" diff --git a/math/lapack64/PLIST b/math/lapack64/PLIST new file mode 100644 index 00000000000..b45cca3996c --- /dev/null +++ b/math/lapack64/PLIST @@ -0,0 +1,6 @@ +@comment $NetBSD: PLIST,v 1.1 2021/06/15 04:41:52 thor Exp $ +lib/liblapack64.a +lib/liblapack64.so +lib/liblapack64.so.3 +lib/liblapack64.so.${PKGVERSION} +lib/pkgconfig/lapack64.pc diff --git a/math/lapack64/buildlink3.mk b/math/lapack64/buildlink3.mk new file mode 100644 index 00000000000..c0d79bd8c0c --- /dev/null +++ b/math/lapack64/buildlink3.mk @@ -0,0 +1,16 @@ +# $NetBSD: buildlink3.mk,v 1.1 2021/06/15 04:41:52 thor Exp $ + +BUILDLINK_TREE+= lapack64 + +.if !defined(LAPACK64_BUILDLINK3_MK) +LAPACK64_BUILDLINK3_MK:= + +BUILDLINK_API_DEPENDS.lapack64+= lapack64>=3.9.0 +BUILDLINK_ABI_DEPENDS.lapack64+= lapack64>=3.9.0 +BUILDLINK_PKGSRCDIR.lapack64?= ../../math/lapack64 + +.include "../../math/blas64/buildlink3.mk" + +.endif # LAPACK64_BUILDLINK3_MK + +BUILDLINK_TREE+= -lapack64 diff --git a/math/lapack64/version.mk b/math/lapack64/version.mk new file mode 100644 index 00000000000..e10777b2fd1 --- /dev/null +++ b/math/lapack64/version.mk @@ -0,0 +1,3 @@ +# $NetBSD: version.mk,v 1.1 2021/06/15 04:41:52 thor Exp $ + +NETLIB_BLAS_VERSION= 3.9.1 diff --git a/math/lapacke/Makefile b/math/lapacke/Makefile index 789f184a169..3c86d0d7b9b 100644 --- a/math/lapacke/Makefile +++ b/math/lapacke/Makefile @@ -1,16 +1,18 @@ -# $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 LAPACK library -PKGREVISION= 1 +MAINTAINER= thomas.orgis@uni-hamburg.de +COMMENT= C interface to the reference LAPACK library +PKGREVISION= 2 LAPACK_COMPONENT= lapacke LAPACK_COMPONENT_CMAKE_ARGS= \ -DUSE_OPTIMIZED_BLAS=ON \ - -DBLAS_LIBRARIES=${BLAS_LIBS:Q} \ + -DBLAS_LIBRARIES=-lblas \ -DUSE_OPTIMIZED_LAPACK=ON \ - -DLAPACK_LIBRARIES=${LAPACK_LIBS:Q} \ + -DLAPACK_LIBRARIES=-llapack \ -DCBLAS=OFF -DLAPACKE=ON -.include "../../mk/blas.buildlink3.mk" +.include "../../math/lapack/buildlink3.mk" + .include "../../math/lapack/Makefile.common" .include "../../mk/bsd.pkg.mk" diff --git a/math/lapacke/PLIST b/math/lapacke/PLIST index 9b4ba2d6db6..b812129c49a 100644 --- a/math/lapacke/PLIST +++ b/math/lapacke/PLIST @@ -1,9 +1,14 @@ -@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/lapack.h include/lapacke.h include/lapacke_config.h include/lapacke_mangling.h include/lapacke_utils.h +include/netlib/lapack.h +include/netlib/lapacke.h +include/netlib/lapacke_config.h +include/netlib/lapacke_mangling.h +include/netlib/lapacke_utils.h lib/liblapacke.a lib/liblapacke.so lib/liblapacke.so.3 diff --git a/math/lapacke/buildlink3.mk b/math/lapacke/buildlink3.mk index a92d3ce8550..f7421370ffd 100644 --- a/math/lapacke/buildlink3.mk +++ b/math/lapacke/buildlink3.mk @@ -1,4 +1,4 @@ -# $NetBSD: buildlink3.mk,v 1.1 2021/04/20 20:40:47 thor Exp $ +# $NetBSD: buildlink3.mk,v 1.2 2021/06/15 04:41:52 thor Exp $ BUILDLINK_TREE+= lapacke @@ -6,9 +6,10 @@ BUILDLINK_TREE+= lapacke LAPACKE_BUILDLINK3_MK:= BUILDLINK_API_DEPENDS.lapacke+= lapacke>=3.9.0 +BUILDLINK_ABI_DEPENDS.lapacke?= lapacke>=3.9.1nb2 BUILDLINK_PKGSRCDIR.lapacke?= ../../math/lapacke -.include "../../mk/blas.buildlink3.mk" +.include "../../math/lapack/buildlink3.mk" .endif BUILDLINK_TREE+= -lapacke diff --git a/math/lapacke64/DESCR b/math/lapacke64/DESCR new file mode 100644 index 00000000000..f3625263092 --- /dev/null +++ b/math/lapacke64/DESCR @@ -0,0 +1,2 @@ +This is the C wrapper to the Linear Algebra PACKage (LAPACKE), +extracted from the Netlib reference implementation of LAPACK. diff --git a/math/lapacke64/Makefile b/math/lapacke64/Makefile new file mode 100644 index 00000000000..c61128f0927 --- /dev/null +++ b/math/lapacke64/Makefile @@ -0,0 +1,18 @@ +# $NetBSD: Makefile,v 1.1 2021/06/15 04:41:52 thor Exp $ + +MAINTAINER= thomas.orgis@uni-hamburg.de +COMMENT= C interface to the reference LAPACK with 64 bit indices + +LAPACK_COMPONENT= lapacke64 +LAPACK_COMPONENT_CMAKE_ARGS= \ + -DBUILD_INDEX64=ON \ + -DUSE_OPTIMIZED_BLAS=ON \ + -DBLAS_LIBRARIES=-lblas64 \ + -DUSE_OPTIMIZED_LAPACK=ON \ + -DLAPACK_LIBRARIES=-llapack64 \ + -DCBLAS=OFF -DLAPACKE=ON + +.include "../../math/lapack64/buildlink3.mk" + +.include "../../math/lapack/Makefile.common" +.include "../../mk/bsd.pkg.mk" diff --git a/math/lapacke64/PLIST b/math/lapacke64/PLIST new file mode 100644 index 00000000000..5e7dafc4051 --- /dev/null +++ b/math/lapacke64/PLIST @@ -0,0 +1,11 @@ +@comment $NetBSD: PLIST,v 1.1 2021/06/15 04:41:52 thor Exp $ +include/netlib64/lapack.h +include/netlib64/lapacke.h +include/netlib64/lapacke_config.h +include/netlib64/lapacke_mangling.h +include/netlib64/lapacke_utils.h +lib/liblapacke64.a +lib/liblapacke64.so +lib/liblapacke64.so.3 +lib/liblapacke64.so.${PKGVERSION} +lib/pkgconfig/lapacke64.pc diff --git a/math/lapacke64/buildlink3.mk b/math/lapacke64/buildlink3.mk new file mode 100644 index 00000000000..cadee52d261 --- /dev/null +++ b/math/lapacke64/buildlink3.mk @@ -0,0 +1,14 @@ +# $NetBSD: buildlink3.mk,v 1.1 2021/06/15 04:41:52 thor Exp $ + +BUILDLINK_TREE+= lapacke64 + +.if !defined(LAPACKE64_BUILDLINK3_MK) +LAPACKE64_BUILDLINK3_MK:= + +BUILDLINK_API_DEPENDS.lapacke64+= lapacke64>=3.9.0 +BUILDLINK_PKGSRCDIR.lapacke?= ../../math/lapacke64 + +.include "../../math/lapack64/buildlink3.mk" +.endif + +BUILDLINK_TREE+= -lapacke64 diff --git a/math/openblas/Makefile b/math/openblas/Makefile index 65cdce0ded0..a22349e5843 100644 --- a/math/openblas/Makefile +++ b/math/openblas/Makefile @@ -1,7 +1,8 @@ -# $NetBSD: Makefile,v 1.3 2021/05/29 19:57:21 thor Exp $ +# $NetBSD: Makefile,v 1.4 2021/06/15 04:41:52 thor Exp $ MAINTAINER= thomas.orgis@uni-hamburg.de +PKGREVISION= 1 -OPENBLAS_VARIANT= openblas +OPENBLAS_VARIANT= openblas .include "../../math/openblas/Makefile.common" .include "../../mk/bsd.pkg.mk" diff --git a/math/openblas/Makefile.common b/math/openblas/Makefile.common index fce40d566a0..268024a741e 100644 --- a/math/openblas/Makefile.common +++ b/math/openblas/Makefile.common @@ -1,8 +1,11 @@ -# $NetBSD: Makefile.common,v 1.4 2021/06/07 15:52:04 adam Exp $ +# $NetBSD: Makefile.common,v 1.5 2021/06/15 04:41:52 thor Exp $ # # used by math/openblas_pthread/Makefile # used by math/openblas_openmp/Makefile # used by math/openblas/Makefile +# used by math/openblas64_pthread/Makefile +# used by math/openblas64_openmp/Makefile +# used by math/openblas64/Makefile # # This is the common Makefile for OpenBLAS builds. It depends on # OPENBLAS_VARIANT = (openblas|openblas_pthread|openblas_openmp) @@ -24,9 +27,13 @@ DISTINFO_FILE= ${.CURDIR}/../../math/openblas/distinfo PATCHDIR= ${.CURDIR}/../../math/openblas/patches HOMEPAGE= https://github.com/xianyi/OpenBLAS -COMMENT= Optimized BLAS library based on GotoBLAS2 +COMMENT= Optimized BLAS library based on GotoBLAS2 (variant ${OPENBLAS_VARIANT}) LICENSE= modified-bsd +# Darwin has a .so/.dylib PLIST issue +# Untested on other platforms +ONLY_FOR_PLATFORM= Linux-*-* NetBSD-*-* + USE_LANGUAGES= c fortran USE_TOOLS+= gmake perl:build @@ -45,9 +52,11 @@ BUILD_DEFS+= OPENBLAS_THREAD_LIMIT .include "../../mk/bsd.prefs.mk" -# Default checks number of cores of build host. -# Do we want a pkgsrc-wide default? -OPENBLAS_THREAD_LIMIT?= # empty +# Using conservative default of 32 threads as that matches the +# limit for related stack arrays in OpenBLAS. Might raise it +# in future, anyway. There some memory usage/efficiency tradeoff +# when this number is excessively high. +OPENBLAS_THREAD_LIMIT?= 32 .if !empty(OPENBLAS_THREAD_LIMIT) MAKE_FLAGS+= NUM_THREADS=${OPENBLAS_THREAD_LIMIT:Q} .endif @@ -55,12 +64,15 @@ BENCHMARK_MAXTHREADS?= 8 .if ${MACHINE_ARCH:M*64} == "" MAKE_FLAGS+= BINARY32=1 +. if !empty(OPENBLAS_VARIANT:M*64*) +PKG_FAIL_REASON+= "${OPENBLAS_VARIANT} incompatible with non-64-bit platform" +. endif .else MAKE_FLAGS+= BINARY64=1 .endif -# Those come in separate BLAS-agnostic packages. -# ... except we start headaches about ILP64? -MAKE_FLAGS+= NO_CBLAS=1 NO_LAPACKE=1 + +# Build with the C APIs, as do other optimized libraries. +#MAKE_FLAGS+= NO_CBLAS=0 NO_LAPACKE=0 # Separate headers and cmake stuff. MAKE_FLAGS+= OPENBLAS_INCLUDE_DIR=${PREFIX}/include/${OPENBLAS_VARIANT} @@ -70,19 +82,23 @@ MAKE_FLAGS+= OPENBLAS_CMAKE_DIR=${PREFIX}/lib/cmake/${OPENBLAS_VARIANT} # Need to settle on a convention for SYMBOLSUFFIX first, see # https://github.com/xianyi/OpenBLAS/issues/646 . MAKE_FLAGS+= FIXED_LIBNAME=1 -.if ${OPENBLAS_VARIANT} == openblas +.if ${OPENBLAS_VARIANT} == openblas || ${OPENBLAS_VARIANT} == openblas64 MAKE_FLAGS+= USE_OPENMP=0 USE_THREAD=0 USE_LOCKING=1 BENCHMARK_ENV= USE_SIMPLE_THREADED_LEVEL3=1 -.elif ${OPENBLAS_VARIANT} == openblas_pthread +.elif !empty(OPENBLAS_VARIANT:Mopenblas*_pthread) MAKE_FLAGS+= LIBNAMESUFFIX=pthread MAKE_FLAGS+= USE_OPENMP=0 USE_THREAD=1 BENCHMARK_ENV= OPENBLAS_NUM_THREADS=${BENCHMARK_MAXTHREADS} -.elif ${OPENBLAS_VARIANT} == openblas_openmp +.elif !empty(OPENBLAS_VARIANT:Mopenblas*_openmp) MAKE_FLAGS+= LIBNAMESUFFIX=openmp MAKE_FLAGS+= USE_OPENMP=1 NO_AFFINITY=1 BENCHMARK_ENV= OMP_NUM_THREADS=${BENCHMARK_MAXTHREADS} .endif +.if !empty(OPENBLAS_VARIANT:M*64*) +MAKE_FLAGS+= INTERFACE64=1 LIBSONAMEBASE=openblas64 +.endif + SUBST_CLASSES+= threads SUBST_STAGE.threads= pre-build SUBST_SED.threads+= -e "s+OPENBLAS_NUM_THREADS+OMP_NUM_THREADS+g" diff --git a/math/openblas/PLIST b/math/openblas/PLIST index 3c5f04ea45e..e9cf87882a9 100644 --- a/math/openblas/PLIST +++ b/math/openblas/PLIST @@ -1,9 +1,16 @@ -@comment $NetBSD: PLIST,v 1.1 2020/11/05 16:31:45 bacon Exp $ +@comment $NetBSD: PLIST,v 1.2 2021/06/15 04:41:52 thor Exp $ +include/${OPENBLAS_VARIANT}/cblas.h +include/${OPENBLAS_VARIANT}/f77blas.h +include/${OPENBLAS_VARIANT}/lapack.h +include/${OPENBLAS_VARIANT}/lapacke.h +include/${OPENBLAS_VARIANT}/lapacke_config.h +include/${OPENBLAS_VARIANT}/lapacke_mangling.h +include/${OPENBLAS_VARIANT}/lapacke_utils.h +include/${OPENBLAS_VARIANT}/openblas_config.h +lib/cmake/${OPENBLAS_VARIANT}/OpenBLASConfig.cmake +lib/cmake/${OPENBLAS_VARIANT}/OpenBLASConfigVersion.cmake lib/lib${OPENBLAS_VARIANT}.a lib/lib${OPENBLAS_VARIANT}.so lib/lib${OPENBLAS_VARIANT}.so.0 lib/pkgconfig/${OPENBLAS_VARIANT}.pc -lib/cmake/${OPENBLAS_VARIANT}/OpenBLASConfig.cmake -lib/cmake/${OPENBLAS_VARIANT}/OpenBLASConfigVersion.cmake -include/${OPENBLAS_VARIANT}/openblas_config.h -include/${OPENBLAS_VARIANT}/f77blas.h +@pkgdir bin diff --git a/math/openblas/buildlink3.mk b/math/openblas/buildlink3.mk index fefc50fa46a..1d2ce522940 100644 --- a/math/openblas/buildlink3.mk +++ b/math/openblas/buildlink3.mk @@ -1,4 +1,4 @@ -# $NetBSD: buildlink3.mk,v 1.1 2020/11/05 16:31:45 bacon Exp $ +# $NetBSD: buildlink3.mk,v 1.2 2021/06/15 04:41:52 thor Exp $ BUILDLINK_TREE+= openblas @@ -6,6 +6,7 @@ BUILDLINK_TREE+= openblas OPENBLAS_BUILDLINK3_MK:= BUILDLINK_API_DEPENDS.openblas+= openblas>=0.3.5 +BUILDLINK_ABI_DEPENDS.openblas?= openblas>=0.3.15nb1 BUILDLINK_PKGSRCDIR.openblas?= ../../math/openblas .endif # OPENBLAS_BUILDLINK3_MK diff --git a/math/openblas64/DESCR b/math/openblas64/DESCR new file mode 100644 index 00000000000..adbd3006421 --- /dev/null +++ b/math/openblas64/DESCR @@ -0,0 +1,6 @@ +OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version. +OpenBLAS is an open source project supported by +Lab of Parallel Software and Computational Science, ISCAS. + +This package builds the serial library working with indices of 64 bits +(INTERFACE64=1). diff --git a/math/openblas64/Makefile b/math/openblas64/Makefile new file mode 100644 index 00000000000..a64b9660672 --- /dev/null +++ b/math/openblas64/Makefile @@ -0,0 +1,7 @@ +# $NetBSD: Makefile,v 1.1 2021/06/15 04:41:52 thor Exp $ + +MAINTAINER= thomas.orgis@uni-hamburg.de + +OPENBLAS_VARIANT= openblas64 +.include "../../math/openblas/Makefile.common" +.include "../../mk/bsd.pkg.mk" diff --git a/math/openblas64/buildlink3.mk b/math/openblas64/buildlink3.mk new file mode 100644 index 00000000000..f327451436d --- /dev/null +++ b/math/openblas64/buildlink3.mk @@ -0,0 +1,12 @@ +# $NetBSD: buildlink3.mk,v 1.1 2021/06/15 04:41:52 thor Exp $ + +BUILDLINK_TREE+= openblas64 + +.if !defined(OPENBLAS64_BUILDLINK3_MK) +OPENBLAS64_BUILDLINK3_MK:= + +BUILDLINK_API_DEPENDS.openblas64+= openblas64>=0.3.5 +BUILDLINK_PKGSRCDIR.openblas64?= ../../math/openblas64 +.endif # OPENBLAS64_BUILDLINK3_MK + +BUILDLINK_TREE+= -openblas64 diff --git a/math/openblas64_openmp/DESCR b/math/openblas64_openmp/DESCR new file mode 100644 index 00000000000..6c751b4a453 --- /dev/null +++ b/math/openblas64_openmp/DESCR @@ -0,0 +1,6 @@ +OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version. +OpenBLAS is an open source project supported by +Lab of Parallel Software and Computational Science, ISCAS. + +This package builds the parallel library using OpenMP and indices of +64 bits (INTERFACE64=1). diff --git a/math/openblas64_openmp/Makefile b/math/openblas64_openmp/Makefile new file mode 100644 index 00000000000..f301b81eb6a --- /dev/null +++ b/math/openblas64_openmp/Makefile @@ -0,0 +1,7 @@ +# $NetBSD: Makefile,v 1.1 2021/06/15 04:41:53 thor Exp $ + +MAINTAINER= thomas.orgis@uni-hamburg.de + +OPENBLAS_VARIANT= openblas64_openmp +.include "../../math/openblas/Makefile.common" +.include "../../mk/bsd.pkg.mk" diff --git a/math/openblas64_openmp/buildlink3.mk b/math/openblas64_openmp/buildlink3.mk new file mode 100644 index 00000000000..b7ebe82e123 --- /dev/null +++ b/math/openblas64_openmp/buildlink3.mk @@ -0,0 +1,12 @@ +# $NetBSD: buildlink3.mk,v 1.1 2021/06/15 04:41:53 thor Exp $ + +BUILDLINK_TREE+= openblas64_openmp + +.if !defined(OPENBLAS64_OPENMP_BUILDLINK3_MK) +OPENBLAS64_OPENMP_BUILDLINK3_MK:= + +BUILDLINK_API_DEPENDS.openblas64_openmp+= openblas64_openmp>=0.3.5 +BUILDLINK_PKGSRCDIR.openblas64_openmp?= ../../math/openblas64_openmp +.endif # OPENBLAS64_OPENMP_BUILDLINK3_MK + +BUILDLINK_TREE+= -openblas64_openmp diff --git a/math/openblas64_pthread/DESCR b/math/openblas64_pthread/DESCR new file mode 100644 index 00000000000..6ead0d908ec --- /dev/null +++ b/math/openblas64_pthread/DESCR @@ -0,0 +1,6 @@ +OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version. +OpenBLAS is an open source project supported by +Lab of Parallel Software and Computational Science, ISCAS. + +This package builds the parallel library using pthreads and indices of +64 bits (INTERFACE64=1). diff --git a/math/openblas64_pthread/Makefile b/math/openblas64_pthread/Makefile new file mode 100644 index 00000000000..90d8c8702a5 --- /dev/null +++ b/math/openblas64_pthread/Makefile @@ -0,0 +1,7 @@ +# $NetBSD: Makefile,v 1.1 2021/06/15 04:41:53 thor Exp $ + +MAINTAINER= thomas.orgis@uni-hamburg.de + +OPENBLAS_VARIANT= openblas64_pthread +.include "../../math/openblas/Makefile.common" +.include "../../mk/bsd.pkg.mk" diff --git a/math/openblas64_pthread/buildlink3.mk b/math/openblas64_pthread/buildlink3.mk new file mode 100644 index 00000000000..711b71fa08d --- /dev/null +++ b/math/openblas64_pthread/buildlink3.mk @@ -0,0 +1,12 @@ +# $NetBSD: buildlink3.mk,v 1.1 2021/06/15 04:41:53 thor Exp $ + +BUILDLINK_TREE+= openblas64_pthread + +.if !defined(OPENBLAS64_PTHREAD_BUILDLINK3_MK) +OPENBLAS64_PTHREAD_BUILDLINK3_MK:= + +BUILDLINK_API_DEPENDS.openblas64_pthread+= openblas64_pthread>=0.3.5 +BUILDLINK_PKGSRCDIR.openblas64_pthread?= ../../math/openblas64_pthread +.endif # OPENBLAS64_PTHREAD_BUILDLINK3_MK + +BUILDLINK_TREE+= -openblas64_pthread diff --git a/math/openblas_openmp/Makefile b/math/openblas_openmp/Makefile index d57bdda0c6d..d75c2c683c1 100644 --- a/math/openblas_openmp/Makefile +++ b/math/openblas_openmp/Makefile @@ -1,6 +1,7 @@ -# $NetBSD: Makefile,v 1.2 2020/11/05 17:06:10 bacon Exp $ +# $NetBSD: Makefile,v 1.3 2021/06/15 04:41:53 thor Exp $ MAINTAINER= thomas.orgis@uni-hamburg.de +PKGREVISION= 1 OPENBLAS_VARIANT= openblas_openmp .include "../../math/openblas/Makefile.common" diff --git a/math/openblas_openmp/buildlink3.mk b/math/openblas_openmp/buildlink3.mk index c2f7046534d..c27201c1c78 100644 --- a/math/openblas_openmp/buildlink3.mk +++ b/math/openblas_openmp/buildlink3.mk @@ -1,4 +1,4 @@ -# $NetBSD: buildlink3.mk,v 1.2 2020/11/05 17:06:10 bacon Exp $ +# $NetBSD: buildlink3.mk,v 1.3 2021/06/15 04:41:53 thor Exp $ BUILDLINK_TREE+= openblas_openmp @@ -6,6 +6,7 @@ BUILDLINK_TREE+= openblas_openmp OPENBLAS_OPENMP_BUILDLINK3_MK:= BUILDLINK_API_DEPENDS.openblas_openmp+= openblas_openmp>=0.3.5 +BUILDLINK_ABI_DEPENDS.openblas_openmp?= openblas_openmp>=0.3.15nb1 BUILDLINK_PKGSRCDIR.openblas_openmp?= ../../math/openblas_openmp .endif # OPENBLAS_OPENMP_BUILDLINK3_MK diff --git a/math/openblas_pthread/Makefile b/math/openblas_pthread/Makefile index 2b9e2fefc04..3bef96a8f75 100644 --- a/math/openblas_pthread/Makefile +++ b/math/openblas_pthread/Makefile @@ -1,6 +1,7 @@ -# $NetBSD: Makefile,v 1.2 2020/11/05 17:06:10 bacon Exp $ +# $NetBSD: Makefile,v 1.3 2021/06/15 04:41:53 thor Exp $ MAINTAINER= thomas.orgis@uni-hamburg.de +PKGREVISION= 1 OPENBLAS_VARIANT= openblas_pthread .include "../../math/openblas/Makefile.common" diff --git a/math/openblas_pthread/buildlink3.mk b/math/openblas_pthread/buildlink3.mk index 415a4dcd697..252e164c43e 100644 --- a/math/openblas_pthread/buildlink3.mk +++ b/math/openblas_pthread/buildlink3.mk @@ -1,4 +1,4 @@ -# $NetBSD: buildlink3.mk,v 1.2 2020/11/05 17:06:10 bacon Exp $ +# $NetBSD: buildlink3.mk,v 1.3 2021/06/15 04:41:53 thor Exp $ BUILDLINK_TREE+= openblas_pthread @@ -6,6 +6,7 @@ BUILDLINK_TREE+= openblas_pthread OPENBLAS_PTHREAD_BUILDLINK3_MK:= BUILDLINK_API_DEPENDS.openblas_pthread+= openblas_pthread>=0.3.5 +BUILDLINK_ABI_DEPENDS.openblas_pthread?= openblas_pthread>=0.3.15nb1 BUILDLINK_PKGSRCDIR.openblas_pthread?= ../../math/openblas_pthread .endif # OPENBLAS_PTHREAD_BUILDLINK3_MK diff --git a/math/py-numpy/Makefile b/math/py-numpy/Makefile index 7bb3a773b20..618b953c090 100644 --- a/math/py-numpy/Makefile +++ b/math/py-numpy/Makefile @@ -1,7 +1,8 @@ -# $NetBSD: Makefile,v 1.81 2021/05/12 08:12:10 adam Exp $ +# $NetBSD: Makefile,v 1.82 2021/06/15 04:41:53 thor Exp $ DISTNAME= numpy-1.20.3 PKGNAME= ${PYPKGPREFIX}-${DISTNAME} +PKGREVISION= 1 CATEGORIES= math python MASTER_SITES= ${MASTER_SITE_PYPI:=n/numpy/} EXTRACT_SUFX= .zip @@ -39,6 +40,10 @@ PYSETUPBUILDARGS+= --fcompiler=gnu # linking, so ensure that we pass through requisite options. LDFLAGS+= ${_COMPILER_ABI_FLAG.${ABI}} +BLAS_ACCEPTED= ${_BLAS_TYPES} accelerate.framework +BLAS_C_INTERFACE= yes +CPPFLAGS+= ${BLAS_INCLUDES} + .include "../../mk/bsd.prefs.mk" # numpy fails using the gold linker with: @@ -57,6 +62,5 @@ BUILDLINK_API_DEPENDS.py-cython+= ${PYPKGPREFIX}-cython>=0.29.21 .include "../../devel/py-cython/buildlink3.mk" .include "../../lang/python/application.mk" .include "../../lang/python/egg.mk" -# BLAS with CBLAS is needed for proper acceleration. -.include "../../math/cblas/buildlink3.mk" +.include "../../mk/blas.buildlink3.mk" .include "../../mk/bsd.pkg.mk" diff --git a/math/py-numpy/Makefile.make_env b/math/py-numpy/Makefile.make_env index 7b42bb63af4..91a53fd91eb 100644 --- a/math/py-numpy/Makefile.make_env +++ b/math/py-numpy/Makefile.make_env @@ -1,6 +1,10 @@ -# $NetBSD: Makefile.make_env,v 1.3 2021/04/20 23:56:26 gutteridge Exp $ +# $NetBSD: Makefile.make_env,v 1.4 2021/06/15 04:41:53 thor Exp $ # Use the variables from blas.buildlink3.mk, pulled in via cblas. # Dependent Python packages possibly re-use the system_info logic and # might need this in the environment. +.if ${BLAS_TYPE:U} == "accelerate.framework" +MAKE_ENV+= NPY_BLAS_ORDER=accelerate +.else MAKE_ENV+= NPY_BLAS_LIBS=${BLAS_LIBS:Q} NPY_LAPACK_LIBS=${LAPACK_LIBS:Q} -MAKE_ENV+= NPY_CBLAS_LIBS=-lcblas +MAKE_ENV+= NPY_CBLAS_LIBS=${CBLAS_LIBS:Q} +.endif diff --git a/math/py-numpy/buildlink3.mk b/math/py-numpy/buildlink3.mk index ee068b5794f..ac90863e343 100644 --- a/math/py-numpy/buildlink3.mk +++ b/math/py-numpy/buildlink3.mk @@ -1,4 +1,4 @@ -# $NetBSD: buildlink3.mk,v 1.9 2021/04/20 20:53:48 thor Exp $ +# $NetBSD: buildlink3.mk,v 1.10 2021/06/15 04:41:53 thor Exp $ BUILDLINK_TREE+= py-numpy @@ -9,17 +9,22 @@ PY_NUMPY_BUILDLINK3_MK:= BUILDLINK_API_DEPENDS.py-numpy+= ${PYPKGPREFIX}-numpy>=1.0 .if ${_PYTHON_VERSION} == 27 -BUILDLINK_ABI_DEPENDS.py-numpy?= ${PYPKGPREFIX}-numpy>=1.16.6nb1 +BUILDLINK_ABI_DEPENDS.py-numpy?= ${PYPKGPREFIX}-numpy>=1.16.6nb3 BUILDLINK_PKGSRCDIR.py-numpy?= ../../math/py-numpy16 .else -BUILDLINK_ABI_DEPENDS.py-numpy?= ${PYPKGPREFIX}-numpy>=1.19.2nb1 +BUILDLINK_ABI_DEPENDS.py-numpy?= ${PYPKGPREFIX}-numpy>=1.20.3nb1 BUILDLINK_PKGSRCDIR.py-numpy?= ../../math/py-numpy .endif .include "../../mk/bsd.fast.prefs.mk" .include "../../math/py-numpy/Makefile.make_env" -.include "../../math/cblas/buildlink3.mk" + +# Mimick the choice from Makefile. Or better store/load build choice? +BLAS_ACCEPTED= ${_BLAS_TYPES} accelerate.framework +BLAS_C_INTERFACE= yes +CPPFLAGS+= ${BLAS_INCLUDES} +.include "../../mk/blas.buildlink3.mk" .endif # PY_NUMPY_BUILDLINK3_MK diff --git a/math/py-numpy16/Makefile b/math/py-numpy16/Makefile index 2db81436771..e3562ec60e2 100644 --- a/math/py-numpy16/Makefile +++ b/math/py-numpy16/Makefile @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.6 2021/04/20 20:58:39 thor Exp $ +# $NetBSD: Makefile,v 1.7 2021/06/15 04:41:53 thor Exp $ DISTNAME= numpy-1.16.6 PKGNAME= ${PYPKGPREFIX}-${DISTNAME} -PKGREVISION= 2 +PKGREVISION= 3 CATEGORIES= math python MASTER_SITES= ${MASTER_SITE_PYPI:=n/numpy/} EXTRACT_SUFX= .zip @@ -41,6 +41,10 @@ PYSETUPBUILDARGS+= --fcompiler=gnu # linking, so ensure that we pass through requisite options. LDFLAGS+= ${_COMPILER_ABI_FLAG.${ABI}} +BLAS_ACCEPTED= ${_BLAS_TYPES} accelerate.framework +BLAS_C_INTERFACE= yes +CPPFLAGS+= ${BLAS_INCLUDES} + .include "../../mk/bsd.prefs.mk" # numpy fails using the gold linker with: @@ -60,5 +64,5 @@ BUILDLINK_API_DEPENDS.py-cython+= ${PYPKGPREFIX}-cython>=0.29.2 .include "../../lang/python/application.mk" .include "../../lang/python/egg.mk" .include "../../lang/python/versioned_dependencies.mk" -.include "../../math/cblas/buildlink3.mk" +.include "../../mk/blas.buildlink3.mk" .include "../../mk/bsd.pkg.mk" diff --git a/mk/blas.buildlink3.mk b/mk/blas.buildlink3.mk index 92ffa0a3c08..55f7621571a 100644 --- a/mk/blas.buildlink3.mk +++ b/mk/blas.buildlink3.mk @@ -1,14 +1,23 @@ -# $NetBSD: blas.buildlink3.mk,v 1.1 2020/10/12 21:51:57 bacon Exp $ +# $NetBSD: blas.buildlink3.mk,v 1.2 2021/06/15 04:41:51 thor Exp $ # -# This Makefile fragment is meant to be included by packages that use any BLAS -# (Basic Linear Algebra System) implementation instead of one particular one. +# This Makefile fragment is meant to be included by packages that use any +# BLAS (Basic Linear Algebra System) implementation instead of one particular +# one. # # Since pkgsrc always ships BLAS and LAPACK together (as upstream # implementations do), this adds both BLAS_LIBS and LAPACK_LIBS to the linker -# flags. Often, they will be identical or at least redundant. It is a matter -# of style to stay consistent in their use. +# flags. Often, they will be identical or at least redundant. LAPACK_LIBS +# does include BLAS_LIBS, in any case. # -# Keywords: blas lapack atlas openblas mkl +# The C interfaces CBLAS and LAPACKE are also selected +# via BLAS_C_INTERFACE in the package and respective CBLAS_LIBS and +# LAPACKE_LIBS are set. Also, BLAS_INCLUDES is set to preprocessor +# flags to locate/use respective headers. +# +# Note that use of the Accelerate framework is experimental and only +# attempted if user and package explicitly want it. +# +# Keywords: blas lapack netlib atlas openblas mkl # # === User-settable variables === # @@ -20,10 +29,12 @@ # Typically set in mk.conf. # # Possible: one or more of netlib, openblas, openblas_pthread, -# openblas_openmp, and Apple's accelerate.framework -# (to come: Intel MKL, other external optimized builds) +# openblas_openmp, accelerate.framework +# (Accelerate has differing API and needs special handling, might +# be supported in a few specific packages ony.) # # Default: All currently supported implementations (${_BLAS_TYPES}) +# except accelerate.framework # # === Package-settable variables === # @@ -32,6 +43,15 @@ # package. If not set, any BLAS implementation is OK. # Typically set in package Makefile. # +# BLAS_C_INTERFACE +# Set to yes if the package requires CBLAS or LAPACKE. This defines +# BLAS_INCLUDES and pulls in additional packages for netlib. Optimized +# implementations include the C interfaces in the main library anyway, +# but you still have the effect on BLAS_INCLUDES. +# +# BLAS_INDEX64 +# Set to yes if the package wants to utilize 64 bit indices. +# # === Variables automatically set here for use in package builds === # # BLAS_TYPE @@ -43,14 +63,24 @@ # Linker flags used for linking to BLAS library # LAPACK_LIBS # Linker flags used for linking to LAPACK library +# (including BLAS) +# CBLAS_LIBS +# Linker flags used for linking to CBLAS library +# (including BLAS) +# LAPACKE_LIBS +# Linker flags used for linking to LAPACKE library +# (including BLAS and LAPACK) +# BLAS_INCLUDES +# Preprocessor flags to locate/use C interfaces +# (both for CBLAS and LAPACKE) .if !defined(MK_BLAS_BUILDLINK3_MK) MK_BLAS_BUILDLINK3_MK= BUILD_DEFS+= PKGSRC_BLAS_TYPES -BUILD_DEFS_EFFECTS+= BLAS_TYPE BLAS_LIBS LAPACK_LIBS +BUILD_DEFS_EFFECTS+= BLAS_TYPE BLAS_LIBS LAPACK_LIBS \ + CBLAS_LIBS LAPACKE_LIBS BLAS_INCLUDES -# TODO: Upon commit change to: .include "bsd.prefs.mk" .include "../../mk/bsd.prefs.mk" # List of all possible BLAS choices, in order of *DEFAULT* preference. @@ -59,17 +89,30 @@ BUILD_DEFS_EFFECTS+= BLAS_TYPE BLAS_LIBS LAPACK_LIBS # slowest and not desirable in many situations. Users can override by setting # PKGSRC_BLAS_TYPES. (See comment above) _BLAS_TYPES= netlib openblas openblas_pthread openblas_openmp -# Darwin -.if exists(/System/Library/Frameworks/Accelerate.framework) -_BLAS_TYPES+= accelerate.framework -.endif +# The Accelerate framework is special, as it does not offer BLAS API compatible +# to the others. See liboctave/util/blaswrap.c in octave sources, or +# the wrapper https://github.com/mcg1969/vecLibFort that one might want to +# package. +# We have it as option only if user explicitly set it in PKGSRC_BLAS_TYPES +# and the package accepts it explicitly. BLAS_ACCEPTED?= ${_BLAS_TYPES} PKGSRC_BLAS_TYPES?= ${_BLAS_TYPES} +.if !empty(BLAS_INDEX64:Myes) +_BLAS_64= 64 +.else +_BLAS_64= +.endif + _BLAS_MATCH= .for b in ${PKGSRC_BLAS_TYPES} +# Seems like Accelerate does not offer a 64 bit interface (yet?). +# Exclude from list in that case, even if present. +. if ${b} != "accelerate.framework" || ( empty(_BLAS_64) \ + && exists(/System/Library/Frameworks/Accelerate.framework) ) _BLAS_MATCH+= ${BLAS_ACCEPTED:M${b}} +. endif .endfor .if !empty(_BLAS_MATCH) BLAS_TYPE= ${_BLAS_MATCH:[1]} @@ -78,24 +121,50 @@ BLAS_TYPE= none .endif .if ${BLAS_TYPE} == "netlib" -_BLAS_PKGPATH= math/lapack -BLAS_LIBS= -lblas -LAPACK_LIBS= -llapack ${BLAS_LIBS} +_BLAS_PKGPATH= math/lapack${_BLAS_64} +_CBLAS_PKGPATH= math/cblas${_BLAS_64} +_LAPACKE_PKGPATH= math/lapacke${_BLAS_64} +BLAS_LIBS= -lblas${_BLAS_64} +LAPACK_LIBS= -llapack${_BLAS_64} ${BLAS_LIBS} +CBLAS_LIBS= -lcblas${_BLAS_64} ${BLAS_LIBS} +LAPACKE_LIBS= -llapacke${_BLAS_64} ${LAPACK_LIBS} +BLAS_INCLUDES= -I${PREFIX}/include/netlib${_BLAS_64} +. if ${_BLAS_64} == "64" +BLAS_INCLUDES+= -DWeirdNEC -DHAVE_LAPACK_CONFIG_H -DLAPACK_ILP64 +. endif .elif ${BLAS_TYPE} == "openblas" -_BLAS_PKGPATH= math/openblas -BLAS_LIBS= -lopenblas +_BLAS_PKGPATH= math/openblas${_BLAS_64} +BLAS_LIBS= -lopenblas${_BLAS_64} LAPACK_LIBS= ${BLAS_LIBS} +CBLAS_LIBS= ${BLAS_LIBS} +LAPACKE_LIBS= ${BLAS_LIBS} +BLAS_INCLUDES= -I${PREFIX}/include/openblas${_BLAS_64} .elif ${BLAS_TYPE} == "openblas_pthread" -_BLAS_PKGPATH= math/openblas_pthread -BLAS_LIBS= -lopenblas_pthread +_BLAS_PKGPATH= math/openblas${_BLAS_64}_pthread +BLAS_LIBS= -lopenblas${_BLAS_64}_pthread LAPACK_LIBS= ${BLAS_LIBS} +CBLAS_LIBS= ${BLAS_LIBS} +LAPACKE_LIBS= ${BLAS_LIBS} +BLAS_INCLUDES= -I${PREFIX}/include/openblas64_pthread .elif ${BLAS_TYPE} == "openblas_openmp" -_BLAS_PKGPATH= math/openblas_openmp -BLAS_LIBS= -lopenblas_openmp +_BLAS_PKGPATH= math/openblas${_BLAS_64}_openmp +BLAS_LIBS= -lopenblas${_BLAS_64}_openmp LAPACK_LIBS= ${BLAS_LIBS} +CBLAS_LIBS= ${BLAS_LIBS} +LAPACKE_LIBS= ${BLAS_LIBS} +BLAS_INCLUDES= -I${PREFIX}/include/openblas${_BLAS_64}_openmp .elif ${BLAS_TYPE} == "accelerate.framework" +# No 64 bit variant yet. Excluded above. +# Actually, only CBLAS_LIBS is safe to use. Others have g77/f2c calling +# conventions, not gfortran. This needs custom handling in packages. BLAS_LIBS= -framework Accelerate +CBLAS_LIBS= ${BLAS_LIBS} LAPACK_LIBS= ${BLAS_LIBS} +LAPACKE_LIBS= # build a wrapper for that? +BLAS_INCLUDES= # not delivered yet +# Idea for cblas.h including Accelerate/Accelerate.h (would work the same +# for Intel MKL with -DBLASWRAP_MKL for mkl_cblas.h). +#BLAS_INCLUDES= -I${PREFIX}/include/blaswrap -DBLASWRAP_ACCELERATE .else # invalid or unimplemented type PKG_FAIL_REASON+= \ "There is no acceptable BLAS for ${PKGNAME} in: ${PKGSRC_BLAS_TYPES}." @@ -105,4 +174,15 @@ PKG_FAIL_REASON+= \ .include "../../${_BLAS_PKGPATH}/buildlink3.mk" .endif +.if !empty(BLAS_C_INTERFACE:Myes) +. if defined(_CBLAS_PKGPATH) +. include "../../${_CBLAS_PKGPATH}/buildlink3.mk" +. endif +. if defined(_LAPACKE_PKGPATH) +. include "../../${_LAPACKE_PKGPATH}/buildlink3.mk" +. endif +.else +. undef BLAS_INCLUDES +.endif + .endif # BLAS_BUILDLINK3_MK |