Fedora Linux Support Community & Resources Center
  #31  
Old 27th January 2009, 11:42 PM
RupertPupkin's Avatar
RupertPupkin Offline
Registered User
 
Join Date: Nov 2006
Location: Detroit
Posts: 4,617
Well, so far it looks like we can conclude:
  1. For large integer arithmetic, 64-bit > 32-bit.
  2. For large integer arithmetic, AMD > Intel.
  3. sideways likes to find ways to cheat. Good man.
  4. bee needs faster hamsters in his PC

Last edited by RupertPupkin; 27th January 2009 at 11:52 PM.
Reply With Quote
  #32  
Old 27th January 2009, 11:52 PM
bee Offline
Banned
 
Join Date: Jun 2008
Posts: 1,315
Quote:
Originally Posted by RupertPupkin View Post
Dude, that's not a foot pump...that's your mouse!
ahahahah
very funny!!! i must think you're right
I could feel like those people that are using a cd try as coffee cup holder but, ok, i will just say that my hamsters are the guilty

bye!!!
Reply With Quote
  #33  
Old 28th January 2009, 12:09 AM
stevea's Avatar
stevea Offline
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,300
A few points worth considering ...

The AMD architecture hsa for some time crushed on mem bandwidth, to that part isn't surprising (i7 may spoil the magic sauce).

Sideways broke the code - this calculation is trivial - can easily and rapidly be done in a shell script EXCEPT the decimal representation.

Sideways result contains a large fraction of disk I/O time, so if you ">/dev/null" or comment out the print altogether (as per Shunk) you'll see a substantial improvement.

So the original test is primarily consumed with dividing a multi-precision by 10 and remainding nearly 13 million times (actually you can pull ~8 digits per divide (or even more for 64bit ints) so perhaps only 1.5 mill divides or less.

OK so the puzzling thing is that if you dbl the number of bits then you be able to extract the decimal representation more tha n2x as fast ... more like 2/ln(2) IIUC. So either the memory bandwidth dominates or the conversion to decimal in libgmp is suboptimal.

Last edited by stevea; 28th January 2009 at 12:34 AM.
Reply With Quote
  #34  
Old 28th January 2009, 12:26 AM
sideways's Avatar
sideways Offline
Retired User
 
Join Date: Oct 2004
Location: London, UK
Posts: 4,999
Quote:
Originally Posted by stevea View Post
A few points worth considering ...
Sideways result contains a large fraction of disk I/O time, so if you ">/dev/null" or comment out the print altogether (as per Shunk) you'll see a substantial improvement.

So the original test is primarily consumed with dividing a multi-precision by 10 and remainding nearly 13 million times (actually you can pull ~8 digits per divide so perhaps only 1.5 mill divides.
The disk I/O is negligible, calculate the result in base 2 and you still get a 42Mb file generated in ~ 1 sec.

If you raise 3 to the same power (just replace 2 by 3 everywhere in the source-code) the result is not binary friendly (ie it's not a sequence of repeating characters) but the base 16, 8, 4, 2 etc output is still very fast (though not quite so fast)

Converting to other bases like 11, 13 etc is similar in performance to base 10. So maybe humans should have discounted thumbs and learnt to use base 8, then we'd be more in sync with computers

But clearly 64 bit is much faster for this stuff, at least on pcs, there's an article on the gmp homepage where they look at a counterexample on an ultrasparc and discredit it.

They also claim "GMP is faster than any other bignum library". But how do they know what the Intelligence Services around the world are using? eh
Reply With Quote
  #35  
Old 28th January 2009, 12:52 AM
igla Offline
Registered User
 
Join Date: Aug 2007
Posts: 27
Fedora 10 x86_64
Intel Q2Q6600

Quote:
real 0m26.196s
user 0m26.032s
sys 0m0.108s
Reply With Quote
  #36  
Old 28th January 2009, 01:29 AM
stevea's Avatar
stevea Offline
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,300
Quote:
Originally Posted by sideways View Post
The disk I/O is negligible, calculate the result in base 2 and you still get a 42Mb file generated in ~ 1 sec.
Wrong ! The disk I/O is a considerable fraction of the hex version time
# time ./mersenne-hex 43112609 > /other/M46
real 0m0.110s
user 0m0.042s
sys 0m0.067s
# time ./mersenne-hex 43112609 > /dev/null
real 0m0.060s
user 0m0.046s
sys 0m0.014s

The big(ger) sys time is a dead give-away.

Quote:
If you raise 3 to the same power (just replace 2 by 3 everywhere in the source-code) the result is not binary friendly (ie it's not a sequence of repeating characters) but the base 16, 8, 4, 2 etc output is still very fast (though not quite so fast)
Right - agreed, but this is only b/c the Gnu multi-precision package uses a binary representation internally instead of a selectable base (some power of 3 for this example). Actually the ancient and strangely attractive APL interpreted used to be able to delay calculation and leave operations in an internal symbolic representation UNTIL the evaluation of a particular term was required. At that point it would try to optimized the calculation (often that meant just calculating the required portions of a matrix .. but other more complex opeations too).

Anyway that sort of delayed optimization could usefully be applied if we intended to calculate x^y - 1 and represent this in base b a lot.


Quote:
Converting to other bases like 11, 13 etc is similar in performance to base 10. So maybe humans should have discounted thumbs and learnt to use base 8, then we'd be more in sync with computers
Or perhaps we should only have considered our thumbs and begun with base 2
((Actually that's too few symbols for our arithmetic alphabet, and would make for excessively long strings))


Quote:
But clearly 64 bit is much faster for this stuff, at least on pcs, there's an article on the gmp homepage where they look at a counterexample on an ultrasparc and discredit it.

They also claim "GMP is faster than any other bignum library". But how do they know what the Intelligence Services around the world are using? eh
GMP has been around for a long time and it is impressive. I've used pari-gp ((a calculator based on gmp)) for a number of years and it's really hand when it's called for. Actually you can perform Rupert's Mersenne calc in one line of pari *BUT* the pari I have is based on a buggy older gmp that has a bug above several million digits.

Last edited by stevea; 28th January 2009 at 01:33 AM.
Reply With Quote
  #37  
Old 29th January 2009, 01:41 AM
Jake's Avatar
Jake Offline
Registered User
 
Join Date: Oct 2008
Location: England, Lincolnshire
Posts: 1,576
My Computer is damn slow.. but not slow considering it's age (2005)

[Jake@localhost Desktop]$ time ./mersenne 43112609 > M46

real 0m21.928s
user 0m20.241s
sys 0m0.279s
[Jake@localhost Desktop]$

2.0GHz AMD 64 Single core.

Though my machine is mainly used for compiling and virtual machines..

Also on a re-check:

[Jake@localhost Desktop]$ time ./mersenne 43112609 > M46

real 0m20.909s
user 0m20.207s
sys 0m0.311s
[Jake@localhost Desktop]$
__________________
Fedora user since FC6.
Linux user since 2003.
Registered Linux ID: #456478
OS: Fedora 16 x86_64

Last edited by Jake; 29th January 2009 at 01:46 AM.
Reply With Quote
  #38  
Old 30th January 2009, 12:59 PM
YeOK's Avatar
YeOK Offline
Registered User
 
Join Date: Apr 2006
Location: North West UK.
Age: 32
Posts: 510
hmm..

I run this test before here.

I installed 2.6.29-0.6.rc3.fc10.x86_64 kernel from koji and out of pure interest thought I'd run this test again.

Quote:
time ./mersenne 43112609 > M46

real 0m11.958s
user 0m11.863s
sys 0m0.073s
Anyone else with the updated kernel get a better time?
__________________
He who asks a question is a fool for a minute; he who does not remains a fool forever.
Reply With Quote
  #39  
Old 31st January 2009, 02:44 AM
RupertPupkin's Avatar
RupertPupkin Offline
Registered User
 
Join Date: Nov 2006
Location: Detroit
Posts: 4,617
Quote:
Originally Posted by YeOK View Post
I run this test before here.

I installed 2.6.29-0.6.rc3.fc10.x86_64 kernel from koji and out of pure interest thought I'd run this test again.
Code:
time ./mersenne 43112609 > M46

real 0m11.958s
user 0m11.863s
sys 0m0.073s
I think your new result is still within the usual amount of deviation when running multiple times. The improvement is only 0.383 seconds. My guess is that a new version of gmp[-devel] would probably have more of an impact than a slightly newer kernel.
Reply With Quote
  #40  
Old 5th February 2009, 08:56 PM
sonoran's Avatar
sonoran Online
Registered User
 
Join Date: May 2005
Location: Sonoran Desert
Posts: 2,105
Interesting post!

[pcg@localhost ~]$ time ./mersenne 43112609 > M46

real 0m21.769s
user 0m21.270s
sys 0m0.177s

Hardware:

AMD 64 3000+
Gigabyte GA-K8NSC-939 mobo
2 gig

(circa 2005, but still in the race!)
Reply With Quote
  #41  
Old 5th February 2009, 11:02 PM
pete_1967 Online
Clueless in a Cuckooland
 
Join Date: Mar 2006
Location: Here now, elsewhere tomorrow.
Posts: 3,929
Quote:
Temp]$ time ./mersenne 43112609 > M46

real 0m14.523s
user 0m14.417s
sys 0m0.091s
Specs in sig
__________________
A Drink is Not Just For Christmas - SaskyCom :thumb:


“Give a man a fish; you have fed him for today. Teach a man to fish; and you have fed him for a lifetime” so now go and...
RTFM FIRST: http://docs.fedoraproject.org/ & http://rute.2038bug.com/index.html.gz
Reply With Quote
  #42  
Old 7th February 2009, 04:03 PM
got_root Offline
Registered User
 
Join Date: Jan 2009
Location: Switzerland
Posts: 8
Code:
[root@xps Desktop]# time ./mersenne 43112609 > M46

real	0m46.366s
user	0m45.820s
sys	0m0.402s
pretty bad for a Core2Due T7500 @ 2.2GHz with 4GB Ram right?

I took a look at the SystemMonitor and saw that only one core runs at 100% during the test. The other is @ 5% or so.

Is this normal or what?
Reply With Quote
  #43  
Old 7th February 2009, 04:23 PM
skolnick Offline
Registered User
 
Join Date: Nov 2007
Posts: 108
Statistics for my PC: (AMD 5600+ with CPU throttling enabled and 2GB RAM, running Fedora 8 32 bits)

Code:
[gpulido@hades ~]$ time ./mersenne 43112609 > M46

real    0m30.914s
user    0m29.247s
sys     0m0.367s
[gpulido@hades ~]$ uname -a
Linux hades.localdomain.local 2.6.26.8-57.fc8 #1 SMP Thu Dec 18 19:19:45 EST 2008 i686 athlon i386 GNU/Linux
[gpulido@hades ~]$
Quote:
I took a look at the SystemMonitor and saw that only one core runs at 100% during the test. The other is @ 5% or so.

Is this normal or what?
i think this is normal, since the program seems to be single-threaded.

Regards.
Reply With Quote
  #44  
Old 7th February 2009, 05:03 PM
messner's Avatar
messner Offline
Registered User
 
Join Date: Dec 2004
Location: Slovenia
Posts: 80
Quote:
mersenne.c:3:17: error: gmp.h: No such file or directory
mersenne.c: In function ‘main’:
mersenne.c:7: error: ‘mpz_t’ undeclared (first use in this function)
mersenne.c:7: error: (Each undeclared identifier is reported only once
mersenne.c:7: error: for each function it appears in.)
mersenne.c:7: error: expected ‘;’ before ‘M’
mersenne.c:8: error: ‘M’ undeclared (first use in this function)
mersenne.c:8: error: ‘powerof2’ undeclared (first use in this function)
mersenne.c:9: error: ‘one’ undeclared (first use in this function)
mersenne.c:10: error: ‘two’ undeclared (first use in this function)
I get this error while compiling ;(
Reply With Quote
  #45  
Old 7th February 2009, 05:14 PM
bee Offline
Banned
 
Join Date: Jun 2008
Posts: 1,315
Quote:
Originally Posted by messner View Post
I get this error while compiling ;(
Well maybe you don't have that gmp-devel package installed!
Code:
# yum install gmp-devel
bye!!!!!!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help Fast!!!! invisible-MK Using Fedora 5 14th November 2006 12:15 AM
too fast sjoerd222 Using Fedora 19 25th October 2006 11:35 AM
Need help fast fedorafan2 Using Fedora 3 13th August 2006 06:16 PM
This ****'s getting old fast Nickmorgan19457 Using Fedora 3 21st April 2006 06:55 PM
Sagem Fast 800 on FC4 gsouf Hardware & Laptops 2 28th February 2006 08:27 PM


Current GMT-time: 21:45 (Wednesday, 22-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat