[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#870205: marked as done (stretch-pu: package librsb/1.2.0-rc5-3)



Your message dated Sat, 07 Oct 2017 11:33:55 +0100
with message-id <1507372435.18586.64.camel@adam-barratt.org.uk>
and subject line Closing bugs for 9.2 point release
has caused the Debian Bug report #870205,
regarding stretch-pu: package librsb/1.2.0-rc5-3
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
870205: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=870205
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: release.debian.org
Severity: normal
Tags: stretch
User: release.debian.org@packages.debian.org
Usertags: pu

Dear Release Team,

Version 1.2.0-rc5-3 of the librsb package in stretch suffers a few severe bugs leading to numerically wrong results. These were solved in the new upstream release 1.2.0-rc7.

Michele Martone, the upstream author, who also contributes to the Debian package, prepared a minimal patch by backporting the fixes from version 1.2.0-rc7. This patch was attached to the report of Bug#870137.

I am attaching below the debdiff between 1.2.0-rc5-3 and the stretch proposed-update 1.2.0-rc5-3+deb9u1. This version includes the patch proposed by Michele Martone as well as a unit test C source file for verifying that the fix is really implemented. I added small changes to debian/rules and debian/clean for compiling, running and cleaning this unit test.

Please, tell me whether this upload would be appropriate for the next point release of stretch.

Best regards,

Raael Laboissière

-- System Information: Debian Release: 9.0 APT prefers testing APT policy: (650, 'testing'), (600, 'unstable'), (550, 'experimental'), (550, 'stable') Architecture: amd64 (x86_64) Foreign Architectures: i386

Kernel: Linux 4.9.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.utf8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
diff -Nru librsb-1.2.0-rc5/debian/changelog librsb-1.2.0-rc5/debian/changelog
--- librsb-1.2.0-rc5/debian/changelog	2016-10-09 06:03:46.000000000 -0300
+++ librsb-1.2.0-rc5/debian/changelog	2017-07-30 18:01:10.000000000 -0300
@@ -1,3 +1,15 @@
+librsb (1.2.0-rc5-3+deb9u1) stretch; urgency=medium
+
+  * 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.
+    Thanks to Michele Martone for the patch (Closes: #870137)
+  * Add unit test for numerical bug fixed in version 1.2.0-rc7.
+    Thanks to Michele Martone for the source file
+
+ -- Rafael Laboissiere <rafael@debian.org>  Sun, 30 Jul 2017 18:01:10 -0300
+
 librsb (1.2.0-rc5-3) unstable; urgency=medium
 
   * d/control: Use secure URL in Vcs-Git
diff -Nru librsb-1.2.0-rc5/debian/clean librsb-1.2.0-rc5/debian/clean
--- librsb-1.2.0-rc5/debian/clean	2016-09-22 16:57:56.000000000 -0300
+++ librsb-1.2.0-rc5/debian/clean	2017-07-30 17:57:26.000000000 -0300
@@ -10,3 +10,4 @@
 test.mtx
 doc/html/
 doc/man/man3/
+debian/rsb127_bugfix
diff -Nru librsb-1.2.0-rc5/debian/patches/fix-numerical-computation.patch librsb-1.2.0-rc5/debian/patches/fix-numerical-computation.patch
--- librsb-1.2.0-rc5/debian/patches/fix-numerical-computation.patch	1969-12-31 21:00:00.000000000 -0300
+++ librsb-1.2.0-rc5/debian/patches/fix-numerical-computation.patch	2017-07-30 18:00:11.000000000 -0300
@@ -0,0 +1,144 @@
+Description: Fix numerical computation bug
+ This is fixed in the upstream version 1.2.0-rc7.
+Author: Rafael Laboissiere <rafael@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 -Nru librsb-1.2.0-rc5/debian/patches/series librsb-1.2.0-rc5/debian/patches/series
--- librsb-1.2.0-rc5/debian/patches/series	2016-10-09 06:03:36.000000000 -0300
+++ librsb-1.2.0-rc5/debian/patches/series	2017-07-30 18:00:11.000000000 -0300
@@ -1,3 +1,4 @@
 use-shared-lib.patch
 fix-path-of-mtx-files.patch
 compile-fortran-examples.patch
+fix-numerical-computation.patch
diff -Nru librsb-1.2.0-rc5/debian/rsb127_bugfix.c librsb-1.2.0-rc5/debian/rsb127_bugfix.c
--- librsb-1.2.0-rc5/debian/rsb127_bugfix.c	1969-12-31 21:00:00.000000000 -0300
+++ librsb-1.2.0-rc5/debian/rsb127_bugfix.c	2017-07-30 17:57:26.000000000 -0300
@@ -0,0 +1,59 @@
+/* This program demonstrates a bug fixed in librsb-1.2-rc7. */
+
+#include <rsb.h>
+#include <stdio.h>
+
+int main(const int argc, char * const argv[])
+{
+	rsb_err_t errval = RSB_ERR_NO_ERROR;
+	int i;
+  	const int N = 2;
+  	double complex x[N], y[N];
+  	const double complex alpha = 1.0;
+	double complex VA[]={1,1,2};
+	int IA[]={0,0,1},JA[]={0,1,1},nnz=3;
+	struct rsb_mtx_t * mtxAp;
+	// matrix:
+	// (1,0) (1,0)
+	// (1,0) (1,0)
+	// represented as upper hermitian:
+	// (1,0) (1,0)
+	// (0,0) (1,0)
+	// multiplicand vector:
+	// (0,1)
+	// (0,0)
+	// result shall be:
+	// (0,1)
+	// (0,1)
+  	errval = rsb_lib_init(RSB_NULL_INIT_OPTIONS);
+  	if(errval != RSB_ERR_NO_ERROR)
+		goto err;
+	mtxAp = rsb_mtx_alloc_from_coo_begin(2, RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX, N, N, RSB_FLAG_DEFAULT_STORAGE_FLAGS|RSB_FLAG_UPPER_HERMITIAN , &errval);
+	errval = rsb_mtx_set_vals(mtxAp, VA, IA, JA, nnz, RSB_FLAG_NOFLAGS);
+	if(errval != RSB_ERR_NO_ERROR)
+		goto err;
+	errval = rsb_mtx_alloc_from_coo_end(&mtxAp);
+	if(errval != RSB_ERR_NO_ERROR)
+		goto err;
+	for (i = 0; i < N; i++) x[i] = y[i] = 0.0;
+    	x[0] = I;
+	errval = rsb_spmv(RSB_TRANSPOSITION_N, &alpha, mtxAp, x, 1, NULL, y, 1);
+	if(errval != RSB_ERR_NO_ERROR)
+		goto err;
+    	for (i = 0; i < N; i++)
+		printf("(%g,%g)\t", creal(y[i]), cimag(y[i]));
+    	printf("\n");
+    	if(cimag(y[1])!=1)
+		printf("Result seems incorrect -- are you using <  librsb-1.2-rc7?\n");
+	else
+		printf("Result seems correct   -- are you using >= librsb-1.2-rc7?\n");
+    	rsb_mtx_free(mtxAp);
+
+	errval = rsb_lib_exit(RSB_NULL_EXIT_OPTIONS);
+	if(errval != RSB_ERR_NO_ERROR)
+		goto err;
+	return 0;
+err:
+	rsb_perror(NULL,errval);
+	return -1;
+}
diff -Nru librsb-1.2.0-rc5/debian/rules librsb-1.2.0-rc5/debian/rules
--- librsb-1.2.0-rc5/debian/rules	2016-10-09 06:03:36.000000000 -0300
+++ librsb-1.2.0-rc5/debian/rules	2017-07-30 17:57:26.000000000 -0300
@@ -21,6 +21,9 @@
 
 override_dh_auto_test:
 	make qtests
+	(cd debian ;							\
+	 gcc -o rsb127_bugfix -I.. -L../.libs -lrsb rsb127_bugfix.c ; 	\
+	 LD_LIBRARY_PATH=../.libs ./rsb127_bugfix )
 
 override_dh_compress:
 	dh_compress -X.c -X.F90

--- End Message ---
--- Begin Message ---
Version: 9.2

Hi.

The updates referenced by each of these bugs was included in today's
point release of stretch.

Regards,

Adam

--- End Message ---

Reply to: