1

I have been following some tutorials for OpenCL and a lot of times people speak in terms of FLOPS. Wikipedia does explain the formula but does not tell what it actually means? For example, 1 light year = 9.4605284 × 10^15 meters but what it means is the distance traveled by light in a year. Similarly what does FLOP mean? Answer to a similar question says 100 IOPS for the code

for(int i = 0; i < 100; ++i)

Ignoring the initialisation, I see 100 increment operations, so there's 100IOPS. But I also see 100 comparison operations. So why isn't it 200IOPS? So what types of operators are included in FLOPS/IOPS calculation?

Secondly I want to know what would you do by calculating the FLOPS of your algorithm? I am asking this because the value is specific for a CPU clock speed and no of cores. Any guidance on this arena would be very helpful.

Community
  • 1
  • 1
Cool_Coder
  • 4,420
  • 14
  • 49
  • 89
  • You didn't quote the whole Answer you linked to, which actually answers your question directly: "That would be 100 floating point operations, as well as 100 integer operations, as well as some (100?) control-flow/branch/comparison operations." I is for 'integer' not 'increment', and the author puts comparisons in a different category. – AShelly Mar 06 '14 at 15:42
  • But the answer has a question mark after 100. So what does that signify? And why is categorised differently from the operation 'i<100'. Is this not integer operation too? – Cool_Coder Mar 06 '14 at 15:45
  • With no optimization there would be 100 comparisons and 100 or 101 jumps. With optimization, it's harder to say for sure (does the compiler unroll?), but it doesn't really matter, since no one is trying to measure "CF/B/C"OPS. – AShelly Mar 06 '14 at 15:48
  • ok understood the reason for question mark. But why categorise comparison differently? For example, if d is a float then 'd < 100.0' wouldn't be included in the FLOPS calculation, correct? – Cool_Coder Mar 06 '14 at 15:51

1 Answers1

5

"FLOPS" stands for "Floating Point Operations Per Second" and it's exactly that. It's used as a measure of the computing speed of large, number based (usually scientific) operations. Measuring it is a matter of knowing two things: 1.) The precise execution time of your algorithm 2.) The precise number of floating point operations involved in your algorithm

You can get pretty good approximations of the first one from profiling tools, and the second one from...well you might be on your own there. You can look through the source for floating point operations like "1.0 + 2.0" or look at the generated assembly code, but those can both be misleading. There's probably a debugger out there that will give you FLOPS directly.

It's important to understand that there is a theoretical maximum FLOPS value for the system you're running on, and then there is the actual achieved FLOPS of your algorithm. The ratio of these two can give you a sense of the efficiency of your algorithm. Hope this helps.

Irisshpunk
  • 683
  • 5
  • 8
  • and what about the 100 IOPS example I mentioned in the question? – Cool_Coder Mar 06 '14 at 15:40
  • As previously mentioned, "i < 100" is a flow control operation, so "++i", which expands to "i = i + 1" is the integer operation in your loop. – Irisshpunk Mar 06 '14 at 15:44
  • Just as 'i + 1' is a operation between 2 integers, 'i < 100' is also an integer operation, right? Then why is it categorised differently? – Cool_Coder Mar 06 '14 at 15:47