Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What counts as a flop?

Say I have a C program that in pseudoish is:

For i=0 to 10
    x++
    a=2+x*5
next

Is the number of FLOPs for this (1 [x++] + 1 [x*5] + 1 [2+(x+5))] * 10[loop], for 30 FLOPS? I am having trouble understanding what a flop is.

Note the [...] are indicating where I am getting my counts for "operations" from.

like image 920
Joshua Enfield Avatar asked Aug 28 '10 22:08

Joshua Enfield


1 Answers

For the purposes of FLOPS measurements, usually only additions and multiplications are included. Things like divisions, reciprocals, square roots, and transcendental functions are too expensive to include as a single operation, while things like loads and stores are too trivial.

In other words, your loop body contains 2 adds and 1 multiply, so (assuming x is floating point) each loop iteration is 3 ops; if you run the loop 10 times you've done 30 ops.

Note that when measuring MIPS, your loop would be more than 3 instructions because it also includes loads and stores that the FLOPS measurement doesn't count.

like image 188
Gabe Avatar answered Sep 24 '22 17:09

Gabe