From: <mic...@us...> - 2011-12-13 23:18:05
|
Revision: 9378 http://octave.svn.sourceforge.net/octave/?rev=9378&view=rev Author: michelemartone Date: 2011-12-13 23:17:59 +0000 (Tue, 13 Dec 2011) Log Message: ----------- sparsersb: changed order of statements in the main benchmark script (slowest first); more info dumped out in lsbench.m (the linear solver benchmark script). Modified Paths: -------------- trunk/octave-forge/main/sparsersb/src/lsbench.m trunk/octave-forge/main/sparsersb/src/sparsersb.cc trunk/octave-forge/main/sparsersb/src/sparsersbbench.m Modified: trunk/octave-forge/main/sparsersb/src/lsbench.m =================================================================== --- trunk/octave-forge/main/sparsersb/src/lsbench.m 2011-12-13 22:12:42 UTC (rev 9377) +++ trunk/octave-forge/main/sparsersb/src/lsbench.m 2011-12-13 23:17:59 UTC (rev 9378) @@ -9,15 +9,23 @@ # This one is based on what Carlo De Falco posted on the octave-dev mailing list: # (he used n=1000, k=15) n = 5000; +maxit = n; k = 1500; -A = k * eye (n) + sprandn (n, n, .2); +A_= k * eye (n) + sprandn (n, n, .2); +[i,j,v]=find(sparse(A_)); +tic, Ao = sparse (i,j,v,n,n);bt=toc; b = ones (n, 1); -nnz (A) -P = diag (diag (A)); -tic, [x, flag] = gmres (A, b, [], 1e-7, n, P); dt=toc -printf("Octave took %f s.\n",dt); +nnz (Ao) +P = diag (diag (Ao)); +tic, [X, FLAG, RELRES, ITER] = gmres (Ao, b, [], 1e-7, maxit, P); dt=toc; +cs="Octave "; +nv=norm(Ao*X-b); +printf("%s took %.4f = %.4f + %.4f s and gave residual %g, flag %d, error norm %g.\n",cs,bt+dt,bt,dt,RELRES,FLAG,nv); -As = sparsersb (A); -tic, [x, flag] = gmres (As, b, [], 1e-7, n, P); dt=toc -printf("librsb took %f s.\n",dt); +#tic, Ar = sparsersb (Ao);bt=toc; +tic, Ar = sparsersb (i,j,v,n,n);bt=toc; +tic, [X, FLAG, RELRES, ITER] = gmres (Ar, b, [], 1e-7, maxit, P); dt=toc; +cs="sparsersb"; +nv=norm(Ar*X-b); +printf("%s took %.4f = %.4f + %.4f s and gave residual %g, flag %d, error norm %g.\n",cs,bt+dt,bt,dt,RELRES,FLAG,nv); Modified: trunk/octave-forge/main/sparsersb/src/sparsersb.cc =================================================================== --- trunk/octave-forge/main/sparsersb/src/sparsersb.cc 2011-12-13 22:12:42 UTC (rev 9377) +++ trunk/octave-forge/main/sparsersb/src/sparsersb.cc 2011-12-13 23:17:59 UTC (rev 9378) @@ -42,6 +42,7 @@ * may define as map (see is_map) so that "a.type = ..." can work * is_struct, find_nonzero_elem_idx are undefined * are octave_triangular_conv, default_numeric_conversion_function ok ? + * error reporting is insufficient * * Developer notes: /usr/share/doc/octave3.2-htmldoc//interpreter/Getting-Started-with-Oct_002dFiles.html#Getting-Started-with-Oct_002dFiles Modified: trunk/octave-forge/main/sparsersb/src/sparsersbbench.m =================================================================== --- trunk/octave-forge/main/sparsersb/src/sparsersbbench.m 2011-12-13 22:12:42 UTC (rev 9377) +++ trunk/octave-forge/main/sparsersb/src/sparsersbbench.m 2011-12-13 23:17:59 UTC (rev 9378) @@ -37,6 +37,15 @@ rinitstr=["A=sparsersb(",mstring,");nr=size(A)(1);nc=size(A)(2);"]; finitstr=["A=full(",mstring,");"]; cinitstr=["M=sparse(",mstring,");[ia,ja,va]=find(M);nr=size(M)(1);nc=size(M)(2);"]; + sparsersbbench_("",[rinitstr,""],"A.*=2.0;","clear A","",mint); + sparsersbbench_("",[rinitstr,""],"A.*=2.5;","clear A","",mint); + sparsersbbench_("",[rinitstr,""],"A./=2.0;","clear A","",mint); + sparsersbbench_("",[rinitstr,""],"A./=2.5;","clear A","",mint); + #sparsersbbench_("",[rinitstr,""],"A.*=0.0;","clear A","",mint); + #sparsersbbench_("",[rinitstr,""],"A./=0.0;","clear A","",mint); + sparsersbbench_("",[rinitstr,""],"A.^=2.5;","clear A","",mint); + sparsersbbench_("",[rinitstr,""],"A.^=2.0;","clear A","",mint); + sparsersbbench_("",[rinitstr,""],"A.^=0.5;","clear A","",mint); sparsersbbench_("",[cinitstr,""],"C=sparsersb(ia,ja,va,nr,nc);clear C;","clear A C ia ja va","",mint); sparsersbbench_("",[cinitstr,""],"C=sparsersb(ia,ja,va);clear C;","clear A C ia ja va","",mint); sparsersbbench_("",[cinitstr,""],"C=sparsersb(ja,ia,va);clear C;","clear A C ia ja va","",mint); @@ -55,20 +64,11 @@ end end clear A; - sparsersbbench_("",[rinitstr,"B=A;"],"C=A*B;clear C","clear A B C","",mint); - sparsersbbench_("",[rinitstr,"B=A;"],"C=A.'*B;clear C","clear A B C","",mint); sparsersbbench_("",[rinitstr,"D=ones(nr,1);"],"D=diag(A);","clear A D","",mint); - sparsersbbench_("",[rinitstr,""],"A.*=2.0;","clear A","",mint); - sparsersbbench_("",[rinitstr,""],"A.*=2.5;","clear A","",mint); - sparsersbbench_("",[rinitstr,""],"A./=2.0;","clear A","",mint); - sparsersbbench_("",[rinitstr,""],"A./=2.5;","clear A","",mint); - #sparsersbbench_("",[rinitstr,""],"A.*=0.0;","clear A","",mint); - #sparsersbbench_("",[rinitstr,""],"A./=0.0;","clear A","",mint); - sparsersbbench_("",[rinitstr,""],"A.^=2.5;","clear A","",mint); - sparsersbbench_("",[rinitstr,""],"A.^=2.0;","clear A","",mint); - sparsersbbench_("",[rinitstr,""],"A.^=0.5;","clear A","",mint); sparsersbbench_("",[rinitstr,"B=A;"],"C=A+B;","clear A B C","",mint); sparsersbbench_("",[rinitstr,"B=A;"],"C=A.'+B;","clear A B C","",mint); + sparsersbbench_("",[rinitstr,"B=A;"],"C=A*B;clear C","clear A B C","",mint); + sparsersbbench_("",[rinitstr,"B=A;"],"C=A.'*B;clear C","clear A B C","",mint); end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |