From: tornaria <tornaria@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] openblas: fix bug that affects numpy/scipy/octave/sagemath
Date: Sat, 01 Apr 2023 04:42:24 +0200 [thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-43153@inbox.vuxu.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 1623 bytes --]
There is a new pull request by tornaria against master on the void-packages repository
https://github.com/tornaria/void-packages openblas
https://github.com/void-linux/void-packages/pull/43153
openblas: fix bug that affects numpy/scipy/octave/sagemath
See: https://github.com/xianyi/OpenBLAS/issues/3976
Include patches from upstream:
- https://github.com/xianyi/OpenBLAS/pull/3978/
- https://github.com/xianyi/OpenBLAS/pull/3980/
- https://github.com/xianyi/OpenBLAS/pull/3984/
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **briefly**
I had >100 test failures in sagemath with 0.3.22_1 that are all fixed with these patches.
@ahesford
<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- aarch64-musl
- armv7l
- armv6l-musl
-->
A patch file from https://github.com/void-linux/void-packages/pull/43153.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-openblas-43153.patch --]
[-- Type: text/x-diff, Size: 7327 bytes --]
From 3c3e5860446deedcf3a293997aa7657598f1e094 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Fri, 31 Mar 2023 23:38:23 -0300
Subject: [PATCH] openblas: fix bug that affects numpy/scipy/octave/sagemath
See: https://github.com/xianyi/OpenBLAS/issues/3976
Include patches from upstream:
- https://github.com/xianyi/OpenBLAS/pull/3978/
- https://github.com/xianyi/OpenBLAS/pull/3980/
- https://github.com/xianyi/OpenBLAS/pull/3984/
---
srcpkgs/openblas/patches/3978.patch | 22 ++++++
srcpkgs/openblas/patches/3980.patch | 107 ++++++++++++++++++++++++++++
srcpkgs/openblas/patches/3984.patch | 32 +++++++++
srcpkgs/openblas/template | 3 +-
4 files changed, 162 insertions(+), 2 deletions(-)
create mode 100644 srcpkgs/openblas/patches/3978.patch
create mode 100644 srcpkgs/openblas/patches/3980.patch
create mode 100644 srcpkgs/openblas/patches/3984.patch
diff --git a/srcpkgs/openblas/patches/3978.patch b/srcpkgs/openblas/patches/3978.patch
new file mode 100644
index 000000000000..097d841bd70b
--- /dev/null
+++ b/srcpkgs/openblas/patches/3978.patch
@@ -0,0 +1,22 @@
+From 12aabb9f9ba57a74a3feedfafd97b7aeecbac450 Mon Sep 17 00:00:00 2001
+From: Martin Kroeker <martin@ruby.chemie.uni-freiburg.de>
+Date: Wed, 29 Mar 2023 09:44:33 +0200
+Subject: [PATCH] fix conditional
+
+---
+ lapack/getf2/zgetf2_k.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lapack/getf2/zgetf2_k.c b/lapack/getf2/zgetf2_k.c
+index f3412f52ff..dbc78abc60 100644
+--- a/lapack/getf2/zgetf2_k.c
++++ b/lapack/getf2/zgetf2_k.c
+@@ -107,7 +107,7 @@ blasint CNAME(blas_arg_t *args, BLASLONG *range_m, BLASLONG *range_n, FLOAT *sa,
+ temp2 = *(b + jp * 2 + 1);
+
+ // if ((temp1 != ZERO) || (temp2 != ZERO)) {
+- if ((fabs(temp1) >= DBL_MIN) && (fabs(temp2) >= DBL_MIN)) {
++ if ((fabs(temp1) >= DBL_MIN) || (fabs(temp2) >= DBL_MIN)) {
+
+ if (jp != j) {
+ SWAP_K(j + 1, 0, 0, ZERO, ZERO, a + j * 2, lda,
diff --git a/srcpkgs/openblas/patches/3980.patch b/srcpkgs/openblas/patches/3980.patch
new file mode 100644
index 000000000000..fb45c33325e2
--- /dev/null
+++ b/srcpkgs/openblas/patches/3980.patch
@@ -0,0 +1,107 @@
+From 6c431239da3e4480651480f91b3438d7ad1903e5 Mon Sep 17 00:00:00 2001
+From: Martin Kroeker <martin@ruby.chemie.uni-freiburg.de>
+Date: Wed, 29 Mar 2023 22:14:21 +0200
+Subject: [PATCH] Split test condition in LU computation - non-denormal for
+ computation, exact zero for reporting singularity
+
+---
+ lapack/getf2/getf2_k.c | 23 ++++++++++++--------
+ lapack/getf2/zgetf2_k.c | 48 ++++++++++++++++++++++-------------------
+ 2 files changed, 40 insertions(+), 31 deletions(-)
+
+diff --git a/lapack/getf2/getf2_k.c b/lapack/getf2/getf2_k.c
+index d29ed588e9..80c66dd7a6 100644
+--- a/lapack/getf2/getf2_k.c
++++ b/lapack/getf2/getf2_k.c
+@@ -100,16 +100,21 @@ blasint CNAME(blas_arg_t *args, BLASLONG *range_m, BLASLONG *range_n, FLOAT *sa,
+ jp--;
+ temp1 = *(b + jp);
+
+- //if (temp1 != ZERO) {
++ if (temp1 != ZERO) {
++#if defined(DOUBLE)
+ if (fabs(temp1) >= DBL_MIN ) {
+- temp1 = dp1 / temp1;
+-
+- if (jp != j) {
+- SWAP_K(j + 1, 0, 0, ZERO, a + j, lda, a + jp, lda, NULL, 0);
+- }
+- if (j + 1 < m) {
+- SCAL_K(m - j - 1, 0, 0, temp1, b + j + 1, 1, NULL, 0, NULL, 0);
+- }
++#else
++ if (fabs(temp1) >= FLT_MIN ) {
++#endif
++ temp1 = dp1 / temp1;
++
++ if (jp != j) {
++ SWAP_K(j + 1, 0, 0, ZERO, a + j, lda, a + jp, lda, NULL, 0);
++ }
++ if (j + 1 < m) {
++ SCAL_K(m - j - 1, 0, 0, temp1, b + j + 1, 1, NULL, 0, NULL, 0);
++ }
++ }
+ } else {
+ if (!info) info = j + 1;
+ }
+diff --git a/lapack/getf2/zgetf2_k.c b/lapack/getf2/zgetf2_k.c
+index dbc78abc60..e3d53c96f2 100644
+--- a/lapack/getf2/zgetf2_k.c
++++ b/lapack/getf2/zgetf2_k.c
+@@ -106,30 +106,34 @@ blasint CNAME(blas_arg_t *args, BLASLONG *range_m, BLASLONG *range_n, FLOAT *sa,
+ temp1 = *(b + jp * 2 + 0);
+ temp2 = *(b + jp * 2 + 1);
+
+- // if ((temp1 != ZERO) || (temp2 != ZERO)) {
++ if ((temp1 != ZERO) || (temp2 != ZERO)) {
++#if defined(DOUBLE)
+ if ((fabs(temp1) >= DBL_MIN) || (fabs(temp2) >= DBL_MIN)) {
+-
+- if (jp != j) {
+- SWAP_K(j + 1, 0, 0, ZERO, ZERO, a + j * 2, lda,
++#else
++ if ((fabs(temp1) >= FLT_MIN) || (fabs(temp2) >= FLT_MIN)) {
++#endif
++ if (jp != j) {
++ SWAP_K(j + 1, 0, 0, ZERO, ZERO, a + j * 2, lda,
+ a + jp * 2, lda, NULL, 0);
+- }
+-
+- if (fabs(temp1) >= fabs(temp2)){
+- ratio = temp2 / temp1;
+- den = dp1 /(temp1 * ( 1 + ratio * ratio));
+- temp3 = den;
+- temp4 = -ratio * den;
+- } else {
+- ratio = temp1 / temp2;
+- den = dp1 /(temp2 * ( 1 + ratio * ratio));
+- temp3 = ratio * den;
+- temp4 = -den;
+- }
+-
+- if (j + 1 < m) {
+- SCAL_K(m - j - 1, 0, 0, temp3, temp4,
+- b + (j + 1) * 2, 1, NULL, 0, NULL, 0);
+- }
++ }
++
++ if (fabs(temp1) >= fabs(temp2)){
++ ratio = temp2 / temp1;
++ den = dp1 /(temp1 * ( 1 + ratio * ratio));
++ temp3 = den;
++ temp4 = -ratio * den;
++ } else {
++ ratio = temp1 / temp2;
++ den = dp1 /(temp2 * ( 1 + ratio * ratio));
++ temp3 = ratio * den;
++ temp4 = -den;
++ }
++
++ if (j + 1 < m) {
++ SCAL_K(m - j - 1, 0, 0, temp3, temp4,
++ b + (j + 1) * 2, 1, NULL, 0, NULL, 0);
++ }
++ }
+ } else {
+ if (!info) info = j + 1;
+ }
diff --git a/srcpkgs/openblas/patches/3984.patch b/srcpkgs/openblas/patches/3984.patch
new file mode 100644
index 000000000000..0448d396ad58
--- /dev/null
+++ b/srcpkgs/openblas/patches/3984.patch
@@ -0,0 +1,32 @@
+From 36fcb52094c4c99eec651a61311204c466b7f054 Mon Sep 17 00:00:00 2001
+From: Martin Kroeker <martin@ruby.chemie.uni-freiburg.de>
+Date: Sat, 1 Apr 2023 00:02:54 +0200
+Subject: [PATCH] Fix logic - we want real OR imaginary part of X to be nonzero
+ here
+
+---
+ driver/level2/zspr_k.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/driver/level2/zspr_k.c b/driver/level2/zspr_k.c
+index d888a81ee2..7f0eefd6b3 100644
+--- a/driver/level2/zspr_k.c
++++ b/driver/level2/zspr_k.c
+@@ -53,7 +53,7 @@ int CNAME(BLASLONG m, FLOAT alpha_r, FLOAT alpha_i,
+
+ for (i = 0; i < m; i++){
+ #ifndef LOWER
+- if ((X[i * 2 + 0] != ZERO) && (X[i * 2 + 1] != ZERO)) {
++ if ((X[i * 2 + 0] != ZERO) || (X[i * 2 + 1] != ZERO)) {
+ AXPYU_K(i + 1, 0, 0,
+ alpha_r * X[i * 2 + 0] - alpha_i * X[i * 2 + 1],
+ alpha_i * X[i * 2 + 0] + alpha_r * X[i * 2 + 1],
+@@ -61,7 +61,7 @@ int CNAME(BLASLONG m, FLOAT alpha_r, FLOAT alpha_i,
+ }
+ a += (i + 1) * 2;
+ #else
+- if ((X[i * 2 + 0] != ZERO) && (X[i * 2 + 1] != ZERO)) {
++ if ((X[i * 2 + 0] != ZERO) || (X[i * 2 + 1] != ZERO)) {
+ AXPYU_K(m - i, 0, 0,
+ alpha_r * X[i * 2 + 0] - alpha_i * X[i * 2 + 1],
+ alpha_i * X[i * 2 + 0] + alpha_r * X[i * 2 + 1],
diff --git a/srcpkgs/openblas/template b/srcpkgs/openblas/template
index 6310d955f537..6f78974f49dc 100644
--- a/srcpkgs/openblas/template
+++ b/srcpkgs/openblas/template
@@ -1,8 +1,7 @@
# Template file for 'openblas'
pkgname=openblas
-reverts="0.3.19_1"
version=0.3.22
-revision=1
+revision=2
build_style=gnu-makefile
make_build_args="HOSTCC=gcc USE_OPENMP=1"
make_install_args="OPENBLAS_INCLUDE_DIR=\$(PREFIX)/include/openblas"
next reply other threads:[~2023-04-01 2:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-01 2:42 tornaria [this message]
2023-04-01 2:46 ` ahesford
2023-04-01 9:45 ` martin-frbg
2023-04-01 11:29 ` ahesford
2023-04-01 20:51 ` martin-frbg
2023-04-02 19:35 ` [PR PATCH] [Updated] " tornaria
2023-04-02 19:37 ` openblas: update to 0.3.23 tornaria
2023-04-03 3:37 ` tornaria
2023-04-04 14:48 ` [PR PATCH] [Closed]: " ahesford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-43153@inbox.vuxu.org \
--to=tornaria@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).