Miscellaneous > The Lounge
CPU wars
H_TeXMeX_H:
--- Quote ---[Draconishinobi@livecd Downloads]$ gcc -Wall -o cpuwars.o cpuwars.c cpuwars.c: In function
--- End quote ---
mobrien_12:
the main() structure has a variable called totaldigits
it's set to 6000 because I wanted to play around with the code and wanted it to execute fast.
20000 would be a better test. Time taken seems to be non linear with digits.
TeXMeX, the cc and gcc do the same thing on a linux system.
The -Wall just show warnings. You really don't need it because it's a simple program. If anyone knows how to get rid of the warning, please tellme.
-O2 will optimize to level 2 and speed the code execution up.
-march= will optimize the code specifically for your processor. For example
gcc -march=i686 -O2 -o cpuwars2 cpuwars2.c
should theoretically produce the fastest running binary for an i686 architecture.
Comparisons for optimization levels should probably be done and different totaldigits...
Remember, your cpu cache is very important for floating point calculations. A fast CPU with a small cache can be outperformed by a slower cpu with a large cache. If you know what it is, post it.
H_TeXMeX_H:
Yup, :D
--- Quote ---[Draconishinobi@livecd Downloads]$ gcc -O2 -Wall -o cpuwars2.o cpuwars2.c cpuwars2.c: In function
--- End quote ---
mobrien_12:
Very cool
And interestingly enough, your system clock and the cpu time agree completely. It actually did take 37 seconds to grind thorugh 20000 digits of Pi.
H_TeXMeX_H:
Hmmm ... could it be that some systems calculate smaller numbers of digits of pi faster than others, but then slow down as the numbers of digits increases ? So then how many digits of pi would be a useful benchmark for all systems ? Or would a graph of times at all numbers of digits be more useful ?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version