Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: cekim@ix.netcom.com
To: cekim@ix.netcom.com
Subject: Re: gcc vs Dec Unix c
Date: 1998/01/15	[thread overview]
Message-ID: <884822368.1629749263@dejanews.com> (raw)
In-Reply-To: 69h5rc$5bl$1@wombat.cs.monash.edu.au


In article <69h5rc$5bl$1@wombat.cs.monash.edu.au>,
  bmeyer@bruce.cs.monash.edu.au wrote:
>
> cekim@ix.netcom.com writes:
> >PPRO 200 w/cos =10 minutes -120 billion cycles
> >ALpha 533 w/cos =65 minutes -2.08 trillion cycles
> [...]
> >I asked the loop to run 1 billion times so I have rougly [2000 ALPHA] cycles
> >per loop given the number above for the PPRO.
>
> I find this result confusing. I just tried the following program on
> my ALPHA:
>
> ==========
> #include <stdio.h>
> #include <math.h>
>
> int main(int argc, char** argv)
> {
>   double a,b,c;
>   long count;
>
>   a=2; b=3; c=4;
>
>   for (count=0;count<10000000;count++) {
>     a=cos(a)/b+c/a;
>   }
>   printf("Answer is %f\n",a);
> }
> ==========
>
> Once with and once without the cos (i.e.  "a=a/b+c/a;"). The difference
> in exacution time was about 4.5 seconds on my 433MHz ALPHA, or roughly
> 2 billion cycles. However, the ALPHA calculated TEN million cosines
> in that time, for only 200 (two HUNDRED) cycles per cosine.
>
> Is it possible you timed your stuff using "time", and have an old and
> broken version of time? Or that you may have fallen victim to the
> 1:10 difference in HZ between linux/Intel and linux/ALPHA?
>
> >I am very curious now, I would like to hunt through the code and see if
> >there is an FCOS in there.  I would hope there is.
>
> There certainly is one if I compile the above on Intel, using gcc -O6.
>
> Bernie
> --
> ============================================================================
> "It's a magical world, Hobbes ol' buddy...
>     	                                   ...let's go exploring"
> Calvin's final words, on December 31st, 1995

hmmm....

No, time() is not to blame as I could see from the clock that
it took an hour!!

Mr. Harley's answre also sheds some light here:

You are computing "a" as a=cos(a)/Eq(see above)/a

This makes a very small number (quick math, shoot me if
I am wrong :))

a=cos(small)/big/small OR a=cos(a)/(Really big) =>
small exponent in sci/ieee notation

(ie: fp hardware activity of exponent crunching minimized!!)

According to Mr. Harley, this will execute significantly
faster than "large" number, which I take to mean large
exponent in floating point calculation.

Disaggreements, clarifications, I did not spend any more
time thinking about this than writing, but it seems clear to me.

BTW:
changing me initial equation:
A=A+constant>1;
B=B+constant>1;
C=Cos(b)+a;

To multiply A and B by fractional numbers (ie: small exponent),
reduces execution time down to 2.5 minutes from 65 minutes,
thus verifying Mr. Harley's statement.
A=A*constant<1;
B=B*constant<1;
C=Cos(b)+a;

/Mike

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet



  reply	other threads:[~1998-01-15  5:00 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-01-08  5:00 gcc vs Dec Unix c fonte
1998-01-09  5:00 ` Toon Moene
1998-01-09  5:00 ` Toon Moene
1998-01-09  5:00 ` Jaap Schellekens
1998-01-09  5:00   ` cekim
1998-01-09  5:00     ` Peter Mardahl
1998-01-09  5:00       ` Craig Burley
1998-01-10  5:00       ` cekim
1998-01-10  5:00         ` Craig Burley
1998-01-13  5:00           ` cekim
1998-01-13  5:00             ` Craig Burley
1998-01-13  5:00               ` [++] x86 FCOS (Was: Re: gcc vs Dec Unix c) Terje Mathisen
1998-01-13  5:00                 ` Andy Glew
1998-01-14  5:00                   ` Terje Mathisen
1998-01-13  5:00               ` gcc vs Dec Unix c James Van Buskirk
1998-01-14  5:00                 ` brianh
1998-01-14  5:00                   ` James Van Buskirk
1998-01-13  5:00             ` Yan-Song Chen
1998-01-13  5:00               ` Greg Lindahl
1998-01-15  5:00               ` Lupo LeBoucher
1998-01-15  5:00                 ` Greg Lindahl
1998-01-13  5:00             ` Rob Komar
1998-01-14  5:00             ` bmeyer
1998-01-15  5:00               ` cekim [this message]
1998-01-14  5:00     ` Donald K.Sinclair
1998-01-14  5:00       ` Rob Komar
1998-01-16  5:00         ` Torbjorn Lindgren
1998-01-17  5:00           ` Rob Komar
1998-01-14  5:00       ` cekim
1998-01-09  5:00 ` Toon Moene
  -- strict thread matches above, loose matches on Subject: below --
1998-01-13  5:00 Robert Harley
1998-01-14  5:00 ` cekim
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox