Skip to content

Commit

Permalink
math/openblas: update to version 0.3.15
Browse files Browse the repository at this point in the history
This includes a rework of our patchery with the hope of upstreaming a good deal
of it.

These are the upstream changes since 0.3.10:

Version 0.3.15
  2-May-2021

common:
 - imported improvements and bugfixes from Reference-LAPACK 3.9.1
 - imported LAPACKE interface fixes from Reference-LAPACK PRs 534 + 537
 - fixed a problem in the cpu detection of 0.3.14 that prevented cross-compilation
 - fixed a sequence problem in the generation of softlinks to the library in GMAKE

RISC V:
 - fixed compilation on RISCV (missing entry in getarch)
 - fixed a potential division by zero in CROTG and ZROTG

POWER:
 - fixed LAPACK testsuite failures seen with the NVIDIA HPC compiler
 - improved CGEMM, DGEMM and ZGEMM performance on POWER10
 - added an optimized ZGEMV kernel for POWER10
 - fixed a potential division by zero in CROTG and ZROTG

x86_64:
 - added support for Intel Control-flow Enforcement Technology (CET)
 - reverted the DOMATCOPY_RT code to the generic C version
 - fixed a bug in the AVX512 SGEMM kernel introduced in 0.3.14
 - fixed misapplication of -msse flag to non-SSE cpus in DYNAMIC_ARCH
 - added support for compilation of the benchmarks on older OSX versions
 - fix propagation of the NO_AVX512 option in CMAKE builds
 - fix compilation of the AVX512 SGEMM kernel with clang-cl on Windows
 - fixed compilation of the CTESTs with INTERFACE64=1 (random faults on OSX)
 - corrected the Haswell DROT kernel to require AVX2/FMA3 rather than AVX512

ARM:
 - fixed a potential division by zero in CROTG and ZROTG
 - fixed a potential overflow in IMATCOPY/ZIMATCOPY and the CTESTs

ARM64:
 - fixed spurious reads outside the array in the SGEMM tcopy macro
 - fixed a potential division by zero in CROTG and ZROTG
 - fixed a segmentation fault in DYNAMIC_ARCH builds (reappeared in 0.3.14)

MIPS
 - fixed a potential division by zero in CROTG and ZROTG
 - fixed a potential overflow in IMATCOPY/ZIMATCOPY and the CTESTs

MIPS64:
 - fixed a potential division by zero in CROTG and ZROTG

SPARC:
 - fixed a potential division by zero in CROTG and ZROTG

====================================================================
Version 0.3.14
 17-Mar-2021

 common:
	* Fixed a race condition on thread shutdown in non-OpenMP builds
	* Fixed custom BUFFERSIZE option getting ignored in gmake builds
	* Fixed CMAKE compilation of the TRMM kernels for GENERIC platforms
	* Added CBLAS interfaces for CROTG, ZROTG, CSROT and ZDROT
	* Improved performance of OMATCOPY_RT across all platforms
	* Changed perl scripts to use env instead of a hardcoded /usr/bin/perl
	* Fixed potential misreading of the GCC compiler version in the build scripts
	* Fixed convergence problems in LAPACK complex GGEV/GGES (Reference-LAPACK #477)
	* Reduced the stacksize requirements for running the LAPACK testsuite (Reference-LAPACK #335)

 RISCV:
 	* Fixed compilation on RISCV (missing entry in getarch)

 POWER:
 	* Fixed compilation for DYNAMIC_ARCH with clang and with old gcc versions
	* Added support for compilation on FreeBSD/ppc64le
 	* Added optimized POWER10 kernels for SSCAL, DSCAL, CSCAL, ZSCAL
	* Added optimized POWER10 kernels for SROT, DROT, CDOT, SASUM, DASUM
	* Improved SSWAP, DSWAP, CSWAP, ZSWAP performance on POWER10
	* Improved SCOPY and CCOPY performance on POWER10
	* Improved SGEMM and DGEMM performance on POWER10
	* Added support for compilation with the NVIDIA HPC compiler

 x86_64:
	* Added an optimized bfloat16 GEMM kernel for Cooperlake
	* Added CPUID autodetection for Intel Rocket Lake and Tiger Lake cpus
	* Improved the performance of SASUM,DASUM,SROT,DROT on AMD Ryzen cpus
	* Added support for compilation with the NAG Fortran compiler
	* Fixed recognition of the AMD AOCC compiler
	* Fixed compilation for DYNAMIC_ARCH with clang on Windows
	* Added support for running the BLAS/CBLAS tests on Windows
	* Fixed signatures of the tls callback functions for Windows x64
	* Fixed various issues with fma intrinsics support handling

 ARM:
	* Added support for embedded Cortex M targets via a new option EMBEDDED

 ARMV8:
 	* Fixed the THUNDERX2T99 and NEOVERSEN1 DNRM2/ZNRM2 kernels for inputs with Inf
	* Added support for the DYNAMIC_LIST option
	* Added support for compilation with the NVIDIA HPC compiler
 	* Added support for compiling with the NAG Fortran compiler

====================================================================
Version 0.3.13
 12-Dec-2020

 common:
	* Added a generic bfloat16 SBGEMV kernel
	* Fixed a potentially severe memory leak after fork in OpenMP builds
	  that was introduced in 0.3.12
	* Added detection of the Fujitsu Fortran compiler
	* Added detection of the (e)gfortran compiler on OpenBSD
	* Added support for overriding the default name of the library independently
	  from symbol suffixing in the gmake builds (already supported in cmake)

RISCV:
	* Added a RISC V port optimized for C910V

POWER:
	* Added optimized POWER10 kernels for SAXPY, CAXPY, SDOT, DDOT and DGEMV_N
	* Improved DGEMM performance on POWER10
	* Improved STRSM and DTRSM performance on POWER9 and POWER10
	* Fixed segmemtation faults in DYNAMIC_ARCH builds
 	* Fixed compilation with the PGI compiler

x86:
	* Fixed compilation of kernels that require SSE2 intrinsics since 0.3.12

x86_64:
	* Added an optimized bfloat16 SBGEMV kernel for SkylakeX and Cooperlake
	* Improved the performance of SASUM and DASUM kernels through parallelization
	* Improved the performance of SROT and DROT kernels
	* Improved the performance of multithreaded xSYRK
	* Fixed OpenMP builds that use the LLVM Clang compiler together with GNU gfortran
	  (where linking of both the LLVM libomp and GNU libgomp could lead to lockups or
	  wrong results)
	* Fixed miscompilations by old gcc 4.6
	* Fixed misdetection of AVX2 capability in some Sandybridge cpus
	* Fixed lockups in builds combining DYNAMIC_ARCH with TARGET=GENERIC on OpenBSD

ARM64:
	* Fixed segmemtation faults in DYNAMIC_ARCH builds

MIPS:
	* Improved kernels for Loongson 3R3 ("3A") and 3R4 ("3B") models, including MSA
	* Fixed bugs in the MSA kernels for CGEMM, CTRMM, CGEMV and ZGEMV
	* Added handling of zero increments in the MSA kernels for SSWAP and DSWAP
	* Added DYNAMIC_ARCH support for MIPS64 (currently Loongson3R3/3R4 only)

SPARC:
	* Fixed building 32 and 64 bit SPARC kernels with the SolarisStudio compilers

====================================================================
Version 0.3.12
 24-Oct-2020

common:
	* Fixed missing BLAS/LAPACK functions (inadvertently dropped during
	  the build system restructuring)
	* Fixed argument conversion macro in LAPACKE_zgesvdq (LAPACK #458)

POWER:
	* Added optimized SCOPY/CCOPY kernels for POWER10
	* Increased and unified the default size of the GEMM BUFFER
	* Fixed building for POWER10 in DYNAMIC_ARCH mode
	* POWER10 compatibility test now checks binutils version as well
	* Cleaned up compiler warnings

x86_64:
	* corrected compiler version checks for AVX2 compatibility
	* added compiler option -mavx2 for building with flang
	* fixed direct SGEMM pathway for small matrix sizes (broken by
	  the code refactoring in 0.3.11)
	* fixed unhandled partial register clobbers in several kernels
	  for AXPY,DOT,GEMV_N and GEMV_T flagged by gcc10 tree-vectorizer

ARMV8:
	* improved Apple Vortex support to include cross-compiling

====================================================================
Version 0.3.11
 17-Oct-2020

common:
 	* API change:
	  the newly added BFLOAT16 functions were renamed to use the
	  letter "B" instead of "H" to avoid potential confusion with
	  the IEEE "half precision float" type, i.e. the 0.3.10
	  SHGEMM is now SBGEMM and the corresponding build option
	  was changed from "BUILD_HALF" to "BUILD_BFLOAT16".
	* Reduced the default BLAS3_MEM_ALLOC_THRESHOLD (used as an upper
	  limit for placing temporary arrays on the stack) to be compatible
	  with a stack size of 1mb (as imposed by the JAVA runtime library)
	* Added mixed-precision dot function SBDOT and utility functions
	  shstobf16, shdtobf16, sbf16tos and dbf16tod to convert between
	  single or double precision float arrays and bfloat16 arrays
	* Fixed prototypes of LAPACK_?ggsvp and LAPACK_?ggsvd functions
	  in lapack.h
	* Fixed underflow and rounding errors in LAPACK SLANV2 and DLANV2
	  (causing miscalculations in e.g. SHSEQR/DHSEQR, LAPACK issue #263)
	* Fixed workspace calculation in LAPACK ?GELQ (LAPACK issue #415)
	* Fixed several bugs in the LAPACK testsuite
	* Improved performance of TRMM and TRSM for certain problem sizes
	* Fixed infinite recursions and workspace miscalculations in ReLAPACK
	* CMAKE builds no longer require pkg-config for creating the .pc file
	* Makefile builds no longer misread NO_CBLAS=0 or NO_LAPACK=0 as
	  enabling these options
	* Fixed detection of gfortran when invoked through an mpi wrapper
	* Improve thread reinitialization performance with OpenMP after a fork
	* Added support for building only the subset of the library required
	  for a particular precision by specifying BUILD_SINGLE, BUILD_DOUBLE
	* Optional function name prefixes and suffixes are now correctly
	  reflected in the generated cblas.h
	* Added CMAKE build support for the LAPACK and multithreading tests

POWER:
	* Added optimized support for POWER10
	* Added support for compiling for POWER8 in 32bit mode
	* Added support for compilation with LLVM/clang
	* Added support for compilation with NVIDIA/PGI compilers
	* Fixed building on big-endian POWER8
	* Fixed miscompilation of ZDOTC by gcc10
	* Fixed alignment errors in the POWER8 SAXPY kernel
	* Improved CPU detection on AIX
	* Supported building with older compilers on POWER9

x86_64:
	* Added support for Intel Cooperlake
	* Added autodetection of AMD Renoir/Matisse/Zen3 cpus
	* Added autodetection of Intel Comet Lake cpus
	* Reimplemented ?sum, ?dot and daxpy using universal intrinsics
	* Reset the fpu state before using the fpu on Windows as a workaround
	  for a problem introduced in Windows 10 build 19041 (a.k.a. SDK 2004)
	* Fixed potentially undefined behaviour in the dot and gemv_t kernels
	* Fixed a potential segmentation fault in DYNAMIC_ARCH builds
	* Fixed building for ZEN with PGI/NVIDIA and AMD AOCC compilers

ARMV7:
	* Fixed cpu detection on BSD-like systems

ARMV8:
	* Added preliminary support for Apple Vortex cpus
	* Added support for the Cavium ThunderX3T110 cpu
	* Fixed cpu detection on BSD-like systems
	* Fixed compilation in -std=C18 mode

IBM Z:
	* Added support for compiling with the clang compiler
	* Improved GEMM performance on Z14
  • Loading branch information
thor committed May 29, 2021
1 parent 2e06fd1 commit f1ec362
Show file tree
Hide file tree
Showing 12 changed files with 165 additions and 168 deletions.
3 changes: 1 addition & 2 deletions math/openblas/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# $NetBSD: Makefile,v 1.2 2021/05/24 19:52:56 wiz Exp $
# $NetBSD: Makefile,v 1.3 2021/05/29 19:57:21 thor Exp $

MAINTAINER= [email protected]

OPENBLAS_VARIANT= openblas
PKGREVISION= 1
.include "../../math/openblas/Makefile.common"
.include "../../mk/bsd.pkg.mk"
31 changes: 7 additions & 24 deletions math/openblas/Makefile.common
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile.common,v 1.2 2021/03/25 23:22:35 thor Exp $
# $NetBSD: Makefile.common,v 1.3 2021/05/29 19:57:21 thor Exp $
#
# used by math/openblas_pthread/Makefile
# used by math/openblas_openmp/Makefile
Expand Down Expand Up @@ -73,48 +73,31 @@ MAKE_FLAGS+= OPENBLAS_CMAKE_DIR=${PREFIX}/lib/cmake/${OPENBLAS_VARIANT}
# TODO: Set INTERFACE64=1 with additional OPENBLAS_VARIANTs.
# 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
MAKE_FLAGS+= USE_OPENMP=0 USE_THREAD=0 USE_LOCKING=1
BENCHMARK_ENV= USE_SIMPLE_THREADED_LEVEL3=1
.elif ${OPENBLAS_VARIANT} == openblas_pthread
MAKE_FLAGS+= LIBNAMESUFFIX=pthread
MAKE_FLAGS+= USE_OPENMP=0 USE_THREAD=1
BENCHMARK_ENV= OPENBLAS_NUM_THREADS=${BENCHMARK_MAXTHREADS}
MAKE_FLAGS+= LIBNAMESUFFIX=pthread USE_OPENMP=0 USE_THREAD=1
.elif ${OPENBLAS_VARIANT} == openblas_openmp
MAKE_FLAGS+= LIBNAMESUFFIX=openmp
MAKE_FLAGS+= USE_OPENMP=1 NO_AFFINITY=1
BENCHMARK_ENV= OMP_NUM_THREADS=${BENCHMARK_MAXTHREADS}
MAKE_FLAGS+= LIBNAMESUFFIX=openmp USE_OPENMP=1 NO_AFFINITY=1
.endif

SUBST_CLASSES+= arch
SUBST_STAGE.arch= pre-build
SUBST_SED.arch+= -e "s+(ARCH)+(ARCH_)+g"
SUBST_FILES.arch+= Makefile.tail
SUBST_FILES.arch+= driver/level3/Makefile
SUBST_FILES.arch+= driver/others/Makefile
SUBST_FILES.arch+= exports/Makefile
SUBST_FILES.arch+= interface/Makefile
SUBST_FILES.arch+= kernel/Makefile
SUBST_FILES.arch+= kernel/Makefile.L3
SUBST_FILES.arch+= lapack/laswp/Makefile
SUBST_FILES.arch+= reference/Makefile
SUBST_FILES.arch+= Makefile.system

SUBST_CLASSES+= threads
SUBST_STAGE.threads= pre-build
SUBST_SED.threads+= -e "s+OPENBLAS_NUM_THREADS+OMP_NUM_THREADS+g"
SUBST_FILES.threads+= test/Makefile
SUBST_FILES.threads+= ctest/Makefile

# Fix up pkgconfig file installation.
SUBST_CLASSES+= pc
SUBST_STAGE.pc= pre-build
SUBST_SED.pc+= -e 's+-lopenblas+-l${OPENBLAS_VARIANT}+'
SUBST_SED.pc+= -e 's+openblas.pc"+${OPENBLAS_VARIANT}.pc"+'
SUBST_FILES.pc+= Makefile.install openblas.pc.in

PLIST_SRC= ${.CURDIR}/../../math/openblas/PLIST
PLIST_SUBST+= OPENBLAS_VARIANT=${OPENBLAS_VARIANT}

post-extract:
rm ${WRKSRC}/relapack/src/lapack_wrappers.c.orig
(cd ${DISTDIR}/${DIST_SUBDIR} && \
${CP} ${LARGE_FILE} ${TIMING_FILE} ${WRKSRC})

Expand Down
38 changes: 18 additions & 20 deletions math/openblas/distinfo
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
$NetBSD: distinfo,v 1.2 2021/03/25 23:22:35 thor Exp $
$NetBSD: distinfo,v 1.3 2021/05/29 19:57:21 thor Exp $

SHA1 (openblas-0.3.10/OpenBLAS-0.3.10.tar.gz) = cbe3fdd0e6ee235debc611d76976dac62f3ddc1c
RMD160 (openblas-0.3.10/OpenBLAS-0.3.10.tar.gz) = 031ed30a7934655dcbeb26d9d71f8e9ec3094a55
SHA512 (openblas-0.3.10/OpenBLAS-0.3.10.tar.gz) = 64a5f983b2f6e02cdb6e0f14433498cc5daa1ccfb49246f7a2dcd38f9982fa608f2abea069fe0e35012af8c1441c43d1f6418eaccd40795f5002fed1c36ce05d
Size (openblas-0.3.10/OpenBLAS-0.3.10.tar.gz) = 12246979 bytes
SHA1 (openblas-0.3.10/large.tgz) = a689e5b180595b40c5719b0f358b31b15b57a2db
RMD160 (openblas-0.3.10/large.tgz) = 8010ff4002ef42cf22a9ee9345011d68fc27d855
SHA512 (openblas-0.3.10/large.tgz) = e24db2b8a4253ccff9ca196815901c1fefd55e882f4fe1085715ac84b8f318e1842a91072130c17fdd144344ffc80233a77500da9349acb54e504b3935825965
Size (openblas-0.3.10/large.tgz) = 2595 bytes
SHA1 (openblas-0.3.10/timing.tgz) = fd47fc3f26d142a791df51e4a422a49662507252
RMD160 (openblas-0.3.10/timing.tgz) = f0fe220e7ab611d4db8d8cab960361955e2ab093
SHA512 (openblas-0.3.10/timing.tgz) = be0abfcfffdf0e118ed7e25a8451639833cf0ad6bb04d101bbe194c16f656b6ce509b2f76acf4ad626d1fb5b126bd5498cfea262f2946c2d077751112a2906af
Size (openblas-0.3.10/timing.tgz) = 1059485 bytes
SHA1 (patch-Makefile) = 91690ebbbe3acc0c4339120c752dfa22952db9eb
SHA1 (patch-Makefile.install) = 8d4320114f66dd6fabaec94c9710ebc5b7b49d39
SHA1 (patch-Makefile.system) = 4a0267b3181230cae4575041070fc30186355e0a
SHA1 (patch-c_check) = c5990809434a259399c75e660aad5abe83899548
SHA1 (openblas-0.3.15/OpenBLAS-0.3.15.tar.gz) = d7d1f67c1ef0c14c93761bdf44f0da8d0dd4bc0f
RMD160 (openblas-0.3.15/OpenBLAS-0.3.15.tar.gz) = b740a744c0405d036c39ee5224b7d18f542db788
SHA512 (openblas-0.3.15/OpenBLAS-0.3.15.tar.gz) = c07964ead5ffe9cf088364697bfe5cb409170663e420bdcd08a6366a028625d2a3c23ee4ddbaf0e625860a9fd08cbbb39f97eb985c366c052696d6f8598a844f
Size (openblas-0.3.15/OpenBLAS-0.3.15.tar.gz) = 12498434 bytes
SHA1 (openblas-0.3.15/large.tgz) = a689e5b180595b40c5719b0f358b31b15b57a2db
RMD160 (openblas-0.3.15/large.tgz) = 8010ff4002ef42cf22a9ee9345011d68fc27d855
SHA512 (openblas-0.3.15/large.tgz) = e24db2b8a4253ccff9ca196815901c1fefd55e882f4fe1085715ac84b8f318e1842a91072130c17fdd144344ffc80233a77500da9349acb54e504b3935825965
Size (openblas-0.3.15/large.tgz) = 2595 bytes
SHA1 (openblas-0.3.15/timing.tgz) = fd47fc3f26d142a791df51e4a422a49662507252
RMD160 (openblas-0.3.15/timing.tgz) = f0fe220e7ab611d4db8d8cab960361955e2ab093
SHA512 (openblas-0.3.15/timing.tgz) = be0abfcfffdf0e118ed7e25a8451639833cf0ad6bb04d101bbe194c16f656b6ce509b2f76acf4ad626d1fb5b126bd5498cfea262f2946c2d077751112a2906af
Size (openblas-0.3.15/timing.tgz) = 1059485 bytes
SHA1 (patch-Makefile) = 6b1db300b5487fca53e7c41c27b64017658e6375
SHA1 (patch-Makefile.install) = eadba533232b2bf7c6ab5e4efe0db9206f35011d
SHA1 (patch-Makefile.rule) = 45b6b4576fb521fa093252c63b899d4178a516b6
SHA1 (patch-Makefile.system) = 6dc9fd85731ca88cb1fdb9063ba3baa31edbcfb8
SHA1 (patch-common__arm.h) = f08ec61bee8317daac267e90a79f46097b3431c9
SHA1 (patch-cpuid__arm.c) = 20f95cede90cbe548c0cd09ed2e3d37d1d4aeabd
SHA1 (patch-cpuid__arm64.c) = bbeb7222b32ec821511a6798fc27ff7269700662
SHA1 (patch-cpuid_ia64.c) = 39649319b8c0a37b8d494e3c03b1ddb6fb616603
SHA1 (patch-exports+Makefile) = 03f5b3cc41d215a961bb4d1dd197d72f8ddaadbc
SHA1 (patch-f_check) = 9162d6a31f96c6af5aada82f6e78cf0385384215
SHA1 (patch-f_check) = 9181958ddd7dca16f28b1144ce7f400b5ab36301
SHA1 (patch-getarch.c) = 0cf098b7203586206df95b24d1e95b0b5b9fd500
SHA1 (patch-interface__ztrmv.c) = 6038946f8fb9542e680178ece2bd0d0d5853baad
62 changes: 41 additions & 21 deletions math/openblas/patches/patch-Makefile
Original file line number Diff line number Diff line change
@@ -1,63 +1,83 @@
$NetBSD: patch-Makefile,v 1.2 2021/03/25 23:22:35 thor Exp $
$NetBSD: patch-Makefile,v 1.3 2021/05/29 19:57:21 thor Exp $

Remove special library names.

--- Makefile.orig 2020-06-14 20:03:04.000000000 +0000
--- Makefile.orig 2021-05-02 21:50:22.000000000 +0000
+++ Makefile
@@ -115,7 +115,6 @@ ifneq ($(NO_SHARED), 1)
@@ -120,18 +120,28 @@ shared :
ifneq ($(NO_SHARED), 1)
ifeq ($(OSNAME), $(filter $(OSNAME),Linux SunOS Android Haiku FreeBSD DragonFly))
@$(MAKE) -C exports so
+ifneq ($(LIBSONAME), $(LIBPREFIX).so)
@ln -fs $(LIBSONAME) $(LIBPREFIX).so
- @ln -fs $(LIBSONAME) $(LIBPREFIX).so.$(MAJOR_VERSION)
+endif
+ifneq ($(LIBSONAME), $(LIBPREFIX).so.$(MAJOR_VERSION))
@ln -fs $(LIBSONAME) $(LIBPREFIX).so.$(MAJOR_VERSION)
endif
+endif
ifeq ($(OSNAME), $(filter $(OSNAME),OpenBSD NetBSD))
@$(MAKE) -C exports so
@@ -123,8 +122,6 @@ ifeq ($(OSNAME), $(filter $(OSNAME),Open
+ifneq ($(LIBSONAME), $(LIBPREFIX).so)
@ln -fs $(LIBSONAME) $(LIBPREFIX).so
endif
+endif
ifeq ($(OSNAME), Darwin)
@$(MAKE) -C exports dyn
- @ln -fs $(LIBDYNNAME) $(LIBPREFIX).dylib
- @ln -fs $(LIBDYNNAME) $(LIBPREFIX).$(MAJOR_VERSION).dylib
+ifneq ($(LIBDYNNAME), $(LIBPREFIX).dylib)
@ln -fs $(LIBDYNNAME) $(LIBPREFIX).dylib
+endif
+ifneq ($(LIBDYNNAME), $(LIBPREFIX).$(MAJOR_VERSION).dylib)
@ln -fs $(LIBDYNNAME) $(LIBPREFIX).$(MAJOR_VERSION).dylib
endif
+endif
ifeq ($(OSNAME), WINNT)
@$(MAKE) -C exports dll
@@ -161,7 +158,6 @@ ifeq ($(NO_SHARED), 1)
$(error OpenBLAS: neither static nor shared are enabled.)
endif
@@ -195,13 +205,17 @@ endif
ifdef USE_THREAD
@echo USE_THREAD=$(USE_THREAD) >> Makefile.conf_last
endif
- @-ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
@for d in $(SUBDIRS) ; \
do if test -d $$d; then \
$(MAKE) -C $$d $(@F) || exit 1 ; \
@@ -195,7 +191,6 @@ endif
+ifneq ($(LIBNAME), $(LIBPREFIX).$(LIBSUFFIX))
@-ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
+endif
@touch lib.grd
prof : prof_blas prof_lapack

prof_blas :
- ln -fs $(LIBNAME_P) $(LIBPREFIX)_p.$(LIBSUFFIX)
+ifneq ($(LIBNAME_P), $(LIBPREFIX)_p.$(LIBSUFFIX))
ln -fs $(LIBNAME_P) $(LIBPREFIX)_p.$(LIBSUFFIX)
+endif
for d in $(SUBDIRS) ; \
do if test -d $$d; then \
$(MAKE) -C $$d prof || exit 1 ; \
@@ -206,7 +201,6 @@ ifeq ($(DYNAMIC_ARCH), 1)
@@ -212,7 +226,9 @@ ifeq ($(DYNAMIC_ARCH), 1)
endif

blas :
- ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
+ifneq ($(LIBNAME), $(LIBPREFIX).$(LIBSUFFIX))
ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
+endif
for d in $(BLASDIRS) ; \
do if test -d $$d; then \
$(MAKE) -C $$d libs || exit 1 ; \
@@ -214,7 +208,6 @@ blas :
@@ -220,7 +236,9 @@ blas :
done

hpl :
- ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
+ifneq ($(LIBNAME), $(LIBPREFIX).$(LIBSUFFIX))
ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
+endif
for d in $(BLASDIRS) ../laswp exports ; \
do if test -d $$d; then \
$(MAKE) -C $$d $(@F) || exit 1 ; \
@@ -228,7 +221,6 @@ ifeq ($(DYNAMIC_ARCH), 1)
@@ -234,7 +252,9 @@ ifeq ($(DYNAMIC_ARCH), 1)
endif

hpl_p :
- ln -fs $(LIBNAME_P) $(LIBPREFIX)_p.$(LIBSUFFIX)
+ifneq ($(LIBNAME_P), $(LIBPREFIX)_p.$(LIBSUFFIX))
ln -fs $(LIBNAME_P) $(LIBPREFIX)_p.$(LIBSUFFIX)
+endif
for d in $(SUBDIRS) ../laswp exports ; \
do if test -d $$d; then \
$(MAKE) -C $$d $(@F) || exit 1 ; \
65 changes: 54 additions & 11 deletions math/openblas/patches/patch-Makefile.install
Original file line number Diff line number Diff line change
@@ -1,43 +1,86 @@
$NetBSD: patch-Makefile.install,v 1.2 2021/03/25 23:22:35 thor Exp $
$NetBSD: patch-Makefile.install,v 1.3 2021/05/29 19:57:21 thor Exp $

Second part of removing the special library names.

--- Makefile.install.orig 2020-06-14 20:03:04.000000000 +0000
--- Makefile.install.orig 2021-05-02 21:50:22.000000000 +0000
+++ Makefile.install
@@ -62,8 +62,6 @@ endif
@@ -85,29 +85,35 @@ endif
ifneq ($(NO_STATIC),1)
@echo Copying the static library to $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)
@install -pm644 $(LIBNAME) "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)"
- @cd "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)" ; \
- ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
+ifneq ($(LIBNAME), $(LIBPREFIX).$(LIBSUFFIX))
@cd "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)" ; \
ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
endif
+endif
#for install shared library
ifneq ($(NO_SHARED),1)
@@ -71,8 +69,7 @@ ifneq ($(NO_SHARED),1)
@echo Copying the shared library to $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)
ifeq ($(OSNAME), $(filter $(OSNAME),Linux SunOS Android Haiku FreeBSD DragonFly))
@install -pm755 $(LIBSONAME) "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)"
@cd "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)" ; \
- ln -fs $(LIBSONAME) $(LIBPREFIX).so ; \
- ln -fs $(LIBSONAME) $(LIBPREFIX).so.$(MAJOR_VERSION)
+ ln -fs $(LIBSONAME) $(LIBPREFIX).so
+ if ! test $(LIBSONAME) = $(LIBPREFIX).so; then \
+ ln -fs $(LIBSONAME) $(LIBPREFIX).so ; fi ; \
+ if ! test $(LIBSONAME) = $(LIBPREFIX).so.$(MAJOR_VERSION); then \
+ ln -fs $(LIBSONAME) $(LIBPREFIX).so.$(MAJOR_VERSION); fi
endif

ifeq ($(OSNAME), $(filter $(OSNAME),OpenBSD NetBSD))
@@ -112,16 +109,13 @@ endif
@cp $(LIBSONAME) "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)"
+ifneq ($(LIBSONAME), $(LIBPREFIX).so)
@cd "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)" ; \
ln -fs $(LIBSONAME) $(LIBPREFIX).so
endif
+endif
ifeq ($(OSNAME), Darwin)
@-cp $(LIBDYNNAME) "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)"
@-install_name_tool -id "$(OPENBLAS_LIBRARY_DIR)/$(LIBPREFIX).$(MAJOR_VERSION).dylib" "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME)"
@cd "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)" ; \
- ln -fs $(LIBDYNNAME) $(LIBPREFIX).dylib ; \
+ if ! test $(LIBDYNNAME) = $(LIBPREFIX).dylib; then ln -fs $(LIBDYNNAME) $(LIBPREFIX).dylib; fi ; \
ln -fs $(LIBDYNNAME) $(LIBPREFIX).$(MAJOR_VERSION).dylib
endif
ifeq ($(OSNAME), WINNT)
@@ -135,28 +141,32 @@ endif
ifneq ($(NO_STATIC),1)
@echo Copying the static library to $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)
@installbsd -c -m 644 $(LIBNAME) "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)"
- @cd "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)" ; \
- ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
+ifneq ($(LIBNAME), $(LIBPREFIX).$(LIBSUFFIX))
@cd "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)" ; \
ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
endif
+endif
#for install shared library
ifneq ($(NO_SHARED),1)
@echo Copying the shared library to $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)
@installbsd -c -m 755 $(LIBSONAME) "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)"
@cd "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)" ; \
- ln -fs $(LIBSONAME) $(LIBPREFIX).so ; \
- ln -fs $(LIBSONAME) $(LIBPREFIX).so.$(MAJOR_VERSION)
+ ln -fs $(LIBSONAME) $(LIBPREFIX).so
+ if ! test $(LIBSONAME) = $(LIBPREFIX).so; then \
+ ln -fs $(LIBSONAME) $(LIBPREFIX).so ; fi ; \
+ if ! test $(LIBSONAME) = $(LIBPREFIX).so.$(MAJOR_VERSION); then \
+ ln -fs $(LIBSONAME) $(LIBPREFIX).so.$(MAJOR_VERSION) ; fi
endif

endif

#Generating openblas.pc
@echo Generating $(LIBSONAMEBASE).pc in "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)"
- @echo 'libdir='$(OPENBLAS_LIBRARY_DIR) > "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/$(LIBSONAMEBASE).pc"
- @echo 'includedir='$(OPENBLAS_INCLUDE_DIR) >> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/$(LIBSONAMEBASE).pc"
- @echo 'openblas_config= USE_64BITINT='$(USE_64BITINT) 'DYNAMIC_ARCH='$(DYNAMIC_ARCH) 'DYNAMIC_OLDER='$(DYNAMIC_OLDER) 'NO_CBLAS='$(NO_CBLAS) 'NO_LAPACK='$(NO_LAPACK) 'NO_LAPACKE='$(NO_LAPACKE) 'NO_AFFINITY='$(NO_AFFINITY) 'USE_OPENMP='$(USE_OPENMP) $(CORE) 'MAX_THREADS='$(NUM_THREADS)>> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/$(LIBSONAMEBASE).pc"
- @echo 'version='$(VERSION) >> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/$(LIBSONAMEBASE).pc"
- @echo 'extralib='$(PKG_EXTRALIB) >> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/$(LIBSONAMEBASE).pc"
- @cat openblas.pc.in >> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/$(LIBSONAMEBASE).pc"
+ @echo 'libdir='$(OPENBLAS_LIBRARY_DIR) > "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/$(LIBNAMEBASE).pc"
+ @echo 'includedir='$(OPENBLAS_INCLUDE_DIR) >> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/$(LIBNAMEBASE).pc"
+ @echo 'openblas_config= USE_64BITINT='$(USE_64BITINT) 'DYNAMIC_ARCH='$(DYNAMIC_ARCH) 'DYNAMIC_OLDER='$(DYNAMIC_OLDER) 'NO_CBLAS='$(NO_CBLAS) 'NO_LAPACK='$(NO_LAPACK) 'NO_LAPACKE='$(NO_LAPACKE) 'NO_AFFINITY='$(NO_AFFINITY) 'USE_OPENMP='$(USE_OPENMP) $(CORE) 'MAX_THREADS='$(NUM_THREADS)>> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/$(LIBNAMEBASE).pc"
+ @echo 'version='$(VERSION) >> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/$(LIBNAMEBASE).pc"
+ @echo 'extralib='$(PKG_EXTRALIB) >> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/$(LIBNAMEBASE).pc"
+ @cat openblas.pc.in | sed -e 's,-lopenblas$$,-l$(LIBNAMEBASE),' >> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/$(LIBNAMEBASE).pc"


#Generating OpenBLASConfig.cmake
17 changes: 17 additions & 0 deletions math/openblas/patches/patch-Makefile.rule
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
$NetBSD: patch-Makefile.rule,v 1.1 2021/05/29 19:57:21 thor Exp $

Stable library names, determined by our choice only.

--- Makefile.rule.orig 2021-05-02 21:50:22.000000000 +0000
+++ Makefile.rule
@@ -10,6 +10,10 @@ VERSION = 0.3.15
# is libopenblas_$(LIBNAMESUFFIX).so.0.
# LIBNAMESUFFIX = omp

+# Set this to cause the primary library name be actually ruled by the above,
+# not just a symlink to a library name determined by chosen CPU etc.
+# FIXED_LIBNAME = 1
+
# You can specify the target architecture, otherwise it's
# automatically detected.
# TARGET = PENRYN
Loading

0 comments on commit f1ec362

Please sign in to comment.