[librsb] 02/02: d/p/fix-numerical-computation.patch: New patch
Rafael Laboissiere
rafael at debian.org
Sun Jul 30 22:01:45 UTC 2017
This is an automated email from the git hooks/post-receive script.
rafael pushed a commit to branch stretch
in repository librsb.
commit 83ad4e4f1584b91c046bbddd04663b0beaafd2b8
Author: Rafael Laboissiere <rafael at debian.org>
Date: Sun Jul 30 16:20:59 2017 -0300
d/p/fix-numerical-computation.patch: New patch
This minimal patch backports the fixes to a few severe bugs leading to
numerically wrong results. These bugs are fixed in the upstream
version 1.2.0-rc7.
Gbp-Dch: Full
Closes: #870137
Thanks: Michele Martone for the patch
---
debian/patches/fix-numerical-computation.patch | 144 +++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 145 insertions(+)
diff --git a/debian/patches/fix-numerical-computation.patch b/debian/patches/fix-numerical-computation.patch
new file mode 100644
index 0000000..707164c
--- /dev/null
+++ b/debian/patches/fix-numerical-computation.patch
@@ -0,0 +1,144 @@
+Description: Fix numerical computation bug
+ This is fixed in the upstream version 1.2.0-rc7.
+Author: Rafael Laboissiere <rafael at debian.org>
+Forwarded: not-needed
+Last-Update: 2017-07-30
+
+--- librsb-1.2.0-rc5.orig/rsb_krnl_bcss_macros.m4
++++ librsb-1.2.0-rc5/rsb_krnl_bcss_macros.m4
+@@ -922,9 +922,9 @@ dnl // nt: ntransposition ttranspositi
+ k=fk;
+ if(k==lk)continue;
+ j=bindx[k];
+- cacc += RSB_M4_CONJ(VA[k]*rhs[tcolsu*j*xstride],mtype,ntransposition,k_symmetry);
++ cacc += RSB_M4_CONJ(VA[k],mtype,ntransposition,k_symmetry)*rhs[tcolsu*j*xstride];
+ if(roff!=coff || (j!=i))
+- tout[(tcolsu)*(j)*ystride]+=RSB_M4_CONJ(VA[k]*bt,mtype,ttransposition,k_symmetry);
++ tout[(tcolsu)*(j)*ystride]+=RSB_M4_CONJ(VA[k],mtype,ttransposition,k_symmetry)*bt;
+ ++k;
+ dnl RSB_M4_SIMPLE_LOOP_UNROLL_2S..
+ RSB_M4_SIMPLE_LOOP_UNROLL_2S_J(`k',`LI',`fk+1',`lk-1',`dnl
+@@ -933,7 +933,7 @@ dnl
+ `const mtype b_'``''LI`'=rhs[tcolsu*(`j_'``''LI`')*xstride];
+ `const mtype a_'``''LI`'=VA[k+LI];
+ `mtype c_'``''LI`'=RSB_M4_CONJ_SYM(mtype,ttransposition,k_symmetry)( `a_'``''LI)*bt;
+-dnl `mtype c_'``''LI`'=RSB_M4_CONJ(( `a_'``''LI *bt ),mtype,transposition,k_symmetry);
++dnl `mtype c_'``''LI`'=RSB_M4_CONJ(( `a_'``''LI),mtype,transposition,k_symmetry) *bt ;
+ dnl
+ ',`dnl
+ cacc += RSB_M4_CONJ_SYM(mtype,ntransposition,k_symmetry)(`a_'``''LI)*b_``''LI;
+@@ -942,9 +942,9 @@ dnl
+ if(k<lk)
+ {
+ j=bindx[k];
+- cacc += RSB_M4_CONJ(VA[k]*rhs[trowsu*j*xstride],mtype,ntransposition,k_symmetry);
++ cacc += RSB_M4_CONJ(VA[k],mtype,ntransposition,k_symmetry)*rhs[trowsu*j*xstride];
+ if(roff!=coff || (j!=i))
+- tout[(tcolsu)*(j)*ystride]+=RSB_M4_CONJ(VA[k]*bt,mtype,ttransposition,k_symmetry);
++ tout[(tcolsu)*(j)*ystride]+=RSB_M4_CONJ(VA[k],mtype,ttransposition,k_symmetry)*bt;
+ ++k;
+ }
+ popdef(`ntransposition')dnl
+@@ -1047,7 +1047,7 @@ dnl
+ dnl Fixed for Hermitian k_symmetry.
+ dnl
+ ifelse(is_diag_d_spsv_kernel,1,`dnl
+- out[trowsu*bri]-=RSB_M4_CONJ(*a*ax_0,mtype,transposition,k_symmetry);
++ out[trowsu*bri]-=RSB_M4_CONJ(*a,mtype,transposition,k_symmetry)*ax_0;
+ ',`dnl
+ {RSB_M4_KERNEL_FUNCTION_BODY(`row',`rows',b_rows,`column',`columns',b_columns,mtype,,mop,unrolling,RSB_M4_SYMBOL_UNSYMMETRIC)}
+ ')dnl
+--- librsb-1.2.0-rc5.orig/rsb_libspblas_handle.c
++++ librsb-1.2.0-rc5/rsb_libspblas_handle.c
+@@ -1,6 +1,6 @@
+ /*
+
+-Copyright (C) 2008-2015 Michele Martone
++Copyright (C) 2008-2017 Michele Martone
+
+ This file is part of librsb.
+
+@@ -1527,9 +1527,15 @@ int rsb__BLAS_Xusget_element(blas_sparse
+ \ingroup gr_internals
+ */
+ rsb_err_t errval = RSB_ERR_NO_ERROR;
++#if 1
++ struct rsb_blas_sparse_matrix_t * bsm = NULL;
++ if( ( bsm = rsb__BLAS_matrix_retrieve(A)) != NULL && bsm->base == blas_one_base )
++ i-=1, j-=1;
++ errval = rsb__do_get_coo_element(bsm->mtxAp,v,i,j);
++#else
+ struct rsb_mtx_t * mtxAp = rsb__BLAS_inner_matrix_retrieve(A);
+-
+ errval = rsb__do_get_coo_element(mtxAp,v,i,j);
++#endif
+ return RSB_ERROR_TO_BLAS_ERROR(errval);
+ }
+
+--- librsb-1.2.0-rc5.orig/rsb_util.m4
++++ librsb-1.2.0-rc5/rsb_util.m4
+@@ -2708,6 +2708,7 @@ again`_'RSB_M4_CHOPSPACES(mtype):
+ --ti;
+ vT[ti] += vB[bi] + vC[ci];
+ ++bi;
++ ++ci;
+ ++ti;
+ ++onz;
+ }
+@@ -2715,16 +2716,16 @@ again`_'RSB_M4_CHOPSPACES(mtype):
+ t0 = ti;
+ if ( bi<nnzB && ci<nnzC && RSB_COO_GT(IB[bi],JB[bi],IC[ci],JC[ci]) )
+ {
+- IT[ti] = IB[bi];
+- JT[ti] = JB[bi];
+- vT[ti] = vB[bi] + vC[ci];
+- ++bi,++ci,++ti;
++ IT[ti] = IC[ci];
++ JT[ti] = JC[ci];
++ vT[ti] = vC[ci];
++ ++ci,++ti;
+ }
+
+ while( bi<nnzB && ci<nnzC && RSB_COO_GT(IB[bi],JB[bi],IC[ci],JC[ci]) && ti > 0 && RSB_COO_EQ(IC[ci],JC[ci],IT[ti-1],JT[ti-1]) )
+ {
+ --ti;
+- vT[ti] += vB[bi] + vC[ci];
++ vT[ti] += vC[ci];
+ ++ci;
+ ++ti;
+ ++onz;
+@@ -2733,6 +2734,8 @@ again`_'RSB_M4_CHOPSPACES(mtype):
+ if( ci < nnzC && bi < nnzB )
+ goto again`_'RSB_M4_CHOPSPACES(mtype);
+
++again`_once_'RSB_M4_CHOPSPACES(mtype):
++
+ if ( bi<nnzB && ci==nnzC )
+ {
+ IT[ti] = IB[bi];
+@@ -2761,14 +2764,14 @@ again`_'RSB_M4_CHOPSPACES(mtype):
+ while( ci<nnzC && bi==nnzB && ti > 0 && RSB_COO_EQ(IC[ci],JC[ci],IT[ti-1],JT[ti-1]) )
+ {
+ --ti;
+- IT[ti] = IC[ci];
+- JT[ti] = JC[ci];
+ vT[ti]+= vC[ci];
+ ++ci;
+ ++ti;
+ ++onz;
+ }
+
++ if( ci < nnzC || bi < nnzB )
++ goto again`_once_'RSB_M4_CHOPSPACES(mtype);
+ }
+ else
+ #endif
+@@ -2825,7 +2828,7 @@ foreach(`mtypeb',RSB_M4_TYPES,`dnl
+ mtypeb*tdst = dst;
+ ifelse(RSB_M4_AND(RSB_M4_IS_COMPLEX_TYPE(mtypeb)),1,`dnl
+ if(RSB_DOES_CONJUGATE(transA))
+- for(nzi=0;nzi<nnz;++nzi) RSB_M4_ASSIGN(mtypeb,mtypea,`tdst[nzi]',`RSB_M4_CONJ(`(mtypeb)(alpha*tsrc[nzi])',mtypeb,RSB_M4_TRANS_C,RSB_M4_SYMBOL_UNSYMMETRIC)')
++ for(nzi=0;nzi<nnz;++nzi) RSB_M4_ASSIGN(mtypeb,mtypea,`tdst[nzi]',`(mtypeb)(alpha*RSB_M4_CONJ(`tsrc[nzi]',mtypeb,RSB_M4_TRANS_C,RSB_M4_SYMBOL_UNSYMMETRIC))')
+ else
+ ')dnl
+ for(nzi=0;nzi<nnz;++nzi) RSB_M4_ASSIGN(mtypeb,mtypea,`tdst[nzi]',`(mtypeb)(alpha*tsrc[nzi])')
diff --git a/debian/patches/series b/debian/patches/series
index 2b1abe1..893d6c0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
use-shared-lib.patch
fix-path-of-mtx-files.patch
compile-fortran-examples.patch
+fix-numerical-computation.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/librsb.git
More information about the debian-science-commits
mailing list