Miscellaneous > The Lounge

CPU wars

<< < (6/8) > >>

mobrien_12:
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: --- gcc -o cpuwars2 cpuwars2.c
--- End code ---


and run it like this

--- Code: ---date|cut -c 12-20;./cpuwars2;date|cut -c 12-20
--- End code ---
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]

mobrien_12:

--- 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).
--- End quote ---


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.

toadlife:

--- Quote ---%date|cut -c 12-20;./new;date|cut -c 12-20
23:14:53
03141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198
23:14:53
%

--- End quote ---

Huh? It that what it was supposed to do?

mobrien_12:
Umm  no.   Here's the output from my PC.


--- Code: ---
[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]$    

--- End code ---


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.

toadlife:
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
%

--- End quote ---


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

--- End quote ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version