comparison m-toolbox/classes/+utils/@helper/CPUbenchmark.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %
3 % CPU benchmarking for comparing speeds among different
4 % architectures/computers.
5 %
6 % DESCRIPTION: CPUbenchmark provides a benchmark CPU time for comparison
7 % among different architectures/computers. It gives the mean
8 % CPU time and the mean error.
9 %
10 % CALL: [a, b] = CPUbenchmark;
11 %
12 % VERSION: $Id: CPUbenchmark.m,v 1.1 2011/02/03 13:34:47 congedo Exp $
13 %
14 % HISTORY: 02-02-2011 G. Congedo
15 %
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17
18 function [avgT,stdT]=CPUbenchmark
19
20 avgT = zeros(10,1);
21 stdT = avgT;
22
23 for jj=1:10
24 m = zeros(100,1);
25 for kk = 1:100
26 tic
27 for i = 1:1e4
28 a = rand(10,10);
29 a = a';
30 end
31 m(kk)=toc;
32 end
33
34 avgT(jj) = mean(m);
35 stdT(jj) = std(m)/sqrt(numel(m));
36
37 end
38
39 avgT = mean(avgT);
40 stdT = mean(stdT);
41
42 end