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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With