Calculating Floating point Operations Per Second(FLOPS) and Integer Operations Per Second(IOPS)

Question Detail: 

I am trying to learn some basic benchmarking. I have a loop in my Java program like,

float a=6.5f; int b=3;     for(long j=0; j<999999999; j++){                    var = a*b+(a/b);     }//end of for 

My processor takes around 0.431635 second to process this. How would I calculate processor speed in terms of Flops(Floating point Operations Per Second) and Iops(Integer Operations Per Second)? Can you provide explanations with some steps?

PS:I have already asked this question in StackExchange but did not get any answer.

Asked By : Prasanna
Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/9144

Answered By : Yuval Filmus

It really depends on the optimizer. If you compile it with optimization, it might get rid of the loop, and then it will take rather less than 0.431635 seconds. Otherwise, it seems like you have four to five floating point instructions per iteration (including int to float conversion, once or twice, depending on the optimizer), so $4\cdot10^9$ or $5\cdot10^9$ in total. Divide this by 0.431635 to get your FLOPS, which will be around $10^{10}$, or 10 GFLOPS.

No comments

Powered by Blogger.