CFD Online Logo CFD Online URL
Home > Forums > Main CFD Forum


Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   April 24, 2003, 04:54
Default FLOPS
Posts: n/a
How to caluclate flops(floating point oprations in the fortran code. Is there any standard subroutine or functions pratap
  Reply With Quote

Old   April 25, 2003, 00:05
Default Re: FLOPS
Posts: n/a
FLOPS or Floating Operations per Second is a characteristic of your computer and not of your code.
  Reply With Quote

Old   April 25, 2003, 13:13
Default Re: FLOPS
Jim Park
Posts: n/a

If I compile my code with no optimization and measure the flop rate for a typical problem, I get a speed of n flops.

If I recompile the same code with full optimization, then measure the flop rate on the same problem, I get a speed of 2n or 3n [I'm not the best programmer : ) ].

I ran both of these on the same computer. Perhaps the flop rate can depend on several different things other than the computer?
  Reply With Quote

Old   April 25, 2003, 14:25
Default FLOPS estimate
Jim Park
Posts: n/a
You can estimate the FLOPs by estimating the number of floating point operations per cycle (time step or iteration). That generally involves

(number of nodes) x (multiplies + adds + divides + subtracts per node) + (same calculation for application of boundary conditions) is number of floating point operations per cycle. Multiply by cycles/sec (you can time this) to get FLOPs.

The Los Alamos folks suggest a simpler alternative, the 'cpu time per cell per cycle', or "grind." It's a lot easier to calculate than estimating all of the arithmetic operations.

Probably the computer science folks have made all of this precise and mathematical?
  Reply With Quote

Old   April 28, 2003, 05:16
Default Re: FLOPS
Steve Amphlett
Posts: n/a
Assuming that the previos posters have misunderstood your question...

There are no standard ways in FORTRAN or C to automatically count FLOPS. My guess is that you're trying to optimise your implementation by minimising FLOPS carried out. If this is the case, some programming environments provide really detailed profiling tools. I got this from profiling a simple floating point loop program on my Compaq system here. Note the line that says the program did 201 FLOPS.


- Steve

% cc -g program.c % pixie a.out % a.out.pixie % prof -pixstats a.out:

1088 (1.037) cycles (2.176e-06s @ 500.0MHz)

1049 (1.000) instructions

419 (0.399) interlock cycles due to basic block boundary

10 (0.010) nops

391 (0.373) alu (including logicals, shifts)

157 (0.150) logicals (including ldah and lda)

0 (0.000) shifts

0 (0.000) prefetches

185 (0.176) loads

15 (0.014) stores

200 (0.191) loads+stores

34 (0.032) load followed by load

200 (0.191) data bus use

186 (0.177) sp+gp load/stores

201 (0.192) flops (92.4 mflop/s @ 500.0MHz)

135 (0.129) conditional branches

100 (0.095) branch to branch

100 (0.095) branch to branch taken

263 (0.251) basic blocks

6 (0.006) calls

0 (0.000) skip

<plus loads more output not included>
  Reply With Quote

Old   April 29, 2003, 12:35
Default Re: FLOPS
Posts: n/a
In order to know MegaFLOPS (and other events like loads,stores and so on...) you have to instrument your code.

Take a look to:

where you can find a quit "portable" performace counter library.

Best regards, Giorgio

  Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get CPU time and flops joegi FLUENT 6 December 8, 2012 22:54
how FLOPS is calculated? gholamghar Main CFD Forum 1 February 23, 2010 11:33
FLOPS Feng Main CFD Forum 0 October 20, 2008 17:14

All times are GMT -4. The time now is 16:02.