Author Topic: CPU wars  (Read 3185 times)

solemnwarning

  • Member
  • **
  • Posts: 747
  • Kudos: 338
    • http://www.solemnwarning.net
Re: CPU wars
« Reply #15 on: 25 April 2006, 01:15 »
Rewrote it with help from AlexExtreme, my Athlon XP 3200+ 2.2GHz gets 986487165 floating point calculations done in 10 seconds and took 73 seconds to calculate pi to 20000 digits

[verwijderd door de beheerder]
-----BEGIN GEEK CODE BLOCK-----
 Version: 3.1
 GCS/CM d- s+:+ a--- C++ UL++++>$ P+ L+++ !E W++ !N !o !K-- w !O !M !V PS+ PE- !Y !PGP !t !5 !X !R tv b+ DI+ !D G e- h !r y-
 ------END GEEK CODE BLOCK------

H_TeXMeX_H

  • Member
  • **
  • Posts: 1,988
  • Kudos: 494
    • http://draconishinobi.50webs.com/
Re: CPU wars
« Reply #16 on: 25 April 2006, 03:02 »
Ok, here's a benchmark specifically targeted at floating point AMD vs. Intel:

http://www.queru.com/articles/Benchmarks.html

mobrien_12

  • VIP
  • Member
  • ***
  • Posts: 2,138
  • Kudos: 711
    • http://www.geocities.com/mobrien_12
Re: CPU wars
« Reply #17 on: 25 April 2006, 03:22 »
Pi...


This is a step in the right direction.  Ok, this is actually fun.  Havn't checked the pi algorithm yet, but it looks like real math.

Celeron 460 MHz with 128 KB of cache takes 328 seconds to calculate Pi .  Using level 2 optimization on GCC cuts this to 182 seconds.  
 
My advice:  just drop the looping (it really is meaningless), and add some more real life problems.  I'd love to see the performance comparisons between people boxes, both with no optimization and -O2 flags.
In brightest day, in darkest night, no evil shall escape my sight....

toadlife

  • Member
  • **
  • Posts: 730
  • Kudos: 376
    • http://toadlife.net
Re: CPU wars
« Reply #18 on: 25 April 2006, 03:35 »
My new Athlon64 3000+ machine at work. FreeBSD 6.1-RC1/i386

Quote
%./a.out
Starting floating-point benchmark...
This system has calculated 1052454527 floating-point calculations in 10 seconds
Starting pi benchmark...
This system took 80 seconds to calculate pi to 20000 digits
%

I'll do my Athlon64 X2 4400+ system when I get home. :)
:)

H_TeXMeX_H

  • Member
  • **
  • Posts: 1,988
  • Kudos: 494
    • http://draconishinobi.50webs.com/
Re: CPU wars
« Reply #19 on: 25 April 2006, 04:29 »
Hmmm ... how do I compile it ? (I know it's a stupid question, but unless it's got a makefile, I have no clue)

toadlife

  • Member
  • **
  • Posts: 730
  • Kudos: 376
    • http://toadlife.net
Re: CPU wars
« Reply #20 on: 25 April 2006, 06:49 »
Quote from: H_TeXMeX_H
Hmmm ... how do I compile it ? (I know it's a stupid question, but unless it's got a makefile, I have no clue)

I was stuck on that too, but made an edumacated guess and got it.  All you have to do is type this at the command line (assuming the file is in your PWD)....


Code: [Select]
%cc ./benchmark.c

The the file will be compiled. The resulting binary should be called "a.out".

After that just execute "a.out" to run the benchmark.
:)

toadlife

  • Member
  • **
  • Posts: 730
  • Kudos: 376
    • http://toadlife.net
Re: CPU wars
« Reply #21 on: 25 April 2006, 07:06 »
Okay, here is my Dual Core 4400+

Quote
%./a.out
Starting floating-point benchmark...
This system has calculated 1296222130 floating-point calculations in 10 seconds
Starting pi benchmark...
This system took 65 seconds to calculate pi to 20000 digits


And here it is, two at the same time... (dual core rocks!)
Quote
%./a.out & && ./a.out &
[1] 967
[2] 968
Starting floating-point benchmark...
%Starting floating-point benchmark...

%This system has calculated 1251545160 floating-point calculations in 10 seconds
Starting pi benchmark...
This system has calculated 1212464935 floating-point calculations in 10 seconds
Starting pi benchmark...
This system took 66 seconds to calculate pi to 20000 digits
This system took 67 seconds to calculate pi to 20000 digits

[2]    Done                          ./a.out
[1]  + Done                          ./a.out
:)

solemnwarning

  • Member
  • **
  • Posts: 747
  • Kudos: 338
    • http://www.solemnwarning.net
Re: CPU wars
« Reply #22 on: 25 April 2006, 15:08 »
It has the compile command in a comment at the start of the file :\
-----BEGIN GEEK CODE BLOCK-----
 Version: 3.1
 GCS/CM d- s+:+ a--- C++ UL++++>$ P+ L+++ !E W++ !N !o !K-- w !O !M !V PS+ PE- !Y !PGP !t !5 !X !R tv b+ DI+ !D G e- h !r y-
 ------END GEEK CODE BLOCK------

H_TeXMeX_H

  • Member
  • **
  • Posts: 1,988
  • Kudos: 494
    • http://draconishinobi.50webs.com/
Re: CPU wars
« Reply #23 on: 25 April 2006, 22:15 »
Thanks for the instructions toadlife ... the "gcc -Wall cpuwars.c cpuwars.o" didn't seem to work ...

here are the results for my laptop's 2.8 Ghz P4 (no HT) ... kinda funny how the floating point is half that of toadlife's AMD, but the pi calculation time is pretty close (4-5 sec).

Code: [Select]
[Draconishinobi@knoppix Downloads]$ ./a.out
Starting floating-point benchmark...
This system has calculated 620565563 floating-point calculations in 10 seconds
Starting pi benchmark...
This system took 72 seconds to calculate pi to 20000 digits
[Draconishinobi@knoppix Downloads]$ ./a.out
Starting floating-point benchmark...
This system has calculated 639032963 floating-point calculations in 10 seconds
Starting pi benchmark...
This system took 71 seconds to calculate pi to 20000 digits
[Draconishinobi@knoppix Downloads]$ ./a.out
Starting floating-point benchmark...
This system has calculated 638959711 floating-point calculations in 10 seconds
Starting pi benchmark...
This system took 72 seconds to calculate pi to 20000 digits
[Draconishinobi@knoppix Downloads]$

piratePenguin

  • VIP
  • Member
  • ***
  • Posts: 3,027
  • Kudos: 775
    • http://piratepenguin.is-a-geek.com/~declan/
Re: CPU wars
« Reply #24 on: 26 April 2006, 01:09 »
Quote from: H_TeXMeX_H
Thanks for the instructions toadlife ... the "gcc -Wall cpuwars.c cpuwars.o" didn't seem to work ...
gcc -Wall -o cpuwars.o cpuwars.c
"What you share with the world is what it keeps of you."
 - Noah And The Whale: Give a little love



a poem by my computer, Macintosh Vigilante
Macintosh amends a damned around the requested typewriter. Macintosh urges a scarce design. Macintosh postulates an autobiography. Macintosh tolls the solo variant. Why does a winter audience delay macintosh? The maker tosses macintosh. Beneath female suffers a double scum. How will a rat cube the heavier cricket? Macintosh calls a method. Can macintosh nest opposite the headache? Macintosh ties the wrong fairy. When can macintosh stem the land gang? Female aborts underneath macintosh. Inside macintosh waffles female. Next to macintosh worries a well.

mobrien_12

  • VIP
  • Member
  • ***
  • Posts: 2,138
  • Kudos: 711
    • http://www.geocities.com/mobrien_12
Re: CPU wars
« Reply #25 on: 26 April 2006, 02:41 »
Pentium M 1.86 GHz 2MB Cache 533 MHz FSB

Cygwin under Windows XP

Pi calculation 42 seconds.  23 seconds with -O2 calculation...

Wierd... Looks like we need to look at the algorithm, make sure it actually does calculate Pi.  Maybe timers don't work on Cygwin either....

UPDATE: Yes the algorithm is correct.   Here's the original source code: spigot algorithm for the Digits of  \pi, Stanley Rabinowitz and Stan Wagon, Amer.Math.Monthly, March 1995, 195-203 soft version at http://paul.rutgers.edu/~rhoads/Code/pi2.c

Here's an updated version without the looping stuff and restructured a little.

I suggest you compile it with
Code: [Select]
gcc -o cpuwars2 cpuwars2.c

and run it like this
Code: [Select]
date|cut -c 12-20;./cpuwars2;date|cut -c 12-20 so you can compare the system clock with the program report... of course the system clock will always be longer because of overhead, but if it's a factor of 2 then something is wrong with the timer functions.

And raise the number of iterations back up... I cut it down but I don't wanna re-upload.

[verwijderd door de beheerder]
In brightest day, in darkest night, no evil shall escape my sight....

mobrien_12

  • VIP
  • Member
  • ***
  • Posts: 2,138
  • Kudos: 711
    • http://www.geocities.com/mobrien_12
Re: CPU wars
« Reply #26 on: 26 April 2006, 02:53 »
Quote from: H_TeXMeX_H
... kinda funny how the floating point is half that of toadlife's AMD, but the pi calculation time is pretty close (4-5 sec).


Like I've been saying, the "floating point calculation" is bogus.    If you optimize it with -O2 on the latest code, it will return 0.  On Cygwin it returned an insanely large number, like ten times what the rest of you had.

You test a tool by using it for what it was made for.  Calculate Pi.  Invert a matrix.  Fourier transform.  Wavelet transform.  Calculate prime numbers.
In brightest day, in darkest night, no evil shall escape my sight....

toadlife

  • Member
  • **
  • Posts: 730
  • Kudos: 376
    • http://toadlife.net
Re: CPU wars
« Reply #27 on: 7 May 2006, 08:16 »
Quote
%date|cut -c 12-20;./new;date|cut -c 12-20
23:14:53
03141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198
23:14:53
%

Huh? It that what it was supposed to do?
:)

mobrien_12

  • VIP
  • Member
  • ***
  • Posts: 2,138
  • Kudos: 711
    • http://www.geocities.com/mobrien_12
CPU wars
« Reply #28 on: 7 May 2006, 08:40 »
Umm  no.   Here's the output from my PC.

Code: [Select]

[mobrien@hariel temp]$ date|cut -c 12-20;./a.out;date|cut -c 12-20
00:34:23
Starting pi benchmark...
This system took 32 seconds to calculate pi to 6000 digits
00:34:55
[mobrien@hariel temp]$    


If you compiled the original code, you would get the whole output.  The idea that solemnwarning came up with  (a good one) was to remove the screen output because that slows everything down, while keeping all the number crunching.  My version just has the original code commented out instead of erased, so one can uncomment it and see that Pi is actually being calculated.
In brightest day, in darkest night, no evil shall escape my sight....

toadlife

  • Member
  • **
  • Posts: 730
  • Kudos: 376
    • http://toadlife.net
Re: CPU wars
« Reply #29 on: 7 May 2006, 10:39 »
oh, duhhh. I compiled the original code.

Here is it...

Athlon64 X2 4400 (2.2Ghz)
Quote
%date|cut -c 12-20;./cpuwars2;date|cut -c 12-20
01:33:56
Starting pi benchmark...
This system took 13 seconds to calculate pi to 6000 digits
01:34:09
%


And two at a time...

Quote
%./cpuwars2&;./cpuwars2&
[1] 926
[2] 927
%Starting pi benchmark...
Starting pi benchmark...
This system took 14 seconds to calculate pi to 6000 digits
This system took 14 seconds to calculate pi to 6000 digits

[2]    Exit 59                       ./cpuwars2
[1]  + Exit 59                       ./cpuwars2
:)