From: <mic...@us...> - 2012-03-09 11:21:34
|
Revision: 9800 http://octave.svn.sourceforge.net/octave/?rev=9800&view=rev Author: michelemartone Date: 2012-03-09 11:21:27 +0000 (Fri, 09 Mar 2012) Log Message: ----------- sparsersb: update to the octave-sparsersb (same matrix) benchmarking script; added a comment in the .cc file. Modified Paths: -------------- trunk/octave-forge/main/sparsersb/src/octavebench.m trunk/octave-forge/main/sparsersb/src/sparsersb.cc Modified: trunk/octave-forge/main/sparsersb/src/octavebench.m =================================================================== --- trunk/octave-forge/main/sparsersb/src/octavebench.m 2012-03-09 09:03:26 UTC (rev 9799) +++ trunk/octave-forge/main/sparsersb/src/octavebench.m 2012-03-09 11:21:27 UTC (rev 9800) @@ -1,7 +1,16 @@ #!/usr/bin/octave -q # a benchmark program for octave/matlab +# TODO: fix output format +# TODO: correct symmetric / hermitian matrices handling +# TODO: sound, time-and-runs-based benchmarking criteria + n=10; +function printbenchline(matrixname,opname,sw,times,nnz,tottime,mxxops,bpnz,msstr) + printf("FIXME (temporary format)\n"); + printf("%s %s %s %d %d %.4f %10.2f %.4f %s\n",matrixname,opname,sw,times,nnz,tottime,mxxops,bpnz,msstr); +end + if nargin <= 0 # DGEMV benchmark for o=1024:1024 @@ -27,36 +36,67 @@ #matrices=ls("*.mtx")'; f=1; +uc=2; while f<=nargin MB=1024*1024; mmn=cell2mat(argv()(f))'; mn=strtrim(mmn'); tic(); - nm=mmread(mn); + #nm=mmread(mn); + [nm,nrows,ncols,entries,rep,field,symm]=mmread(mn); + #if(symm=="symmetric")uc+=2;endif + if(strcmp(symm,"symmetric"))uc+=1;endif fsz=stat(mn).size; - rnz=nnz(nm); rt=toc(); [ia,ja,va]=find(nm); - printf("%s: %.2f MBytes read in %.4f s (%10.2f MB/s)\n",mn',fsz/MB,rt,fsz/(rt*MB)); + printf("%s: %.2f MBytes read by mmread in %.4f s (%10.2f MB/s)\n",mn',fsz/MB,rt,fsz/(rt*MB)); #ia=ia'; ja=ja'; va=va'; -for ski=1:2 +for ski=1:uc + oppnz=1; # FIXME: what about symmetry ? sparsekw="sparse"; if(ski==2)sparsekw="sparsersb";endif + if(ski==3); + oppnz=2; + sparsekw="sparsersb"; + tic(); [nm]=sparsersb(mn); rt=toc(); + sparsersb(nm,"info") + printf("%s: %.2f MBytes read by librsb in %.4f s (%10.2f MB/s)\n",mn',fsz/MB,rt,fsz/(rt*MB)); + endif + if(ski==4); + nm=tril(nm); + endif + [ia,ja,va]=find(nm); + rnz=nnz(nm); + printf("benchmarking %s\n",sparsekw); + #printf("symmetry ? %s\n",issymmetric(sparse(nm))); mrc=rows(nm); mcc=columns(nm); + + + if(ski!=3); tic(); eval(["for i=1:n; om=",sparsekw,"(ia,ja,va,mrc,mcc,\"summation\"); end"]); + printf("benchmarking %s\n",sparsekw); at=toc(); mnz=nnz(om); amflops=n*2.0*mnz/(10^6 * at); printf("%s (%s) %d spBLD for %d nnz in %.4f secs, so %10.2f Mflops\n",mn',sparsekw,n,rnz,at,amflops); + else + mnz=rnz; + end + #rm=sparsersb(ia,ja,va);# UNFINISHED r=v=linspace(1,1,size(om,1))'; tic(); for i=1:n; r+=om *v; end; umt=toc(); - UMflops=n*2.0*mnz/(10^6 * umt); + UMflops=oppnz*n*2.0*mnz/(10^6 * umt); printf("%s (%s) %d spMV for %d nnz in %.4f secs, so %10.2f Mflops\n",mn',sparsekw,n,mnz,umt, UMflops); + bpnz=-1; # FIXME: bytes per nonzero! + msstr="?";# FIXME: matrix structure string! + # FIXME: finish the following! + #printbenchline(mn',"spMV",sparsekw,n,mnz,umt, UMflops,bpnz,msstr); + # tic(); for i=1:n; r+=om.'*v; end; tmt=toc(); - TMflops=n*2.0*mnz/(10^6 * tmt); + TMflops=oppnz*n*2.0*mnz/(10^6 * tmt); printf("%s (%s) %d spMVT for %d nnz in %.4f secs, so %10.2f Mflops\n",mn',sparsekw,n,mnz,tmt, TMflops); end ++f; Modified: trunk/octave-forge/main/sparsersb/src/sparsersb.cc =================================================================== --- trunk/octave-forge/main/sparsersb/src/sparsersb.cc 2012-03-09 09:03:26 UTC (rev 9799) +++ trunk/octave-forge/main/sparsersb/src/sparsersb.cc 2012-03-09 11:21:27 UTC (rev 9800) @@ -45,6 +45,7 @@ * error reporting is insufficient * elemental division support for complex matrices is incomplete * shall update to symmetric be forbidden or rather trigger a conversion ? + * after file read, shall return various structural info * * Developer notes: /usr/share/doc/octave3.2-htmldoc//interpreter/Getting-Started-with-Oct_002dFiles.html#Getting-Started-with-Oct_002dFiles This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |