From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,b79a29863eb727e7 X-Google-Attributes: gid111c93,public From: cekim@ix.netcom.com Subject: Re: gcc vs Dec Unix c Date: 1998/01/15 Message-ID: <884822368.1629749263@dejanews.com>#1/1 X-Deja-AN: 316100523 References: <694nm1$74c$1@news2.xs4all.nl> <884364975.2133262340@dejanews.com> <695t9e$kft$1@agate.berkeley.edu> <884411893.151322629@dejanews.com> <884563899.2019688456@dejanews.com> <69h5rc$5bl$1@wombat.cs.monash.edu.au> X-Originating-IP-Addr: 207.93.163.71 (nas-nh3-07.ix.netcom.com) X-Authenticated-Sender: cekim@ix.netcom.com To: cekim@ix.netcom.com X-Http-User-Agent: Mozilla/4.04 [en] (X11; I; Linux 2.0.32 i686) Organization: Deja News Posting Service X-Article-Creation-Date: Wed Jan 14 23:59:29 1998 GMT Newsgroups: comp.os.linux.alpha 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 > #include > > 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