Mercurial > forge
annotate main/sparsersb/bin/octavebench.m @ 12622:c3df6726a661 octave-forge
changes to respond to Carnë Draug's review of sparsersb dated 20150521@18:22 (ticket #172).
author | michelemartone |
---|---|
date | Fri, 29 May 2015 21:12:32 +0000 |
parents | 556f3ef6a343 |
children |
rev | line source |
---|---|
11881
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
1 #!/usr/bin/octave -q |
12622
c3df6726a661
changes to respond to Carnë Draug's review of sparsersb dated 20150521@18:22 (ticket #172).
michelemartone
parents:
11883
diff
changeset
|
2 # |
c3df6726a661
changes to respond to Carnë Draug's review of sparsersb dated 20150521@18:22 (ticket #172).
michelemartone
parents:
11883
diff
changeset
|
3 # Copyright (C) 2011-2015 Michele Martone <michelemartone _AT_ users.sourceforge.net> |
c3df6726a661
changes to respond to Carnë Draug's review of sparsersb dated 20150521@18:22 (ticket #172).
michelemartone
parents:
11883
diff
changeset
|
4 # |
c3df6726a661
changes to respond to Carnë Draug's review of sparsersb dated 20150521@18:22 (ticket #172).
michelemartone
parents:
11883
diff
changeset
|
5 # This program is free software; you can redistribute it and/or modify |
c3df6726a661
changes to respond to Carnë Draug's review of sparsersb dated 20150521@18:22 (ticket #172).
michelemartone
parents:
11883
diff
changeset
|
6 # it under the terms of the GNU General Public License as published by |
c3df6726a661
changes to respond to Carnë Draug's review of sparsersb dated 20150521@18:22 (ticket #172).
michelemartone
parents:
11883
diff
changeset
|
7 # the Free Software Foundation; either version 3 of the License, or |
c3df6726a661
changes to respond to Carnë Draug's review of sparsersb dated 20150521@18:22 (ticket #172).
michelemartone
parents:
11883
diff
changeset
|
8 # (at your option) any later version. |
c3df6726a661
changes to respond to Carnë Draug's review of sparsersb dated 20150521@18:22 (ticket #172).
michelemartone
parents:
11883
diff
changeset
|
9 # |
c3df6726a661
changes to respond to Carnë Draug's review of sparsersb dated 20150521@18:22 (ticket #172).
michelemartone
parents:
11883
diff
changeset
|
10 # This program is distributed in the hope that it will be useful, |
c3df6726a661
changes to respond to Carnë Draug's review of sparsersb dated 20150521@18:22 (ticket #172).
michelemartone
parents:
11883
diff
changeset
|
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
c3df6726a661
changes to respond to Carnë Draug's review of sparsersb dated 20150521@18:22 (ticket #172).
michelemartone
parents:
11883
diff
changeset
|
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c3df6726a661
changes to respond to Carnë Draug's review of sparsersb dated 20150521@18:22 (ticket #172).
michelemartone
parents:
11883
diff
changeset
|
13 # GNU General Public License for more details. |
c3df6726a661
changes to respond to Carnë Draug's review of sparsersb dated 20150521@18:22 (ticket #172).
michelemartone
parents:
11883
diff
changeset
|
14 # |
c3df6726a661
changes to respond to Carnë Draug's review of sparsersb dated 20150521@18:22 (ticket #172).
michelemartone
parents:
11883
diff
changeset
|
15 # You should have received a copy of the GNU General Public License |
c3df6726a661
changes to respond to Carnë Draug's review of sparsersb dated 20150521@18:22 (ticket #172).
michelemartone
parents:
11883
diff
changeset
|
16 # along with this program; if not, see <http://www.gnu.org/licenses/>. |
c3df6726a661
changes to respond to Carnë Draug's review of sparsersb dated 20150521@18:22 (ticket #172).
michelemartone
parents:
11883
diff
changeset
|
17 # |
11883
556f3ef6a343
packaging oriented scripts/function file changes.
michelemartone
parents:
11881
diff
changeset
|
18 1; # This is a script |
11881
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
19 # a benchmark program for octave/matlab |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
20 # TODO: fix output format |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
21 # TODO: correct symmetric / hermitian matrices handling |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
22 # TODO: sound, time-and-runs-based benchmarking criteria |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
23 |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
24 n=10; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
25 |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
26 function printbenchline(matrixname,opname,sw,times,nnz,tottime,mxxops,bpnz,msstr) |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
27 printf("FIXME (temporary format)\n"); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
28 printf("%s %s %s %d %d %.4f %10.2f %.4f %s\n",matrixname,opname,sw,times,nnz,tottime,mxxops,bpnz,msstr); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
29 end |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
30 |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
31 if nargin <= 0 |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
32 # DGEMV benchmark |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
33 for o=1024:1024 |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
34 #for o=1024:256:2048*2 |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
35 m=rand(o); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
36 v=linspace(1,1,o)'; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
37 tic(); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
38 for i=1:n; m*v; end |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
39 t=toc(); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
40 Mflops=n*2.0*nnz(m)/(10^6 * t); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
41 dgemvmflops=Mflops; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
42 printf("%d GEMV for order %d in %g secs, so %10f Mflops\n",n,o,t,n*2.0*o*o/(10^6 * t)); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
43 end |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
44 quit |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
45 endif |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
46 |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
47 # if nargin > 0, we continue |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
48 want_sparsersb_io=1; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
49 |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
50 if want_sparsersb_io != 1 |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
51 source("ext/mminfo.m"); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
52 source("ext/mmread.m"); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
53 source("ext/mmwrite.m"); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
54 end |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
55 |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
56 #matrices=ls("*.mtx")'; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
57 f=1; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
58 uc=2; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
59 while f<=nargin |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
60 MB=1024*1024; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
61 mmn=cell2mat(argv()(f))'; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
62 mn=strtrim(mmn'); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
63 tic(); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
64 #nm=mmread(mn); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
65 if want_sparsersb_io == 1 |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
66 [nm,nrows,ncols,entries,rep,field,symm]=sparsersb(mn); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
67 nm=sparse(nm); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
68 if (symm=='S') |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
69 uc+=1; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
70 end |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
71 else |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
72 [nm,nrows,ncols,entries,rep,field,symm]=mmread(mn); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
73 #if(symm=="symmetric")uc+=2;endif |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
74 if(strcmp(symm,"symmetric"))uc+=1;endif |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
75 end |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
76 wr=0 ; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
77 if wr==1 |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
78 sparsersb(sparsersb(nm),"render",[mn,"-original.eps"]); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
79 pct=-time; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
80 #p=colamd(nm); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
81 p=colperm(nm); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
82 pct+=time; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
83 pat=-time; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
84 nm=nm(:,p); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
85 pat+=time; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
86 #sparsersb(sparsersb(nm),"render",[mn,"-colamd.eps"]) |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
87 sparsersb(sparsersb(nm),"render",[mn,"-colperm.eps"]); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
88 end |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
89 fsz=stat(mn).size; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
90 rt=toc(); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
91 [ia,ja,va]=find(nm); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
92 printf("%s: %.2f MBytes read in %.4f s (%10.2f MB/s)\n",mn',fsz/MB,rt,fsz/(rt*MB)); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
93 #ia=ia'; ja=ja'; va=va'; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
94 sep=" "; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
95 csvlstring=sprintf("#mn entries nrows ncols"); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
96 csvdstring=sprintf("%%:%s%s%d%s%d%s%d",mn,sep,entries,sep,nrows,sep,ncols); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
97 for ski=1:uc |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
98 oppnz=1; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
99 # FIXME: what about symmetry ? |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
100 sparsekw="sparse"; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
101 if(ski==2)sparsekw="sparsersb";endif |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
102 if(ski==3); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
103 oppnz=2; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
104 sparsekw="sparsersb"; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
105 tic(); [nm]=sparsersb(mn); rt=toc(); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
106 sparsersb(nm,"info") |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
107 printf("%s: %.2f MBytes read by librsb in %.4f s (%10.2f MB/s)\n",mn',fsz/MB,rt,fsz/(rt*MB)); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
108 endif |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
109 if(ski==4); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
110 nm=tril(nm); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
111 endif |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
112 [ia,ja,va]=find(nm); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
113 rnz=nnz(nm); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
114 printf("benchmarking %s\n",sparsekw); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
115 #printf("symmetry ? %s\n",issymmetric(sparse(nm))); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
116 mrc=rows(nm); mcc=columns(nm); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
117 |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
118 |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
119 if(ski!=3); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
120 tic(); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
121 eval(["for i=1:n; om=",sparsekw,"(ia,ja,va,mrc,mcc,\"summation\"); end"]); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
122 printf("benchmarking %s\n",sparsekw); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
123 at=toc(); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
124 #if(ski==2) tic(); nm=sparsersb(om,"autotune","N");om=nm; att=toc(); ;endif |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
125 mnz=nnz(om); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
126 amflops=n*2.0*mnz/(10^6 * at); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
127 printf("%s (%s) %d spBLD for %d nnz in %.4f secs, so %10.2f Mflops\n",mn',sparsekw,n,rnz,at,amflops); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
128 else |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
129 mnz=rnz; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
130 end |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
131 |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
132 #rm=sparsersb(ia,ja,va);# UNFINISHED |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
133 r=linspace(1,1,size(om,1))'; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
134 v=linspace(1,1,size(om,2))'; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
135 tic(); for i=1:n; r+=om *v; end; umt=toc(); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
136 UMflops=oppnz*n*2.0*mnz/(10^6 * umt); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
137 printf("%s (%s) %d spMV for %d nnz in %.4f secs, so %10.2f Mflops\n",mn',sparsekw,n,mnz,umt, UMflops); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
138 bpnz=-1; # FIXME: bytes per nonzero! |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
139 msstr="?";# FIXME: matrix structure string! |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
140 # FIXME: finish the following! |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
141 #printbenchline(mn',"spMV",sparsekw,n,mnz,umt, UMflops,bpnz,msstr); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
142 # |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
143 tmp=r;r=v;v=tmp; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
144 tic(); for i=1:n; r+=om.'*v; end; tmt=toc(); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
145 TMflops=oppnz*n*2.0*mnz/(10^6 * tmt); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
146 printf("%s (%s) %d spMVT for %d nnz in %.4f secs, so %10.2f Mflops\n",mn',sparsekw,n,mnz,tmt, TMflops); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
147 if(ski<3); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
148 csvlstring=sprintf("%s%s",csvlstring," n at amflops umt UMflops tmt TMflops"); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
149 csvdstring=sprintf("%s%s%d%s%f%s%f%s%f%s%f%s%f%s%f",csvdstring,sep,n,sep,at,sep,amflops,sep,umt,sep,UMflops,sep,tmt,sep,TMflops); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
150 endif |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
151 end |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
152 ++f; |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
153 printf("%s\n",csvlstring); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
154 printf("%s\n",csvdstring); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
155 end |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
156 |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
157 printf("benchmark terminated\n"); |
c1e0cad0ba9d
packaging oriented change: moving some files around, according to their destination (e.g.: scripts or functions).
michelemartone
parents:
diff
changeset
|
158 |