How to measure FLOPS of a MatLab function?
Show older comments
I'm running MS-OS XP, service pack 3, Pentium 4, CPU 3.4GHz.
Matlab 7.11.0.584, 32 BIT.
BACKGROUND:
I recently installed a FLOPS toolbox called Lightspeed by Tom Minka. http://research.microsoft.com/en-us/um/people/minka/software/lightspeed/
The install went well, and I'm able to access the commands.
I'm running a function I've created that involves addition, subtraction, index searching, if-statements, for-loops, conditional statements, large database structures, etc...
QUESTION:
How do I use the FLOPS commands from the Lightspeed Toolbox to measure the number of flops performed by the function? I only want the total number of flops performed by the function.
And if that doesn't work, what other method exists to measure flops of a function in Matlab and how do I use those?
Accepted Answer
More Answers (1)
wided hechkel
on 27 Aug 2016
Edited: wided hechkel
on 27 Aug 2016
please can you give me the matlab code for calculating the FLOPs of this algorithm:
zf=10
for zj=0:0.01:20
for xf=1:1:64
for xi=0:0.01:10
for xr=1:1:128
ZT=sign(zj-zf)*sqrt((zj-zf)^2+(xf-xi)^2)-abs(zj-zf);
ZD=sqrt(zf^2+(xr-xi)^2)-zf;
somme=sum(zj-ZD-2*ZT);
end
end
end
end
i want to know the method of utilizing the lightspeed matlab toolbox, please can you give me the code not only the results of FLOPs number
1 Comment
Walter Roberson
on 21 Mar 2017
Edited: Walter Roberson
on 19 Jun 2017
The operation sqrt((zj-zf)^2+(xf-xi)^2) can be implemented in some architectures as hypot(zj-sf, xf-xi) where hypot is a built-in instruction. Such instructions can be more accurate than the naive computation done here for the case where the two values are between 0 and sqrt(realmin) as squaring such values would underflow to 0. How do you count FLOPS for a hybrid hardware instruction, one which might take fewer or more cycles than the naive equivalent (due to accuracy issues)? How do you count FLOPS for sqrt(), which is neither a multiply nor an addition?
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!