# how to calculate #Gflop/sec?

Is there any existing facility to print out the #Gflop/sec of one program? If not, how to calculate it manully?

Thanks!

There’s no facility to calculate this automatically. Count the number of floating point operations in your kernel and divide by the execution time.

I spent last night making a source to do this, is quite simple but i was confused with the measure of time that machine used.

here is the code, made in fortran 90 (yesterday i get the c compiler and start to play with the video card , but i made the source in fortran to test it first).

based in this definition (http://www.keil.com/support/docs/1476.htm) i make the code above.

program flops

``````implicit none
``````

!

! variables

!

integer, parameter :: n=100000001

double precision, dimension(n) :: a,b,som

integer :: i

character(7) :: tim

integer*4 , dimension(n) :: iseed

real*4 ::var =0.

integer :: count, count_rate, count_max

!

! body

!

count_rate = 1

call system_clock(count,count_rate,count_max)

print *,count

do i=1,n

``````iseed(i) = secnds(var)

iseed(i) = iseed(i) + mod(iseed(i),2) + 1

a(i) = ran(iseed(i))

b(i) = ran(iseed(i))

som(i) = a(i) *b(i)
``````

end do

call system_clock(count,count_rate,count_max)

print *,count

end program

the program works fine, but the time give by the function System_clock is very strange, and i don’t know how to interpret it. Nevertheless, i’m making the same code to C++, and for now i have a few problems with the random number generator (how to use it), if some one knows how to do that srand(), or rand() works nicely will be great.

ps: sorry for the english, without revision of a expert this time.