From: hblim@iti.gov.sg (Hock-Beng Lim)
Subject: Counting number of MFLOPs
Organization: Information Technology Institute, National Computer Board, Singapore.
Date: Mon, 16 Nov 1992 03:34:10 GMT

Hi !

Here are the responses I have received regarding my query on the accepted
ways to count MFLOPs in applications.

HB
--------------------------------------------------------------------------
From: schreiber@schreiber.asd.sgi.com (Olivier Schreiber)
Message-Id: <9211111829.AA03875@schreiber.asd.sgi.com>
To: hblim@iti.gov.sg
Subject: Re: Counting number of MFLOPS
Newsgroups: comp.benchmarks
Status: RO


I had posted a similar inquiry a while back. Here's what I got.
Thanks for posting the results of your enquiry.

>From: csrdh@manta.jcu.edu.au (Rowan Hughes)
Message-Id: <9205290324.AA04971@manta.jcu.edu.au>
To: schreiber
Subject: Re: How are Floating Point operations counted?
Newsgroups: comp.benchmarks
Status: RO

In comp.benchmarks you write:
>Is there an accepted way industry-wide of counting floating point
>operations or a definition of what a floating point operation is
>for FP benchmark purposes?
>How many FPO is x=y*z ?
>or x=sqrt(y)*sin(z)?
>How do most vendors measure MFLOP rates on general user programs?

The accepted way (for Crays, etc.) is to count each of *,+,- as one
flop. Generally there should be the same number of *'s as + and -.
If not, you should state that there were few *'s. Division is 
usually not used, since it can usually be eliminated, and turned
into a *. Division time is quoted as a multilple of * time, eg
4 times longer. Intrinsic functions are not usually counted
(sin cos log etc.). Don't use benchmarks with these in them.
The most useful vector benchmark is the DAXPY (REAL*8)

   do i=1,n
   y(i)=a*x(i)+y(i)
   enddo

n should be very large (i.e. 5,000,000); much larger than the cache
size.  Each iteration counts as 2 flops, * and + are equal in number.
SAXPY is the real*4 equivalent. The Cray YMP does 289Mflops on one
processor for DAXPY. The memory bandwidth, in Mb/sec, is 12 times this.
number (3500 Mb/sec). Another name for DAXPY is the linked triad.

-- 
Rowan Hughes                                James Cook University
Marine Modelling Unit                       Townsville, Australia.
Dept. Civil and Systems Engineering         csrdh@marlin.jcu.edu.au


>From schreiber  Mon Jun  1 11:07:36 1992
Received: by schreiber.asd.sgi.com (920110.SGI/911001.SGI)
	for schreiber id AA11352; Mon, 1 Jun 92 11:07:36 -0700
Date: Mon, 1 Jun 92 11:07:36 -0700
From: schreiber (Olivier Schreiber)
Message-Id: <9206011807.AA11352@schreiber.asd.sgi.com>
To: schreiber
Subject: flops
Status: RO

In article <lc5k6ro@fido.asd.sgi.com> schreiber@schreiber.asd.sgi.com (Olivier Schreiber) writes:
>Is there an accepted way industry-wide of counting floating point
>operations or a definition of what a floating point operation is
>for FP benchmark purposes?

No. There are several different "standard" approaches. One is to take the
known number of floating point operations for a given size of the Linpack
benchmark, time the number of seconds it takes to execute on a system,
then divide the first number by the second to get Linpack MFLOPS. This
gives the most commonly reported "MFLOPS" number in the workstation world.
This can be done for single and double precision to produce single and
double precision Linpack MFLOPS numbers.

The authors of the Livermore Loops developed a normalizing formula that can
be used on codes that are more complex than Linpack (i.e. that do a lot more
than adds, subtracts and multiplies.)  They count floating point operations
as follows: (taken from page 43 of Hennessy and Patterson)

Real FP Operations                Normalized FP operations
------------------                ------------------------
ADD,SUB,COMPARE,MULT                         1
DIVIDE,SQRT                                  4
EXP,SIN,COS,TAN,....                         8



>
>How many FPO is x=y*z ?
>or x=sqrt(y)*sin(z)?

x=y*z is one FLOP.
x=sqrt(y)*sin(z) is 3 FLOPs unnormalized, 13 FLOPs normalized by the Livermore
method shown above.

>How do most vendors measure MFLOP rates on general user programs?

I don't know that they do.  Certainly there is no "standard" for this; even
in the more controlled world of benchmarking, there is some variation, as
you can see.

BTW, based on the Livermore normalizing table above, a MULTIPLY-and-ADD
instruction is 2 FLOPs, which makes sense.  Some posters in the past have
tried to claim that a maultiply and accumulate instruction is only 1 FLOP,
which makes no sense at all, although they claim from memory that that
was the "original" definition of a FLOP back in the Dark Ages (and then
no reference for this claim is ever produced.)



-- 
-----------------------------------------------------------------------------
"It is seldom that any liberty is lost all at once." David Hume
|||  clc5q@virginia.edu (Clark L. Coleman)

>From comp.benchmarks Tue Jun  2 13:55:05 1992