root/library/tests/stresssuite/blas_stress.m @ 721

Revision 721, 0.9 kB (checked in by mido, 15 years ago)

stresssuite - halfway point

Line 
1function test
2
3vn = [5,50,200,500]
4if 0
5        et =zeros(1,4);
6        et2 =zeros(1,4);
7
8        idn = 1;
9        vn = [5,50,200,500]
10        for n= vn
11                A=rand(n);B=rand(n);C=rand(n);
12                tic;
13                for i=1:10
14                        C=matmult(A,B);
15                end
16                et(idn) = toc;
17
18                tic;
19                for i=1:10
20                        C=A*B;
21                end
22                et2(idn) = toc;
23
24                idn =idn+1;
25        end
26        save blas_test
27else
28        load blas_test
29end
30
31itload('../blas_test.it')
32
33figure
34plot(vn,et)
35hold on
36plot(vn,et2,'r');
37plot(vn,exec_times,'--')
38plot(vn,exec_times_b,'r--')
39plot(vn,exec_times_c,'g--')
40title('For cycle vs. BLAS');
41ylabel('execution time');
42xlabel('matrix size');
43set(gca,'YScale','log')
44set(gca,'XScale','log')
45set(gcf,'PaperPositionMode','auto');
46
47legend('matlab for','matlab blas','IT++ for','IT++ blas','C array')
48
49
50function C=matmult(A,B)
51for i=1:size(A,1)
52        for j=1:size(A,2)
53                sum=0;
54                for k=1:size(A,2)
55                        sum=sum+A(i,k)*B(k,j);
56                end
57                C(i,j)=sum;
58        end
59end
Note: See TracBrowser for help on using the browser.