Re: flop counter
- From: "Arjen Markus" <arjen.markus@xxxxxxxxxx>
- Date: 8 Jan 2007 05:02:51 -0800
Pietro schreef:
Richard Maine ha scritto:
Pietro <nvidiaus@xxxxxxxxx> wrote:
is there any free routine that counts flop in a fortran program run?
I don't off-hand know. Might be, but I'm posting to give one caveat...
I haven't seen much about flops "recently" (in the last decade or so). I
believe that most of the reason is that flops just aren't very relevant
to today's machines. It used to be that flops were at least a half
reasonable unit of computational cost; they were never a great one, but
were at least half reasonable. Flops per second was a widely cited unit
of speed, and minimizing flops was a goal for algorithm efficiency.
However, flops just are so poor a measure today that they aren't much
used any more... or at least if they are used, they manage to escape
much attention. Floatting point operations just aren't usually the
performance determiner. Things like memory bandwidth tend to be a much
bigger issue, even for number-crunching codes.
So if that's why you want to count flops, be aware that they probably
aren't very good for the purpose today.
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
well, if your point is "a flop now takes so few time compared to moving
data between cpu and ram so it's not so interesting to measure
performance by counting flop" then i agree.
but my aim is at comparing theoretical flop number of certain
algorithms with the real one used in MY implementatoin of those
algorithms just to know if i'm doing extra-non-ncessary work.
If that is your aim, then you might do something like the following:
module flop_counting
integer, save :: count_multiplications = 0
integer, save :: count_divisions = 0
...
type flop
real :: value
end type
interface operator(*)
module procedure mult
end interface
...
contains
function mult( x, y ) result(r)
type(flop), intent(in) :: x, y
type(flop) :: r
r%value = x%value * y%value
count_multiplications = count_multiplications + 1
end function mult
...
end module
program test
type(flop) :: x, y
integer :: i
x%value = 1.0; y = x
do i = 1,10
x = x * y
enddo
wrtite(*,*) 'Counted multiplications:', count_multiplications
end program
It will take some repetitive code (all arithmetic operations for
scalars,
for one-dimensional arrays, for two-dimensional ones etc (*)) depending
on what your algorithms are exactly, but it will be completely portable
(*) I have not checked, but I do not think you can use elemental
functions here - because of the update of a "global" variable.
Regards,
Arjen
.
- References:
- Re: flop counter
- From: Pietro
- Re: flop counter
- Prev by Date: Re: TRANSFER Function on pgf95 6.2-5 64-bit
- Next by Date: Re: flop counter
- Previous by thread: Re: flop counter
- Next by thread: Re: flop counter
- Index(es):
Relevant Pages
|
|