diff --git a/openblas-0.2.15-system_lapack.patch b/openblas-0.2.15-system_lapack.patch new file mode 100644 index 0000000000000000000000000000000000000000..4b843a9a4c853a9255c78eb38dc4713f89edd705 --- /dev/null +++ b/openblas-0.2.15-system_lapack.patch @@ -0,0 +1,87 @@ +diff -up OpenBLAS-0.2.15/Makefile.system_lapack OpenBLAS-0.2.15/Makefile +--- OpenBLAS-0.2.15/Makefile.system_lapack 2015-10-27 13:44:50.000000000 -0700 ++++ OpenBLAS-0.2.15/Makefile 2015-10-28 09:14:56.696685503 -0700 +@@ -16,11 +16,7 @@ BLASDIRS += reference + endif + + SUBDIRS = $(BLASDIRS) +-ifneq ($(NO_LAPACK), 1) +-SUBDIRS += lapack +-endif +- +-LAPACK_NOOPT := $(filter-out -O0 -O1 -O2 -O3 -Ofast,$(LAPACK_FFLAGS)) ++SUBDIRS += lapack + + SUBDIRS_ALL = $(SUBDIRS) test ctest utest exports benchmark ../laswp ../bench + +@@ -211,57 +207,8 @@ hpl_p : + fi; \ + done + +-ifeq ($(NO_LAPACK), 1) + netlib : +- +-else +-netlib : lapack_prebuild +-ifndef NOFORTRAN +- @$(MAKE) -C $(NETLIB_LAPACK_DIR) lapacklib +- @$(MAKE) -C $(NETLIB_LAPACK_DIR) tmglib +-endif +-ifndef NO_LAPACKE +- @$(MAKE) -C $(NETLIB_LAPACK_DIR) lapackelib +-endif +-endif +- +-prof_lapack : lapack_prebuild +- @$(MAKE) -C $(NETLIB_LAPACK_DIR) lapack_prof +- +-lapack_prebuild : +-ifndef NOFORTRAN +- -@echo "FORTRAN = $(FC)" > $(NETLIB_LAPACK_DIR)/make.inc +- -@echo "OPTS = $(LAPACK_FFLAGS)" >> $(NETLIB_LAPACK_DIR)/make.inc +- -@echo "POPTS = $(LAPACK_FPFLAGS)" >> $(NETLIB_LAPACK_DIR)/make.inc +- -@echo "NOOPT = -O0 $(LAPACK_NOOPT)" >> $(NETLIB_LAPACK_DIR)/make.inc +- -@echo "PNOOPT = $(LAPACK_FPFLAGS) -O0" >> $(NETLIB_LAPACK_DIR)/make.inc +- -@echo "LOADOPTS = $(FFLAGS) $(EXTRALIB)" >> $(NETLIB_LAPACK_DIR)/make.inc +- -@echo "CC = $(CC)" >> $(NETLIB_LAPACK_DIR)/make.inc +- -@echo "override CFLAGS = $(LAPACK_CFLAGS)" >> $(NETLIB_LAPACK_DIR)/make.inc +- -@echo "ARCH = $(AR)" >> $(NETLIB_LAPACK_DIR)/make.inc +- -@echo "ARCHFLAGS = -ru" >> $(NETLIB_LAPACK_DIR)/make.inc +- -@echo "RANLIB = $(RANLIB)" >> $(NETLIB_LAPACK_DIR)/make.inc +- -@echo "LAPACKLIB = ../$(LIBNAME)" >> $(NETLIB_LAPACK_DIR)/make.inc +- -@echo "TMGLIB = ../$(LIBNAME)" >> $(NETLIB_LAPACK_DIR)/make.inc +- -@echo "BLASLIB = ../../../$(LIBNAME)" >> $(NETLIB_LAPACK_DIR)/make.inc +- -@echo "LAPACKELIB = ../$(LIBNAME)" >> $(NETLIB_LAPACK_DIR)/make.inc +- -@echo "LAPACKLIB_P = ../$(LIBNAME_P)" >> $(NETLIB_LAPACK_DIR)/make.inc +- -@echo "SUFFIX = $(SUFFIX)" >> $(NETLIB_LAPACK_DIR)/make.inc +- -@echo "PSUFFIX = $(PSUFFIX)" >> $(NETLIB_LAPACK_DIR)/make.inc +- -@echo "CEXTRALIB = $(EXTRALIB)" >> $(NETLIB_LAPACK_DIR)/make.inc +-ifeq ($(FC), gfortran) +- -@echo "TIMER = INT_ETIME" >> $(NETLIB_LAPACK_DIR)/make.inc +-ifdef SMP +- -@echo "LOADER = $(FC) -pthread" >> $(NETLIB_LAPACK_DIR)/make.inc +-else +- -@echo "LOADER = $(FC)" >> $(NETLIB_LAPACK_DIR)/make.inc +-endif +-else +- -@echo "TIMER = NONE" >> $(NETLIB_LAPACK_DIR)/make.inc +- -@echo "LOADER = $(FC)" >> $(NETLIB_LAPACK_DIR)/make.inc +-endif +- -@cat make.inc >> $(NETLIB_LAPACK_DIR)/make.inc +-endif ++ @$(MAKE) -C $(NETLIB_LAPACK_DIR) + + large.tgz : + ifndef NOFORTRAN +diff -up OpenBLAS-0.2.15/Makefile.system.system_lapack OpenBLAS-0.2.15/Makefile.system +--- OpenBLAS-0.2.15/Makefile.system.system_lapack 2015-10-27 13:44:50.000000000 -0700 ++++ OpenBLAS-0.2.15/Makefile.system 2015-10-28 09:14:39.994350500 -0700 +@@ -9,7 +9,7 @@ ifndef TOPDIR + TOPDIR = . + endif + +-NETLIB_LAPACK_DIR = $(TOPDIR)/lapack-netlib ++NETLIB_LAPACK_DIR = $(TOPDIR)/netliblapack + + # Default C compiler + # - Only set if not specified on the command line or inherited from the environment. diff --git a/openblas-0.2.5-libname.patch b/openblas-0.2.5-libname.patch new file mode 100644 index 0000000000000000000000000000000000000000..e30ab8bf91ad0dfb05572b11cb21680483cce0d4 --- /dev/null +++ b/openblas-0.2.5-libname.patch @@ -0,0 +1,24 @@ +diff -up OpenBLAS-0.2.5/Makefile.system.orig OpenBLAS-0.2.5/Makefile.system +--- OpenBLAS-0.2.5/Makefile.system.orig 2012-11-27 01:24:53.000000000 +0200 ++++ OpenBLAS-0.2.5/Makefile.system 2012-12-24 16:13:57.316689688 +0200 +@@ -758,16 +758,16 @@ ifndef SMP + LIBNAME = $(LIBPREFIX)_$(LIBCORE)$(REVISION).$(LIBSUFFIX) + LIBNAME_P = $(LIBPREFIX)_$(LIBCORE)$(REVISION)_p.$(LIBSUFFIX) + else +-LIBNAME = $(LIBPREFIX)_$(LIBCORE)p$(REVISION).$(LIBSUFFIX) +-LIBNAME_P = $(LIBPREFIX)_$(LIBCORE)p$(REVISION)_p.$(LIBSUFFIX) ++LIBNAME = $(LIBPREFIX)_$(LIBCORE)$(REVISION).$(LIBSUFFIX) ++LIBNAME_P = $(LIBPREFIX)_$(LIBCORE)$(REVISION)_p.$(LIBSUFFIX) + endif + else + ifndef SMP + LIBNAME = $(LIBPREFIX)$(REVISION).$(LIBSUFFIX) + LIBNAME_P = $(LIBPREFIX)$(REVISION)_p.$(LIBSUFFIX) + else +-LIBNAME = $(LIBPREFIX)p$(REVISION).$(LIBSUFFIX) +-LIBNAME_P = $(LIBPREFIX)p$(REVISION)_p.$(LIBSUFFIX) ++LIBNAME = $(LIBPREFIX)$(REVISION).$(LIBSUFFIX) ++LIBNAME_P = $(LIBPREFIX)$(REVISION)_p.$(LIBSUFFIX) + endif + endif + diff --git a/openblas-0.3.11-tests.patch b/openblas-0.3.11-tests.patch new file mode 100644 index 0000000000000000000000000000000000000000..abbdf45f4aeaf952f7fb1707a8104a4892023963 --- /dev/null +++ b/openblas-0.3.11-tests.patch @@ -0,0 +1,26 @@ +diff -up OpenBLAS-0.3.21/Makefile.fixtests OpenBLAS-0.3.21/Makefile +--- OpenBLAS-0.3.21/Makefile.fixtests 2022-08-26 07:37:06.257272957 +0200 ++++ OpenBLAS-0.3.21/Makefile 2022-08-26 07:37:53.168414307 +0200 +@@ -147,18 +147,18 @@ tests : + ifeq ($(NOFORTRAN), $(filter 0,$(NOFORTRAN))) + touch $(LIBNAME) + ifndef NO_FBLAS +- $(MAKE) -C test all ++ $(MAKE) -C test FC="$(FC)" CC="$(CC)" COMMON_OPT="$(COMMON_OPT)" FCOMMON_OPT="$(FCOMMON_OPT)" all + endif + endif + ifneq ($(ONLY_CBLAS), 1) +- $(MAKE) -C utest all ++ $(MAKE) -C utest FC="$(FC)" CC="$(CC)" COMMON_OPT="$(COMMON_OPT)" FCOMMON_OPT="$(FCOMMON_OPT)" all + endif + ifneq ($(NO_CBLAS), 1) + ifneq ($(ONLY_CBLAS), 1) +- $(MAKE) -C ctest all ++ $(MAKE) -C ctest FC="$(FC)" CC="$(CC)" COMMON_OPT="$(COMMON_OPT)" FCOMMON_OPT="$(FCOMMON_OPT)" all + endif + ifeq ($(CPP_THREAD_SAFETY_TEST), 1) +- $(MAKE) -C cpp_thread_test all ++ $(MAKE) -C cpp_thread_test FC="$(FC)" CC="$(CC)" COMMON_OPT="$(COMMON_OPT)" FCOMMON_OPT="$(FCOMMON_OPT)" all + endif + endif + diff --git a/openblas-0.3.21-c99-1.patch b/openblas-0.3.21-c99-1.patch new file mode 100644 index 0000000000000000000000000000000000000000..413ddd63fe696cd6610902478a23b8ed0d19e37d --- /dev/null +++ b/openblas-0.3.21-c99-1.patch @@ -0,0 +1,64 @@ +From f703846ad9400a8ea175cb8dd43e18c152aeab93 Mon Sep 17 00:00:00 2001 +From: Martin Kroeker +Date: Sat, 13 Aug 2022 11:38:27 +0200 +Subject: [PATCH] Add function prototypes +Content-type: text/plain + +--- + exports/gensymbol | 16 ++++++++++++++++ + exports/gensymbol.pl | 12 ++++++++++++ + 2 files changed, 28 insertions(+) + +diff --git a/exports/gensymbol b/exports/gensymbol +index 83222a21..f05de626 100755 +--- a/exports/gensymbol ++++ b/exports/gensymbol +@@ -4000,6 +4000,22 @@ case "$p1" in + no_underscore_objs="$no_underscore_objs $misc_common_objs" + + printf 'int main(void){\n' ++ for obj in $underscore_objs; do ++ [ "$obj" != "xerbla" ] && printf 'extern void %s%s%s%s();\n' \ ++ "$symbolprefix" "$obj" "$bu" "$symbolsuffix" ++ done ++ ++ for obj in $need_2underscore_objs; do ++ printf 'extern void %s%s%s%s%s();\n' \ ++ "$symbolprefix" "$obj" "$bu" "$bu" "$symbolsuffix" ++ done ++ ++ for obj in $no_underscore_objs; do ++ printf 'extern void %s%s%s();\n' \ ++ "$symbolprefix" "$obj" "$symbolsuffix" ++ done ++ ++ printf '\n' + for obj in $underscore_objs; do + [ "$obj" != "xerbla" ] && printf '%s%s%s%s();\n' \ + "$symbolprefix" "$obj" "$bu" "$symbolsuffix" +diff --git a/exports/gensymbol.pl b/exports/gensymbol.pl +index ac62bc05..e38a3cc8 100644 +--- a/exports/gensymbol.pl ++++ b/exports/gensymbol.pl +@@ -3955,6 +3955,18 @@ if ($ARGV[0] eq "linktest") { + @no_underscore_objs = (@no_underscore_objs, @misc_common_objs); + + print "int main(void){\n"; ++ foreach $objs (@underscore_objs) { ++ print "extern void ", $symbolprefix, $objs, $bu, $symbolsuffix, "();\n" if $objs ne "xerbla"; ++ } ++ ++ foreach $objs (@need_2underscore_objs) { ++ print "extern void ", $symbolprefix, $objs, $bu, $bu, $symbolsuffix, "();\n"; ++ } ++ ++ foreach $objs (@no_underscore_objs) { ++ print "extern void ", $symbolprefix, $objs, $symbolsuffix, "();\n"; ++ } ++ + foreach $objs (@underscore_objs) { + print $symbolprefix, $objs, $bu, $symbolsuffix, "();\n" if $objs ne "xerbla"; + } +-- +2.37.3 + diff --git a/openblas-0.3.21-c99-2.patch b/openblas-0.3.21-c99-2.patch new file mode 100644 index 0000000000000000000000000000000000000000..2a028ca7388d224d34d40062b0c290a560cc81c0 --- /dev/null +++ b/openblas-0.3.21-c99-2.patch @@ -0,0 +1,510 @@ +From 515cf269291bec0d43651fe7bf99a71fb074a0ad Mon Sep 17 00:00:00 2001 +From: Martin Kroeker +Date: Wed, 14 Sep 2022 11:48:36 +0200 +Subject: [PATCH] Fix pointer/integer argument mismatch in calls to pow() +Content-type: text/plain + +--- + lapack-netlib/SRC/claed0.c | 4 ++-- + lapack-netlib/SRC/claed7.c | 4 ++-- + lapack-netlib/SRC/clalsa.c | 6 +++--- + lapack-netlib/SRC/cstedc.c | 4 ++-- + lapack-netlib/SRC/dlaed0.c | 4 ++-- + lapack-netlib/SRC/dlaed7.c | 4 ++-- + lapack-netlib/SRC/dlaeda.c | 8 ++++---- + lapack-netlib/SRC/dlalsa.c | 6 +++--- + lapack-netlib/SRC/dlasd0.c | 2 +- + lapack-netlib/SRC/dlasda.c | 4 ++-- + lapack-netlib/SRC/dstedc.c | 4 ++-- + lapack-netlib/SRC/slaed0.c | 4 ++-- + lapack-netlib/SRC/slaed7.c | 4 ++-- + lapack-netlib/SRC/slaeda.c | 8 ++++---- + lapack-netlib/SRC/slalsa.c | 6 +++--- + lapack-netlib/SRC/slasd0.c | 2 +- + lapack-netlib/SRC/slasda.c | 4 ++-- + lapack-netlib/SRC/sstedc.c | 4 ++-- + lapack-netlib/SRC/zlaed0.c | 4 ++-- + lapack-netlib/SRC/zlaed7.c | 4 ++-- + lapack-netlib/SRC/zlalsa.c | 6 +++--- + lapack-netlib/SRC/zstedc.c | 4 ++-- + 22 files changed, 50 insertions(+), 50 deletions(-) + +diff --git a/lapack-netlib/SRC/claed0.c b/lapack-netlib/SRC/claed0.c +index 21e40839..2b696508 100644 +--- a/lapack-netlib/SRC/claed0.c ++++ b/lapack-netlib/SRC/claed0.c +@@ -796,10 +796,10 @@ L10: + + temp = log((real) (*n)) / log(2.f); + lgn = (integer) temp; +- if (pow_ii(&c__2, &lgn) < *n) { ++ if (pow_ii(c__2, lgn) < *n) { + ++lgn; + } +- if (pow_ii(&c__2, &lgn) < *n) { ++ if (pow_ii(c__2, lgn) < *n) { + ++lgn; + } + iprmpt = indxq + *n + 1; +diff --git a/lapack-netlib/SRC/claed7.c b/lapack-netlib/SRC/claed7.c +index 49fc9ed4..1eaa7e9c 100644 +--- a/lapack-netlib/SRC/claed7.c ++++ b/lapack-netlib/SRC/claed7.c +@@ -864,11 +864,11 @@ f"> */ + /* Form the z-vector which consists of the last row of Q_1 and the */ + /* first row of Q_2. */ + +- ptr = pow_ii(&c__2, tlvls) + 1; ++ ptr = pow_ii(c__2, *tlvls) + 1; + i__1 = *curlvl - 1; + for (i__ = 1; i__ <= i__1; ++i__) { + i__2 = *tlvls - i__; +- ptr += pow_ii(&c__2, &i__2); ++ ptr += pow_ii(c__2, i__2); + /* L10: */ + } + curr = ptr + *curpbm; +diff --git a/lapack-netlib/SRC/clalsa.c b/lapack-netlib/SRC/clalsa.c +index 4bc3830a..2ef3e123 100644 +--- a/lapack-netlib/SRC/clalsa.c ++++ b/lapack-netlib/SRC/clalsa.c +@@ -1051,7 +1051,7 @@ f"> */ + /* Finally go through the left singular vector matrices of all */ + /* the other subproblems bottom-up on the tree. */ + +- j = pow_ii(&c__2, &nlvl); ++ j = pow_ii(c__2, nlvl); + sqre = 0; + + for (lvl = nlvl; lvl >= 1; --lvl) { +@@ -1065,7 +1065,7 @@ f"> */ + ll = 1; + } else { + i__1 = lvl - 1; +- lf = pow_ii(&c__2, &i__1); ++ lf = pow_ii(c__2, i__1); + ll = (lf << 1) - 1; + } + i__1 = ll; +@@ -1110,7 +1110,7 @@ L170: + ll = 1; + } else { + i__2 = lvl - 1; +- lf = pow_ii(&c__2, &i__2); ++ lf = pow_ii(c__2, i__2); + ll = (lf << 1) - 1; + } + i__2 = lf; +diff --git a/lapack-netlib/SRC/cstedc.c b/lapack-netlib/SRC/cstedc.c +index 437c39e9..8f047d1c 100644 +--- a/lapack-netlib/SRC/cstedc.c ++++ b/lapack-netlib/SRC/cstedc.c +@@ -836,10 +836,10 @@ f"> */ + lrwmin = *n - 1 << 1; + } else if (icompz == 1) { + lgn = (integer) (log((real) (*n)) / log(2.f)); +- if (pow_ii(&c__2, &lgn) < *n) { ++ if (pow_ii(c__2, lgn) < *n) { + ++lgn; + } +- if (pow_ii(&c__2, &lgn) < *n) { ++ if (pow_ii(c__2, lgn) < *n) { + ++lgn; + } + lwmin = *n * *n; +diff --git a/lapack-netlib/SRC/dlaed0.c b/lapack-netlib/SRC/dlaed0.c +index 95e39b0d..74e58dd2 100644 +--- a/lapack-netlib/SRC/dlaed0.c ++++ b/lapack-netlib/SRC/dlaed0.c +@@ -827,10 +827,10 @@ L10: + + temp = log((doublereal) (*n)) / log(2.); + lgn = (integer) temp; +- if (pow_ii(&c__2, &lgn) < *n) { ++ if (pow_ii(c__2, lgn) < *n) { + ++lgn; + } +- if (pow_ii(&c__2, &lgn) < *n) { ++ if (pow_ii(c__2, lgn) < *n) { + ++lgn; + } + iprmpt = indxq + *n + 1; +diff --git a/lapack-netlib/SRC/dlaed7.c b/lapack-netlib/SRC/dlaed7.c +index fd851526..d23a72be 100644 +--- a/lapack-netlib/SRC/dlaed7.c ++++ b/lapack-netlib/SRC/dlaed7.c +@@ -885,11 +885,11 @@ f"> */ + /* Form the z-vector which consists of the last row of Q_1 and the */ + /* first row of Q_2. */ + +- ptr = pow_ii(&c__2, tlvls) + 1; ++ ptr = pow_ii(c__2, *tlvls) + 1; + i__1 = *curlvl - 1; + for (i__ = 1; i__ <= i__1; ++i__) { + i__2 = *tlvls - i__; +- ptr += pow_ii(&c__2, &i__2); ++ ptr += pow_ii(c__2, i__2); + /* L10: */ + } + curr = ptr + *curpbm; +diff --git a/lapack-netlib/SRC/dlaeda.c b/lapack-netlib/SRC/dlaeda.c +index f4bb214d..202e1b63 100644 +--- a/lapack-netlib/SRC/dlaeda.c ++++ b/lapack-netlib/SRC/dlaeda.c +@@ -754,7 +754,7 @@ f"> */ + /* scheme */ + + i__1 = *curlvl - 1; +- curr = ptr + *curpbm * pow_ii(&c__2, curlvl) + pow_ii(&c__2, &i__1) - 1; ++ curr = ptr + *curpbm * pow_ii(c__2, *curlvl) + pow_ii(c__2, i__1) - 1; + + /* Determine size of these matrices. We add HALF to the value of */ + /* the SQRT in case the machine underestimates one of these square */ +@@ -781,12 +781,12 @@ f"> */ + /* rotations and permutation and then multiplying the center matrices */ + /* against the current Z. */ + +- ptr = pow_ii(&c__2, tlvls) + 1; ++ ptr = pow_ii(c__2, *tlvls) + 1; + i__1 = *curlvl - 1; + for (k = 1; k <= i__1; ++k) { + i__2 = *curlvl - k; + i__3 = *curlvl - k - 1; +- curr = ptr + *curpbm * pow_ii(&c__2, &i__2) + pow_ii(&c__2, &i__3) - ++ curr = ptr + *curpbm * pow_ii(c__2, i__2) + pow_ii(c__2, i__3) - + 1; + psiz1 = prmptr[curr + 1] - prmptr[curr]; + psiz2 = prmptr[curr + 2] - prmptr[curr + 1]; +@@ -847,7 +847,7 @@ f"> */ + c__1); + + i__2 = *tlvls - k; +- ptr += pow_ii(&c__2, &i__2); ++ ptr += pow_ii(c__2, i__2); + /* L70: */ + } + +diff --git a/lapack-netlib/SRC/dlalsa.c b/lapack-netlib/SRC/dlalsa.c +index 891ed66a..4d5c347c 100644 +--- a/lapack-netlib/SRC/dlalsa.c ++++ b/lapack-netlib/SRC/dlalsa.c +@@ -951,7 +951,7 @@ f"> */ + /* Finally go through the left singular vector matrices of all */ + /* the other subproblems bottom-up on the tree. */ + +- j = pow_ii(&c__2, &nlvl); ++ j = pow_ii(c__2, nlvl); + sqre = 0; + + for (lvl = nlvl; lvl >= 1; --lvl) { +@@ -965,7 +965,7 @@ f"> */ + ll = 1; + } else { + i__1 = lvl - 1; +- lf = pow_ii(&c__2, &i__1); ++ lf = pow_ii(c__2, i__1); + ll = (lf << 1) - 1; + } + i__1 = ll; +@@ -1010,7 +1010,7 @@ L50: + ll = 1; + } else { + i__2 = lvl - 1; +- lf = pow_ii(&c__2, &i__2); ++ lf = pow_ii(c__2, i__2); + ll = (lf << 1) - 1; + } + i__2 = lf; +diff --git a/lapack-netlib/SRC/dlasd0.c b/lapack-netlib/SRC/dlasd0.c +index c702665b..0f88527e 100644 +--- a/lapack-netlib/SRC/dlasd0.c ++++ b/lapack-netlib/SRC/dlasd0.c +@@ -824,7 +824,7 @@ f"> */ + ll = 1; + } else { + i__1 = lvl - 1; +- lf = pow_ii(&c__2, &i__1); ++ lf = pow_ii(c__2, i__1); + ll = (lf << 1) - 1; + } + i__1 = ll; +diff --git a/lapack-netlib/SRC/dlasda.c b/lapack-netlib/SRC/dlasda.c +index 72f9d55f..a9190f80 100644 +--- a/lapack-netlib/SRC/dlasda.c ++++ b/lapack-netlib/SRC/dlasda.c +@@ -1027,7 +1027,7 @@ f"> */ + + /* Now conquer each subproblem bottom-up. */ + +- j = pow_ii(&c__2, &nlvl); ++ j = pow_ii(c__2, nlvl); + for (lvl = nlvl; lvl >= 1; --lvl) { + lvl2 = (lvl << 1) - 1; + +@@ -1039,7 +1039,7 @@ f"> */ + ll = 1; + } else { + i__1 = lvl - 1; +- lf = pow_ii(&c__2, &i__1); ++ lf = pow_ii(c__2, i__1); + ll = (lf << 1) - 1; + } + i__1 = ll; +diff --git a/lapack-netlib/SRC/dstedc.c b/lapack-netlib/SRC/dstedc.c +index ef2eeabe..56511d6c 100644 +--- a/lapack-netlib/SRC/dstedc.c ++++ b/lapack-netlib/SRC/dstedc.c +@@ -806,10 +806,10 @@ f"> */ + lwmin = *n - 1 << 1; + } else { + lgn = (integer) (log((doublereal) (*n)) / log(2.)); +- if (pow_ii(&c__2, &lgn) < *n) { ++ if (pow_ii(c__2, lgn) < *n) { + ++lgn; + } +- if (pow_ii(&c__2, &lgn) < *n) { ++ if (pow_ii(c__2, lgn) < *n) { + ++lgn; + } + if (icompz == 1) { +diff --git a/lapack-netlib/SRC/slaed0.c b/lapack-netlib/SRC/slaed0.c +index 33f7134c..4c523090 100644 +--- a/lapack-netlib/SRC/slaed0.c ++++ b/lapack-netlib/SRC/slaed0.c +@@ -823,10 +823,10 @@ L10: + + temp = log((real) (*n)) / log(2.f); + lgn = (integer) temp; +- if (pow_ii(&c__2, &lgn) < *n) { ++ if (pow_ii(c__2, lgn) < *n) { + ++lgn; + } +- if (pow_ii(&c__2, &lgn) < *n) { ++ if (pow_ii(c__2, lgn) < *n) { + ++lgn; + } + iprmpt = indxq + *n + 1; +diff --git a/lapack-netlib/SRC/slaed7.c b/lapack-netlib/SRC/slaed7.c +index 210d796d..22fcaf76 100644 +--- a/lapack-netlib/SRC/slaed7.c ++++ b/lapack-netlib/SRC/slaed7.c +@@ -883,11 +883,11 @@ f"> */ + /* Form the z-vector which consists of the last row of Q_1 and the */ + /* first row of Q_2. */ + +- ptr = pow_ii(&c__2, tlvls) + 1; ++ ptr = pow_ii(c__2, *tlvls) + 1; + i__1 = *curlvl - 1; + for (i__ = 1; i__ <= i__1; ++i__) { + i__2 = *tlvls - i__; +- ptr += pow_ii(&c__2, &i__2); ++ ptr += pow_ii(c__2, i__2); + /* L10: */ + } + curr = ptr + *curpbm; +diff --git a/lapack-netlib/SRC/slaeda.c b/lapack-netlib/SRC/slaeda.c +index 7edaf8a7..3806427c 100644 +--- a/lapack-netlib/SRC/slaeda.c ++++ b/lapack-netlib/SRC/slaeda.c +@@ -753,7 +753,7 @@ f"> */ + /* scheme */ + + i__1 = *curlvl - 1; +- curr = ptr + *curpbm * pow_ii(&c__2, curlvl) + pow_ii(&c__2, &i__1) - 1; ++ curr = ptr + *curpbm * pow_ii(c__2, *curlvl) + pow_ii(c__2, i__1) - 1; + + /* Determine size of these matrices. We add HALF to the value of */ + /* the SQRT in case the machine underestimates one of these square */ +@@ -779,12 +779,12 @@ f"> */ + /* rotations and permutation and then multiplying the center matrices */ + /* against the current Z. */ + +- ptr = pow_ii(&c__2, tlvls) + 1; ++ ptr = pow_ii(c__2, *tlvls) + 1; + i__1 = *curlvl - 1; + for (k = 1; k <= i__1; ++k) { + i__2 = *curlvl - k; + i__3 = *curlvl - k - 1; +- curr = ptr + *curpbm * pow_ii(&c__2, &i__2) + pow_ii(&c__2, &i__3) - ++ curr = ptr + *curpbm * pow_ii(c__2, i__2) + pow_ii(c__2, i__3) - + 1; + psiz1 = prmptr[curr + 1] - prmptr[curr]; + psiz2 = prmptr[curr + 2] - prmptr[curr + 1]; +@@ -844,7 +844,7 @@ f"> */ + c__1); + + i__2 = *tlvls - k; +- ptr += pow_ii(&c__2, &i__2); ++ ptr += pow_ii(c__2, i__2); + /* L70: */ + } + +diff --git a/lapack-netlib/SRC/slalsa.c b/lapack-netlib/SRC/slalsa.c +index 53da2c7b..77a79b80 100644 +--- a/lapack-netlib/SRC/slalsa.c ++++ b/lapack-netlib/SRC/slalsa.c +@@ -946,7 +946,7 @@ f"> */ + /* Finally go through the left singular vector matrices of all */ + /* the other subproblems bottom-up on the tree. */ + +- j = pow_ii(&c__2, &nlvl); ++ j = pow_ii(c__2, nlvl); + sqre = 0; + + for (lvl = nlvl; lvl >= 1; --lvl) { +@@ -960,7 +960,7 @@ f"> */ + ll = 1; + } else { + i__1 = lvl - 1; +- lf = pow_ii(&c__2, &i__1); ++ lf = pow_ii(c__2, i__1); + ll = (lf << 1) - 1; + } + i__1 = ll; +@@ -1005,7 +1005,7 @@ L50: + ll = 1; + } else { + i__2 = lvl - 1; +- lf = pow_ii(&c__2, &i__2); ++ lf = pow_ii(c__2, i__2); + ll = (lf << 1) - 1; + } + i__2 = lf; +diff --git a/lapack-netlib/SRC/slasd0.c b/lapack-netlib/SRC/slasd0.c +index aa553579..be1a7419 100644 +--- a/lapack-netlib/SRC/slasd0.c ++++ b/lapack-netlib/SRC/slasd0.c +@@ -821,7 +821,7 @@ f"> */ + ll = 1; + } else { + i__1 = lvl - 1; +- lf = pow_ii(&c__2, &i__1); ++ lf = pow_ii(c__2, i__1); + ll = (lf << 1) - 1; + } + i__1 = ll; +diff --git a/lapack-netlib/SRC/slasda.c b/lapack-netlib/SRC/slasda.c +index 71424c3f..1d336d1c 100644 +--- a/lapack-netlib/SRC/slasda.c ++++ b/lapack-netlib/SRC/slasda.c +@@ -1023,7 +1023,7 @@ f"> */ + + /* Now conquer each subproblem bottom-up. */ + +- j = pow_ii(&c__2, &nlvl); ++ j = pow_ii(c__2, nlvl); + for (lvl = nlvl; lvl >= 1; --lvl) { + lvl2 = (lvl << 1) - 1; + +@@ -1035,7 +1035,7 @@ f"> */ + ll = 1; + } else { + i__1 = lvl - 1; +- lf = pow_ii(&c__2, &i__1); ++ lf = pow_ii(c__2, i__1); + ll = (lf << 1) - 1; + } + i__1 = ll; +diff --git a/lapack-netlib/SRC/sstedc.c b/lapack-netlib/SRC/sstedc.c +index 46ed15a1..61ad3dd3 100644 +--- a/lapack-netlib/SRC/sstedc.c ++++ b/lapack-netlib/SRC/sstedc.c +@@ -804,10 +804,10 @@ f"> */ + lwmin = *n - 1 << 1; + } else { + lgn = (integer) (log((real) (*n)) / log(2.f)); +- if (pow_ii(&c__2, &lgn) < *n) { ++ if (pow_ii(c__2, lgn) < *n) { + ++lgn; + } +- if (pow_ii(&c__2, &lgn) < *n) { ++ if (pow_ii(c__2, lgn) < *n) { + ++lgn; + } + if (icompz == 1) { +diff --git a/lapack-netlib/SRC/zlaed0.c b/lapack-netlib/SRC/zlaed0.c +index 37bd12b0..2b25f6e4 100644 +--- a/lapack-netlib/SRC/zlaed0.c ++++ b/lapack-netlib/SRC/zlaed0.c +@@ -793,10 +793,10 @@ L10: + + temp = log((doublereal) (*n)) / log(2.); + lgn = (integer) temp; +- if (pow_ii(&c__2, &lgn) < *n) { ++ if (pow_ii(c__2, lgn) < *n) { + ++lgn; + } +- if (pow_ii(&c__2, &lgn) < *n) { ++ if (pow_ii(c__2, lgn) < *n) { + ++lgn; + } + iprmpt = indxq + *n + 1; +diff --git a/lapack-netlib/SRC/zlaed7.c b/lapack-netlib/SRC/zlaed7.c +index 09305191..8665ee12 100644 +--- a/lapack-netlib/SRC/zlaed7.c ++++ b/lapack-netlib/SRC/zlaed7.c +@@ -864,11 +864,11 @@ f"> */ + /* Form the z-vector which consists of the last row of Q_1 and the */ + /* first row of Q_2. */ + +- ptr = pow_ii(&c__2, tlvls) + 1; ++ ptr = pow_ii(c__2, *tlvls) + 1; + i__1 = *curlvl - 1; + for (i__ = 1; i__ <= i__1; ++i__) { + i__2 = *tlvls - i__; +- ptr += pow_ii(&c__2, &i__2); ++ ptr += pow_ii(c__2, i__2); + /* L10: */ + } + curr = ptr + *curpbm; +diff --git a/lapack-netlib/SRC/zlalsa.c b/lapack-netlib/SRC/zlalsa.c +index d17016e7..cd0819c3 100644 +--- a/lapack-netlib/SRC/zlalsa.c ++++ b/lapack-netlib/SRC/zlalsa.c +@@ -1051,7 +1051,7 @@ f"> */ + /* Finally go through the left singular vector matrices of all */ + /* the other subproblems bottom-up on the tree. */ + +- j = pow_ii(&c__2, &nlvl); ++ j = pow_ii(c__2, nlvl); + sqre = 0; + + for (lvl = nlvl; lvl >= 1; --lvl) { +@@ -1065,7 +1065,7 @@ f"> */ + ll = 1; + } else { + i__1 = lvl - 1; +- lf = pow_ii(&c__2, &i__1); ++ lf = pow_ii(c__2, i__1); + ll = (lf << 1) - 1; + } + i__1 = ll; +@@ -1110,7 +1110,7 @@ L170: + ll = 1; + } else { + i__2 = lvl - 1; +- lf = pow_ii(&c__2, &i__2); ++ lf = pow_ii(c__2, i__2); + ll = (lf << 1) - 1; + } + i__2 = lf; +diff --git a/lapack-netlib/SRC/zstedc.c b/lapack-netlib/SRC/zstedc.c +index 4cfc4184..55baba2d 100644 +--- a/lapack-netlib/SRC/zstedc.c ++++ b/lapack-netlib/SRC/zstedc.c +@@ -836,10 +836,10 @@ f"> */ + lrwmin = *n - 1 << 1; + } else if (icompz == 1) { + lgn = (integer) (log((doublereal) (*n)) / log(2.)); +- if (pow_ii(&c__2, &lgn) < *n) { ++ if (pow_ii(c__2, lgn) < *n) { + ++lgn; + } +- if (pow_ii(&c__2, &lgn) < *n) { ++ if (pow_ii(c__2, lgn) < *n) { + ++lgn; + } + lwmin = *n * *n; +-- +2.37.3 + diff --git a/openblas-0.3.21-c99-3.patch b/openblas-0.3.21-c99-3.patch new file mode 100644 index 0000000000000000000000000000000000000000..7e29ffcf26d7cb97abcc9f6b64076b3de9998d64 --- /dev/null +++ b/openblas-0.3.21-c99-3.patch @@ -0,0 +1,26 @@ +From 91110f92d218492d0efbdc1fdf34277ca45f4b36 Mon Sep 17 00:00:00 2001 +From: Martin Kroeker +Date: Wed, 14 Sep 2022 14:03:31 +0200 +Subject: [PATCH] fix missing return type in function declaration +Content-type: text/plain + +--- + ctest/c_sblat1c.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ctest/c_sblat1c.c b/ctest/c_sblat1c.c +index 4993d31b..57e4707a 100644 +--- a/ctest/c_sblat1c.c ++++ b/ctest/c_sblat1c.c +@@ -969,7 +969,7 @@ real *sfac; + 1.17 }; + + /* Local variables */ +- extern /* Subroutine */ srottest_(); ++ extern /* Subroutine */ void srottest_(); + static integer i__, k, ksize; + extern /* Subroutine */ int stest_(), srotmtest_(); + static integer ki, kn; +-- +2.37.3 + diff --git a/openblas-0.3.21-c99-4.patch b/openblas-0.3.21-c99-4.patch new file mode 100644 index 0000000000000000000000000000000000000000..1f04db0583fe128dab22c36b3b292d7c8f6f9e64 --- /dev/null +++ b/openblas-0.3.21-c99-4.patch @@ -0,0 +1,26 @@ +From 9402df5604e69f86f58953e3883f33f98c930baf Mon Sep 17 00:00:00 2001 +From: Martin Kroeker +Date: Wed, 14 Sep 2022 21:44:34 +0200 +Subject: [PATCH] Fix missing external declaration +Content-type: text/plain + +--- + driver/others/blas_server_omp.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/driver/others/blas_server_omp.c b/driver/others/blas_server_omp.c +index 1a5fd06a..c158f92e 100644 +--- a/driver/others/blas_server_omp.c ++++ b/driver/others/blas_server_omp.c +@@ -69,6 +69,8 @@ + + int blas_server_avail = 0; + ++extern int openblas_omp_adaptive_env(); ++ + static void * blas_thread_buffer[MAX_PARALLEL_NUMBER][MAX_CPU_NUMBER]; + #ifdef HAVE_C11 + static atomic_bool blas_buffer_inuse[MAX_PARALLEL_NUMBER]; +-- +2.37.3 + diff --git a/openblas-0.3.21-c99-5.patch b/openblas-0.3.21-c99-5.patch new file mode 100644 index 0000000000000000000000000000000000000000..12a11124c126b41c6821f0c798f96fe447130a04 --- /dev/null +++ b/openblas-0.3.21-c99-5.patch @@ -0,0 +1,62 @@ +From 101a2c77c3f3610933f450cefca3e312edab2186 Mon Sep 17 00:00:00 2001 +From: Martin Kroeker +Date: Thu, 15 Sep 2022 09:19:19 +0200 +Subject: [PATCH] Fix warnings +Content-type: text/plain + +--- + kernel/x86_64/dgemm_ncopy_8_skylakex.c | 24 ++++++++++++------------ + kernel/x86_64/omatcopy_rt.c | 2 +- + 2 files changed, 13 insertions(+), 13 deletions(-) + +diff --git a/kernel/x86_64/dgemm_ncopy_8_skylakex.c b/kernel/x86_64/dgemm_ncopy_8_skylakex.c +index 74b336f3..874ef68d 100644 +--- a/kernel/x86_64/dgemm_ncopy_8_skylakex.c ++++ b/kernel/x86_64/dgemm_ncopy_8_skylakex.c +@@ -52,18 +52,18 @@ int CNAME(BLASLONG m, BLASLONG n, FLOAT * __restrict a, BLASLONG lda, FLOAT * __ + FLOAT ctemp05, ctemp06, ctemp07, ctemp08; + FLOAT ctemp09, ctemp10, ctemp11, ctemp12; + FLOAT ctemp13, ctemp14, ctemp15, ctemp16; +- FLOAT ctemp17, ctemp18, ctemp19, ctemp20; +- FLOAT ctemp21, ctemp22, ctemp23, ctemp24; +- FLOAT ctemp25, ctemp26, ctemp27, ctemp28; +- FLOAT ctemp29, ctemp30, ctemp31, ctemp32; +- FLOAT ctemp33, ctemp34, ctemp35, ctemp36; +- FLOAT ctemp37, ctemp38, ctemp39, ctemp40; +- FLOAT ctemp41, ctemp42, ctemp43, ctemp44; +- FLOAT ctemp45, ctemp46, ctemp47, ctemp48; +- FLOAT ctemp49, ctemp50, ctemp51, ctemp52; +- FLOAT ctemp53, ctemp54, ctemp55, ctemp56; +- FLOAT ctemp57, ctemp58, ctemp59, ctemp60; +- FLOAT ctemp61, ctemp62, ctemp63, ctemp64; ++ FLOAT ctemp17 /*, ctemp18, ctemp19, ctemp20*/ ; ++ FLOAT /*ctemp21, ctemp22,*/ ctemp23, ctemp24; ++ FLOAT ctemp25 /*, ctemp26, ctemp27, ctemp28*/ ; ++ FLOAT /*ctemp29, ctemp30,*/ ctemp31, ctemp32; ++ FLOAT ctemp33 /*, ctemp34, ctemp35, ctemp36*/ ; ++ FLOAT /*ctemp37, ctemp38,*/ ctemp39, ctemp40; ++ FLOAT ctemp41 /*, ctemp42, ctemp43, ctemp44*/ ; ++ FLOAT /*ctemp45, ctemp46,*/ ctemp47, ctemp48; ++ FLOAT ctemp49 /*, ctemp50, ctemp51, ctemp52*/ ; ++ FLOAT /*ctemp53, ctemp54,*/ ctemp55, ctemp56; ++ FLOAT ctemp57 /*, ctemp58, ctemp59, ctemp60*/ ; ++ FLOAT /*ctemp61, ctemp62,*/ ctemp63, ctemp64; + + + aoffset = a; +diff --git a/kernel/x86_64/omatcopy_rt.c b/kernel/x86_64/omatcopy_rt.c +index e695f00c..b11893f5 100644 +--- a/kernel/x86_64/omatcopy_rt.c ++++ b/kernel/x86_64/omatcopy_rt.c +@@ -142,7 +142,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ,"xmm0","xmm1","xmm2","xmm3","xmm4","xmm5","xmm6","xmm7","xmm8","xmm9","xmm10","xmm11","xmm12","xmm13","xmm14","xmm15");\ + } + int CNAME(BLASLONG rows, BLASLONG cols, FLOAT alpha, FLOAT *a, BLASLONG lda, FLOAT *b, BLASLONG ldb){ +- float *src, *dst, *dst_tmp, *src_base, *dst_base; ++ float *src, *dst, *dst_tmp=0, *src_base, *dst_base; + uint64_t src_ld_bytes = (uint64_t)lda * sizeof(float), dst_ld_bytes = (uint64_t)ldb * sizeof(float), num_rows = 0; + BLASLONG cols_left, rows_done; float ALPHA = alpha; + if(ALPHA==0.0){ +-- +2.37.3 + diff --git a/openblas-0.3.21-sbgemm-test.patch b/openblas-0.3.21-sbgemm-test.patch new file mode 100644 index 0000000000000000000000000000000000000000..3a21470d0d20a93b9e2c718b53d75aeb01135baa --- /dev/null +++ b/openblas-0.3.21-sbgemm-test.patch @@ -0,0 +1,55 @@ +Fixing FTBFS on power: +https://bugzilla.redhat.com/show_bug.cgi?id=2120974 + +Upstream issue: https://github.com/xianyi/OpenBLAS/issues/3738 +Upstream fix: https://github.com/xianyi/OpenBLAS/pull/3718 + +commit d9dc015cfc78fc32f555995a89d6957ef0184ea2 +Author: Martin Kroeker +Date: Mon Aug 8 14:52:10 2022 +0200 + + Use blasint for INTERFACE64 compatibility + +diff --git a/test/compare_sgemm_sbgemm.c b/test/compare_sgemm_sbgemm.c +index a2c358cf..d4b59145 100644 +--- a/test/compare_sgemm_sbgemm.c ++++ b/test/compare_sgemm_sbgemm.c +@@ -76,9 +76,9 @@ float16to32 (bfloat16_bits f16) + int + main (int argc, char *argv[]) + { +- int m, n, k; ++ blasint m, n, k; + int i, j, l; +- int x; ++ blasint x; + int ret = 0; + int loop = 100; + char transA = 'N', transB = 'N'; + +commit 3d338b57de1837f1e2264a1262a9ee9203f31c6c +Author: Martin Kroeker +Date: Mon Aug 8 17:09:45 2022 +0200 + + remove spurious loops + +diff --git a/test/compare_sgemm_sbgemm.c b/test/compare_sgemm_sbgemm.c +index d4b59145..276fecae 100644 +--- a/test/compare_sgemm_sbgemm.c ++++ b/test/compare_sgemm_sbgemm.c +@@ -112,7 +112,6 @@ main (int argc, char *argv[]) + &m, BB, &k, &beta, CC, &m); + for (i = 0; i < n; i++) + for (j = 0; j < m; j++) +- for (l = 0; l < k; l++) + if (fabs (CC[i * m + j] - C[i * m + j]) > 1.0) + ret++; + if (transA == 'N' && transB == 'N') +@@ -126,7 +125,6 @@ main (int argc, char *argv[]) + } + for (i = 0; i < n; i++) + for (j = 0; j < m; j++) +- for (l = 0; l < k; l++) + if (CC[i * m + j] != DD[i * m + j]) + ret++; + } diff --git a/openblas-0.3.21.tar.gz b/openblas-0.3.21.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..63ac0be7af28dedae739e679b0e3a7bcbed3465a Binary files /dev/null and b/openblas-0.3.21.tar.gz differ diff --git a/openblas.spec b/openblas.spec new file mode 100644 index 0000000000000000000000000000000000000000..299c1d9da70ff2480f6ee80239862cfb17b963b5 --- /dev/null +++ b/openblas.spec @@ -0,0 +1,576 @@ +%define anolis_release 1 +%bcond_with system_lapack +# Version of bundled lapack +%global lapackver 3.9.1 + +# DO NOT "CLEAN UP" OR MODIFY THIS SPEC FILE WITHOUT ASKING THE +# MAINTAINER FIRST! +# +# OpenBLAS is hand written assembler code and it has a limited number +# of supported architectures. Don't enable any new architectures / +# processors a) without checking that it is actually supported and b) +# without modifying the target flags. +# +# The same spec is also used on the EPEL branches, meaninng that some +# "obsoleted" features are still kept in the spec. + +Name: openblas +Version: 0.3.21 +Release: %{anolis_release}%{?dist} +Summary: An optimized BLAS library based on GotoBLAS2 +License: BSD +URL: https://github.com/xianyi/OpenBLAS/ +Source0: https://github.com/xianyi/OpenBLAS/archive/v%{version}/openblas-%{version}.tar.gz +# Use system lapack +Patch0: openblas-0.2.15-system_lapack.patch +# Drop extra p from threaded library name +Patch1: openblas-0.2.5-libname.patch +# Fix SBGEMM test to work with INTERFACE64 +Patch3: openblas-0.3.21-sbgemm-test.patch +# Supply the proper flags to the test makefile +Patch4: openblas-0.3.11-tests.patch +# C99 porting. +Patch5: openblas-0.3.21-c99-1.patch +Patch6: openblas-0.3.21-c99-2.patch +Patch7: openblas-0.3.21-c99-3.patch +Patch8: openblas-0.3.21-c99-4.patch +Patch9: openblas-0.3.21-c99-5.patch + +BuildRequires: make +BuildRequires: gcc +BuildRequires: gcc-c++ +BuildRequires: gcc-gfortran +BuildRequires: perl-devel + +Obsoletes: %{name}-Rblas < %{version}-%{release} + +%global execstack 1 +%if %{execstack} +BuildRequires: /usr/bin/execstack +%endif + +# LAPACK +%if %{with system_lapack} +BuildRequires: lapack-static +# Do we have LAPACKE? (Needs at least lapack 3.4.0) +%global lapacke 1 + +%else +# Use bundled LAPACK +%global lapacke 1 +Provides: bundled(lapack) = %{lapackver} +%endif + +# Build 64-bit interface binaries +%global build64 1 +%bcond_without cpp_thread_check + +%if %{with system_lapack} +%if %build64 +BuildRequires: lapack64-static +%endif +%endif + +%global base_description \ +OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD \ +version. The project is supported by the Lab of Parallel Software and \ +Computational Science, ISCAS. http://www.rdcps.ac.cn + + +%description +%{base_description} + +%package serial +Summary: An optimized BLAS library based on GotoBLAS2, serial version +Requires: %{name} = %{version}-%{release} + +%description serial +%{base_description} + +This package contains the sequential library compiled with a 32-bit +integer interface. + +%package openmp +Summary: An optimized BLAS library based on GotoBLAS2, OpenMP version +Requires: %{name} = %{version}-%{release} + +%description openmp +%{base_description} + +This package contains the library compiled with OpenMP support with +32-bit integer interface. + +%package threads +Summary: An optimized BLAS library based on GotoBLAS2, pthreads version +Requires: %{name} = %{version}-%{release} + +%description threads +%{base_description} + +This package contains the library compiled with threading support and +a 32-bit integer interface. + +%if %build64 +%package serial64 +Summary: An optimized BLAS library based on GotoBLAS2, serial version +Requires: %{name} = %{version}-%{release} + +%description serial64 +%{base_description} + +This package contains the sequential library compiled with a 64-bit +integer interface. + +%package openmp64 +Summary: An optimized BLAS library based on GotoBLAS2, OpenMP version +Requires: %{name} = %{version}-%{release} + +%description openmp64 +%{base_description} + +This package contains the library compiled with OpenMP support and +64-bit integer interface. + +%package threads64 +Summary: An optimized BLAS library based on GotoBLAS2, pthreads version +Requires: %{name} = %{version}-%{release} + +%description threads64 +%{base_description} + +This package contains the library compiled with threading support and +64-bit integer interface. + +%package serial64_ +Summary: An optimized BLAS library based on GotoBLAS2, serial version +Requires: %{name} = %{version}-%{release} + +%description serial64_ +%{base_description} + +This package contains the sequential library compiled with a 64-bit +integer interface and a symbol name suffix. + +%package openmp64_ +Summary: An optimized BLAS library based on GotoBLAS2, OpenMP version +Requires: %{name} = %{version}-%{release} + +%description openmp64_ +%{base_description} + +This package contains the library compiled with OpenMP support and +64-bit integer interface and a symbol name suffix. + +%package threads64_ +Summary: An optimized BLAS library based on GotoBLAS2, pthreads version +Requires: %{name} = %{version}-%{release} + +%description threads64_ +%{base_description} + +This package contains the library compiled with threading support and +64-bit integer interface and a symbol name suffix. +%endif + + +%package devel +Summary: Development headers and libraries for OpenBLAS +Requires: %{name} = %{version}-%{release} +Requires: %{name}-serial = %{version}-%{release} +Requires: %{name}-openmp = %{version}-%{release} +Requires: %{name}-threads = %{version}-%{release} +%if %build64 +Requires: %{name}-openmp64 = %{version}-%{release} +Requires: %{name}-threads64 = %{version}-%{release} +Requires: %{name}-serial64 = %{version}-%{release} +Requires: %{name}-openmp64_ = %{version}-%{release} +Requires: %{name}-threads64_ = %{version}-%{release} +Requires: %{name}-serial64_ = %{version}-%{release} +%endif +Requires: %{name}-srpm-macros + +%description devel +%{base_description} + +This package contains the development headers and libraries. + +%package static +Summary: Static version of OpenBLAS +Requires: %{name}-devel = %{version}-%{release} + +%description static +%{base_description} + +This package contains the static libraries. + + +%prep +%setup -q -c -T + +# Untar source +tar zxf %{SOURCE0} +cd OpenBLAS-%{version} +%if %{with system_lapack} +%patch0 -p1 -b .system_lapack +%endif +%patch1 -p1 -b .libname +%patch3 -p1 -b .sbgemm +%patch4 -p1 -b .tests +%patch5 -p1 -b .c99-1 +%patch6 -p1 -b .c99-2 +%patch7 -p1 -b .c99-3 +%patch8 -p1 -b .c99-4 +%patch9 -p1 -b .c99-5 + +# Fix source permissions +find -name \*.f -exec chmod 644 {} \; + +%if %{with system_lapack} +# Get rid of bundled LAPACK sources +rm -rf lapack-netlib +%endif + +# Make serial, threaded and OpenMP versions; as well as 64-bit versions +cd .. +cp -ar OpenBLAS-%{version} openmp +cp -ar OpenBLAS-%{version} threaded +%if %build64 +for d in {serial,threaded,openmp}64{,_}; do + cp -ar OpenBLAS-%{version} $d +done +%endif +mv OpenBLAS-%{version} serial + +%if %{with system_lapack} +# Setup 32-bit interface LAPACK +mkdir netliblapack +cd netliblapack +ar x %{_libdir}/liblapack_pic.a +# Get rid of duplicate functions. See list in Makefile of lapack directory +for f in laswp getf2 getrf potf2 potrf lauu2 lauum trti2 trtri getrs; do + \rm {c,d,s,z}$f.o +done + +# LAPACKE +%if %{lapacke} +ar x %{_libdir}/liblapacke.a +%endif + +# Create makefile +echo "TOPDIR = .." > Makefile +echo "include ../Makefile.system" >> Makefile +echo "COMMONOBJS = \\" >> Makefile +for i in *.o; do + echo "$i \\" >> Makefile +done +echo -e "\n\ninclude \$(TOPDIR)/Makefile.tail" >> Makefile + +%if %{lapacke} +# Copy include files +cp -a %{_includedir}/lapacke . +%endif +cd .. + +# Copy in place +for d in serial threaded openmp; do + cp -pr netliblapack $d +done +rm -rf netliblapack + + +# Setup 64-bit interface LAPACK +%if %build64 +mkdir netliblapack64 +cd netliblapack64 +ar x %{_libdir}/liblapack64_pic.a +# Get rid of duplicate functions. See list in Makefile of lapack directory +for f in laswp getf2 getrf potf2 potrf lauu2 lauum trti2 trtri getrs; do + \rm {c,d,s,z}$f.o +done + +# LAPACKE, no 64-bit interface +%if %{lapacke} +ar x %{_libdir}/liblapacke.a +%endif + +# Create makefile +echo "TOPDIR = .." > Makefile +echo "include ../Makefile.system" >> Makefile +echo "COMMONOBJS = \\" >> Makefile +for i in *.o; do + echo "$i \\" >> Makefile +done +echo -e "\n\ninclude \$(TOPDIR)/Makefile.tail" >> Makefile + +%if %{lapacke} +# Copy include files +cp -a %{_includedir}/lapacke . +%endif +cd .. + +# Copy in place +for d in {serial,threaded,openmp}64{,_}; do + cp -pr netliblapack64 $d/netliblapack +done +rm -rf netliblapack64 +%endif +%endif + +%build +# openblas fails to build with LTO due to undefined symbols. These could +# well be the result of the assembly code used in this package +%define _lto_cflags %{nil} +%if !%{lapacke} +LAPACKE="NO_LAPACKE=1" +%endif + +# Maximum possible amount of processors +NMAX="NUM_THREADS=128" + +# Compability for old versions of GCC +%ifarch x86_64 +TARGET="TARGET=CORE2 DYNAMIC_ARCH=1 DYNAMIC_OLDER=1" +%endif +%ifarch aarch64 +TARGET="TARGET=ARMV8 DYNAMIC_ARCH=1 DYNAMIC_OLDER=1" +%endif + +COMMON="%{optflags} -fPIC" +FCOMMON="%{optflags} -fPIC -frecursive" +# Use Fedora linker flags +export LDFLAGS="%{__global_ldflags}" + +# Declare some necessary build flags +COMMON="%{optflags} -fPIC" +FCOMMON="$COMMON -frecursive" +make -C serial $TARGET USE_THREAD=0 USE_LOCKING=1 USE_OPENMP=0 FC=gfortran CC=gcc COMMON_OPT="$COMMON" FCOMMON_OPT="$FCOMMON" $NMAX LIBPREFIX="libopenblas" $AVX $LAPACKE INTERFACE64=0 +make -C threaded $TARGET USE_THREAD=1 USE_OPENMP=0 FC=gfortran CC=gcc COMMON_OPT="$COMMON" FCOMMON_OPT="$FCOMMON" $NMAX LIBPREFIX="libopenblasp" $AVX $LAPACKE INTERFACE64=0 + +# USE_THREAD determines use of SMP, not of pthreads +COMMON="%{optflags} -fPIC -fopenmp -pthread" +FCOMMON="$COMMON -frecursive" +make -C openmp $TARGET USE_THREAD=1 USE_OPENMP=1 FC=gfortran CC=gcc COMMON_OPT="$COMMON" FCOMMON_OPT="$FCOMMON" $NMAX LIBPREFIX="libopenblaso" $AVX $LAPACKE INTERFACE64=0 %{with cpp_thread_check:CPP_THREAD_SAFETY_TEST=1} + +%if %build64 +COMMON="%{optflags} -fPIC" +FCOMMON="$COMMON -frecursive -fdefault-integer-8" +make -C serial64 $TARGET USE_THREAD=0 USE_LOCKING=1 USE_OPENMP=0 FC=gfortran CC=gcc COMMON_OPT="$COMMON" FCOMMON_OPT="$FCOMMON" $NMAX LIBPREFIX="libopenblas64" $AVX $LAPACKE INTERFACE64=1 +make -C threaded64 $TARGET USE_THREAD=1 USE_OPENMP=0 FC=gfortran CC=gcc COMMON_OPT="$COMMON" FCOMMON_OPT="$FCOMMON" $NMAX LIBPREFIX="libopenblasp64" $AVX $LAPACKE INTERFACE64=1 + +COMMON="%{optflags} -fPIC -fopenmp -pthread" +FCOMMON="$COMMON -frecursive -fdefault-integer-8" +make -C openmp64 $TARGET USE_THREAD=1 USE_OPENMP=1 FC=gfortran CC=gcc COMMON_OPT="$COMMON" FCOMMON_OPT="$FCOMMON" $NMAX LIBPREFIX="libopenblaso64" $AVX $LAPACKE INTERFACE64=1 CPP_THREAD_SAFETY_TEST=1 + +COMMON="%{optflags} -fPIC" +FCOMMON="$COMMON -frecursive -fdefault-integer-8" +make -C serial64_ $TARGET USE_THREAD=0 USE_LOCKING=1 USE_OPENMP=0 FC=gfortran CC=gcc COMMON_OPT="$COMMON" FCOMMON_OPT="$FCOMMON" $NMAX LIBPREFIX="libopenblas64_" $AVX $LAPACKE INTERFACE64=1 SYMBOLSUFFIX=64_ +make -C threaded64_ $TARGET USE_THREAD=1 USE_OPENMP=0 FC=gfortran CC=gcc COMMON_OPT="$COMMON" FCOMMON_OPT="$FCOMMON" $NMAX LIBPREFIX="libopenblasp64_" $AVX $LAPACKE INTERFACE64=1 SYMBOLSUFFIX=64_ + +COMMON="%{optflags} -fPIC -fopenmp -pthread" +FCOMMON="$COMMON -frecursive -fdefault-integer-8" +make -C openmp64_ $TARGET USE_THREAD=1 USE_OPENMP=1 FC=gfortran CC=gcc COMMON_OPT="$COMMON" FCOMMON_OPT="$FCOMMON" $NMAX LIBPREFIX="libopenblaso64_" $AVX $LAPACKE INTERFACE64=1 SYMBOLSUFFIX=64_ CPP_THREAD_SAFETY_TEST=1 +%endif + +%install +# Install serial library and headers +make -C serial USE_THREAD=0 PREFIX=%{buildroot} OPENBLAS_LIBRARY_DIR=%{buildroot}%{_libdir} OPENBLAS_INCLUDE_DIR=%{buildroot}%{_includedir}/%name OPENBLAS_BINARY_DIR=%{buildroot}%{_bindir} OPENBLAS_CMAKE_DIR=%{buildroot}%{_libdir}/cmake install + +# Copy lapacke include files +%if %{with system_lapack} && %{lapacke} +cp -a %{_includedir}/lapacke %{buildroot}%{_includedir}/%{name} +%endif + +# Fix name of libraries: runtime CPU detection has none +suffix="" +# but archs that don't have it do have one +slibname=`basename %{buildroot}%{_libdir}/libopenblas${suffix}-*.so .so` +mv %{buildroot}%{_libdir}/${slibname}.a %{buildroot}%{_libdir}/lib%{name}.a +if [[ "$suffix" != "" ]]; then + sname=$(echo $slibname | sed "s|$suffix||g") + mv %{buildroot}%{_libdir}/${slibname}.so %{buildroot}%{_libdir}/${sname}.so +else + sname=${slibname} +fi + +# Install the OpenMP library +olibname=`echo ${slibname} | sed "s|lib%{name}|lib%{name}o|g"` +install -D -p -m 644 openmp/${olibname}.a %{buildroot}%{_libdir}/lib%{name}o.a +if [[ "$suffix" != "" ]]; then + oname=$(echo $olibname | sed "s|$suffix||g") +else + oname=${olibname} +fi +install -D -p -m 755 openmp/${olibname}.so %{buildroot}%{_libdir}/${oname}.so + +# Install the threaded library +plibname=`echo ${slibname} | sed "s|lib%{name}|lib%{name}p|g"` +install -D -p -m 644 threaded/${plibname}.a %{buildroot}%{_libdir}/lib%{name}p.a +if [[ "$suffix" != "" ]]; then + pname=$(echo $plibname | sed "s|$suffix||g") +else + pname=${plibname} +fi +install -D -p -m 755 threaded/${plibname}.so %{buildroot}%{_libdir}/${pname}.so + +# Install the 64-bit interface libraries +%if %build64 +slibname64=`echo ${slibname} | sed "s|lib%{name}|lib%{name}64|g"` +install -D -p -m 644 serial64/${slibname64}.a %{buildroot}%{_libdir}/lib%{name}64.a +slibname64_=`echo ${slibname} | sed "s|lib%{name}|lib%{name}64_|g"` +install -D -p -m 644 serial64_/${slibname64_}.a %{buildroot}%{_libdir}/lib%{name}64_.a + +if [[ "$suffix" != "" ]]; then + sname64=$(echo ${slibname64} | sed "s|$suffix||g") + sname64_=$(echo ${slibname64_} | sed "s|$suffix||g") +else + sname64=${slibname64} + sname64_=${slibname64_} +fi +install -D -p -m 755 serial64/${slibname64}.so %{buildroot}%{_libdir}/${sname64}.so +install -D -p -m 755 serial64_/${slibname64_}.so %{buildroot}%{_libdir}/${sname64_}.so + +olibname64=`echo ${slibname} | sed "s|lib%{name}|lib%{name}o64|g"` +install -D -p -m 644 openmp64/${olibname64}.a %{buildroot}%{_libdir}/lib%{name}o64.a +olibname64_=`echo ${slibname} | sed "s|lib%{name}|lib%{name}o64_|g"` +install -D -p -m 644 openmp64_/${olibname64_}.a %{buildroot}%{_libdir}/lib%{name}o64_.a + +if [[ "$suffix" != "" ]]; then + oname64=$(echo ${olibname64} | sed "s|$suffix||g") + oname64_=$(echo ${olibname64_} | sed "s|$suffix||g") +else + oname64=${olibname64} + oname64_=${olibname64_} +fi +install -D -p -m 755 openmp64/${olibname64}.so %{buildroot}%{_libdir}/${oname64}.so +install -D -p -m 755 openmp64_/${olibname64_}.so %{buildroot}%{_libdir}/${oname64_}.so + +plibname64=`echo ${slibname} | sed "s|lib%{name}|lib%{name}p64|g"` +install -D -p -m 644 threaded64/${plibname64}.a %{buildroot}%{_libdir}/lib%{name}p64.a +plibname64_=`echo ${slibname} | sed "s|lib%{name}|lib%{name}p64_|g"` +install -D -p -m 644 threaded64_/${plibname64_}.a %{buildroot}%{_libdir}/lib%{name}p64_.a + +if [[ "$suffix" != "" ]]; then + pname64=$(echo $plibname64 | sed "s|$suffix||g") + pname64_=$(echo $plibname64_ | sed "s|$suffix||g") +else + pname64=${plibname64} + pname64_=${plibname64_} +fi +install -D -p -m 755 threaded64/${plibname64}.so %{buildroot}%{_libdir}/${pname64}.so +install -D -p -m 755 threaded64_/${plibname64_}.so %{buildroot}%{_libdir}/${pname64_}.so +%endif + +# Fix symlinks +pushd %{buildroot}%{_libdir} +# Serial libraries +ln -sf ${sname}.so lib%{name}.so +ln -sf ${sname}.so lib%{name}.so.0 +# OpenMP libraries +ln -sf ${oname}.so lib%{name}o.so +ln -sf ${oname}.so lib%{name}o.so.0 +# Threaded libraries +ln -sf ${pname}.so lib%{name}p.so +ln -sf ${pname}.so lib%{name}p.so.0 + +%if %build64 +# Serial libraries +ln -sf ${sname64}.so lib%{name}64.so +ln -sf ${sname64}.so lib%{name}64.so.0 +ln -sf ${sname64_}.so lib%{name}64_.so +ln -sf ${sname64_}.so lib%{name}64_.so.0 +# OpenMP libraries +ln -sf ${oname64}.so lib%{name}o64.so +ln -sf ${oname64}.so lib%{name}o64.so.0 +ln -sf ${oname64_}.so lib%{name}o64_.so +ln -sf ${oname64_}.so lib%{name}o64_.so.0 +# Threaded libraries +ln -sf ${pname64}.so lib%{name}p64.so +ln -sf ${pname64}.so lib%{name}p64.so.0 +ln -sf ${pname64_}.so lib%{name}p64_.so +ln -sf ${pname64_}.so lib%{name}p64_.so.0 +%endif + +%if %{execstack} +# Get rid of executable stacks +for lib in %{buildroot}%{_libdir}/libopenblas*.so; do + execstack -c $lib +done +%endif + +# Get rid of generated CMake config +rm -rf %{buildroot}%{_libdir}/cmake +# Get rid of generated pkgconfig +rm -rf %{buildroot}%{_libdir}/pkgconfig + +%files +%license serial/LICENSE +%doc serial/Changelog.txt serial/GotoBLAS* + +%files serial +%{_libdir}/lib%{name}-*.so +%{_libdir}/lib%{name}.so.* + +%files openmp +%{_libdir}/lib%{name}o-*.so +%{_libdir}/lib%{name}o.so.* + +%files threads +%{_libdir}/lib%{name}p-*.so +%{_libdir}/lib%{name}p.so.* + +%if %build64 +%files serial64 +%{_libdir}/lib%{name}64-*.so +%{_libdir}/lib%{name}64.so.* + +%files openmp64 +%{_libdir}/lib%{name}o64-*.so +%{_libdir}/lib%{name}o64.so.* + +%files threads64 +%{_libdir}/lib%{name}p64-*.so +%{_libdir}/lib%{name}p64.so.* + +%files serial64_ +%{_libdir}/lib%{name}64_-*.so +%{_libdir}/lib%{name}64_.so.* + +%files openmp64_ +%{_libdir}/lib%{name}o64_-*.so +%{_libdir}/lib%{name}o64_.so.* + +%files threads64_ +%{_libdir}/lib%{name}p64_-*.so +%{_libdir}/lib%{name}p64_.so.* +%endif + +%files devel +%{_includedir}/%{name}/ +%{_libdir}/lib%{name}.so +%{_libdir}/lib%{name}o.so +%{_libdir}/lib%{name}p.so +%if %build64 +%{_libdir}/lib%{name}64.so +%{_libdir}/lib%{name}o64.so +%{_libdir}/lib%{name}p64.so +%{_libdir}/lib%{name}64_.so +%{_libdir}/lib%{name}o64_.so +%{_libdir}/lib%{name}p64_.so +%endif + +%files static +%{_libdir}/lib%{name}.a +%{_libdir}/lib%{name}o.a +%{_libdir}/lib%{name}p.a +%if %build64 +%{_libdir}/lib%{name}64.a +%{_libdir}/lib%{name}o64.a +%{_libdir}/lib%{name}p64.a +%{_libdir}/lib%{name}64_.a +%{_libdir}/lib%{name}o64_.a +%{_libdir}/lib%{name}p64_.a +%endif + +%changelog +* Fri Jan 27 2023 Funda Wang - 0.3.21-1 +- Import package for anolis 23