Bitcoin Forum
March 29, 2024, 03:50:11 PM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 [40] 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 ... 131 »
  Print  
Author Topic: [XPM] [ANN] Primecoin High Performance | HP14 released!  (Read 397577 times)
ReCat
Sr. Member
****
Offline Offline

Activity: 406
Merit: 250



View Profile WWW
July 19, 2013, 03:21:29 AM
 #781

What's your CPU? Mine is two quad-core xeons. same architecture as the old core 2 duo processors... im thinking maybe im getting good speeds because of the large amount of cache i have or something?

BTC: 1recatirpHBjR9sxgabB3RDtM6TgntYUW
Hold onto what you love with all your might, Because you can never know when - Oh. What you love is now gone.
1711727411
Hero Member
*
Offline Offline

Posts: 1711727411

View Profile Personal Message (Offline)

Ignore
1711727411
Reply with quote  #2

1711727411
Report to moderator
1711727411
Hero Member
*
Offline Offline

Posts: 1711727411

View Profile Personal Message (Offline)

Ignore
1711727411
Reply with quote  #2

1711727411
Report to moderator
"Your bitcoin is secured in a way that is physically impossible for others to access, no matter for what reason, no matter how good the excuse, no matter a majority of miners, no matter what." -- Greg Maxwell
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Kyune
Sr. Member
****
Offline Offline

Activity: 287
Merit: 250


View Profile
July 19, 2013, 03:21:54 AM
 #782

Just wanted to say great miner!  I feel like this is probably the most optimized miner on the market right now.  Looking over the source code of the original miner and yours I think I see a way to make the miner (potentially much) faster from a mathematical standpoint rather than a code-optimization standpoint.  My optimization centers around the Primorial and the loop that occurs in main.cpp on line 4622.

Before getting into the code, it is important to realize why a primorial is helpful (if you already understand this, skip this paragraph).  With numbers on the order of 2256 there is about a 1 in 177 chance that a random number is prime.  If you select 8 random numbers, then, the odds of all of them being prime is about 1 in 1 quintillion--impractically low.  If you limit your search to only odd numbers, though, the odds shoot up tremendously.  Further limiting your search to numbers not divisible by 3, 5, 7, and so on can cause the odds of finding a prime number to become much, much better.  If the hash value is divisible by lots of these small numbers then multiples of that hash ± 1 will not be divisible by any of those numbers.  Thus, it is convenient to use a hash that is already a multiple of 2 * 3 * 5 * 7 * ... as it will produce far more primes than another hash.

As I understand the aforementioned loop, the program is searching for a hash that is divisible by a primorial.  Each iteration of this loop requires a hash to be generated as it increments the nonce value.  In the present form the primorail is of degree 7 (line 4579: static const unsigned int nPrimorialHashFactor = 7).  I suspect that this value is carefully chosen and it's probably ideal with the way that it is written.  However, I think there's an additional step that can be added to make the process much faster.  Increasing the degree of the primorial is incredibly expensive as it gets larger, since adding the 8th prime requires 19 times as many hashes to be checked; the 9th prime requires 23 times as many, and so on.  There is another way, though.

Prime origins are required to be in the form O = H * N where O is the origin, H is the hash, and N is any integer; H is selected to be divisible by p#7 (the primorial shown above).  If we extend this to O = H * N * P2 where P2 is 19 * 23 * 29 * ... * 51--a product of primes starting after the last prime used in the existing search--then the checked origin is still valid (an integer times an integer is still an integer).  This grants the benefits of searching with a higher degree primorial while not requiring a longer search for a working hash.  

Nothing is free, though, as this method inflates the size of the primes to be checked.  If the fast modular exponentiation is implemented through the same method as is used on the Fermat Primality Test Wikipedia page then the algorithmic efficiency is O(log2(n) * log(log(n)) * log(log(log(n))) ).  There should be some sweet spot of how large of a primorial to use where the increased frequency of primes more than offsets the extra time required for the fast modular exponentiation.  It's possible that the sweet spot is 0 extra primes, but I think it's worth looking into.
Number theorist in the hizzouse!

BTC:  1K4VpdQXQhgmTmq68rbWhybvoRcyNHKyVP
atomium
Donator
Sr. Member
*
Offline Offline

Activity: 406
Merit: 252


Study the past, if you would divine the future.


View Profile
July 19, 2013, 03:22:22 AM
 #783

What's your CPU? Mine is two quad-core xeons. same architecture as the old core 2 duo processors... im thinking maybe im getting good speeds because of the large amount of cache i have or something?

yea you have more i have one quadcore with 8gigs of ram lol, im jealous
ReCat
Sr. Member
****
Offline Offline

Activity: 406
Merit: 250



View Profile WWW
July 19, 2013, 03:27:06 AM
 #784

the computer im using costed me 180 bucks. its a retired rack server. Tongue

BTC: 1recatirpHBjR9sxgabB3RDtM6TgntYUW
Hold onto what you love with all your might, Because you can never know when - Oh. What you love is now gone.
atomium
Donator
Sr. Member
*
Offline Offline

Activity: 406
Merit: 252


Study the past, if you would divine the future.


View Profile
July 19, 2013, 03:28:08 AM
 #785

the computer im using costed me 180 bucks. its a retired rack server. Tongue

thats awesome!
forsetifox
Sr. Member
****
Offline Offline

Activity: 266
Merit: 250



View Profile
July 19, 2013, 03:28:58 AM
 #786

the computer im using costed me 180 bucks. its a retired rack server. Tongue

Going to buy one of those when I get ~ 2 BTC playing with primecoins. =3
ReCat
Sr. Member
****
Offline Offline

Activity: 406
Merit: 250



View Profile WWW
July 19, 2013, 03:33:52 AM
 #787

Did I mention how everyone mocked me for buying the rack server?

"You'll mine 1 litecoin with it, maybe two"

 Cheesy

BTC: 1recatirpHBjR9sxgabB3RDtM6TgntYUW
Hold onto what you love with all your might, Because you can never know when - Oh. What you love is now gone.
noodle_dam
Hero Member
*****
Offline Offline

Activity: 530
Merit: 500



View Profile
July 19, 2013, 03:55:14 AM
 #788

What is the best way to get an hp build working on OS X?

Having toyed with it for hours, I can conclusively say that installing VMWare Fusion with an image of Ubuntu and compiling / running it on there yields the best results. I don't know why, it just does. Natively, compiled in Mountain Lion, I get about half the performance from the same build compiled in the VM.

I hope helps you out.

Thank you.

ReCat
Sr. Member
****
Offline Offline

Activity: 406
Merit: 250



View Profile WWW
July 19, 2013, 04:39:17 AM
 #789

Both put together. To find out, just run a benchmark like passmark.

BTC: 1recatirpHBjR9sxgabB3RDtM6TgntYUW
Hold onto what you love with all your might, Because you can never know when - Oh. What you love is now gone.
nullbitspectre1848
Full Member
***
Offline Offline

Activity: 141
Merit: 100



View Profile
July 19, 2013, 04:42:17 AM
 #790

Where do I go for the latest miner updates etc?

#Darren
Sr. Member
****
Offline Offline

Activity: 784
Merit: 250


DIA | Data infrastructure for DeFi


View Profile
July 19, 2013, 04:48:08 AM
 #791

Where do I go for the latest miner updates etc?

Page 1 of this thread.


      ████████████████
   ████████████████████████
██████████████████████████████
█████████████████████████████████
███████████████████████████████████
█████████████████████████████████████
██████████████████████████████████████
███████████████████████████████████████
█████████████████   ███████████████████
█████████████████        ███████████████
█████████████████          █████████████
█████████████████            ████████████
█████████████████             ███████████
█████████████████             ███████████
█████████████████              ██████████
█████████████████              ██████████
█████████████████             ███████████
█████████████████            ███████████
█████████████████          █████████████
█████████████████      ███████████████
█████████████████ ████████████████████
█████████████████████████████████████
███████████████████████████████████
█████████████████████████████████
██████████████████████████████
██████████████████████████
     █████████████████
          ████
DIA | OPEN ACCESS FINANCIAL DATA
AstroKev
Newbie
*
Offline Offline

Activity: 23
Merit: 0


View Profile
July 19, 2013, 06:21:31 AM
 #792

Some more stats for people to have fun with:

aws cc2.8xlarge,
primecoin-0.1.1-hp5 native

2013-07-19 06:03:07 primemeter  79132085 prime/h 688566896 test/h      2040 5-chains/h
2013-07-19 06:04:07 primemeter  79653622 prime/h 698384521 test/h      2700 5-chains/h
2013-07-19 06:05:07 primemeter  79337338 prime/h 695558447 test/h      2040 5-chains/h
2013-07-19 06:06:07 primemeter  79792250 prime/h 695628406 test/h      1560 5-chains/h
2013-07-19 06:07:07 primemeter  80470419 prime/h 705139328 test/h      2280 5-chains/h
2013-07-19 06:08:07 primemeter  80764354 prime/h 704518758 test/h      1980 5-chains/h
2013-07-19 06:09:07 primemeter  76383887 prime/h 667428216 test/h      1500 5-chains/h


avg 5-chains/h ~~ 2000

------

aws cc2.8xlarge,
primecoin-0.1.1-hp5 two changes:

1) prime.cpp
const unsigned int nPrimes = (uint64)nTotalPrimes * 8 / 100;  // down from 10

2) main.cpp
static const unsigned int nPrimorialHashFactor = 9; // up from 7

2013-07-19 06:12:12 primemeter  52307908 prime/h 395403610 test/h      2640 5-chains/h
2013-07-19 06:13:12 primemeter  56580497 prime/h 440204443 test/h      2820 5-chains/h
2013-07-19 06:14:12 primemeter  56291842 prime/h 438057079 test/h      3000 5-chains/h
2013-07-19 06:15:12 primemeter  56267549 prime/h 437380981 test/h      2100 5-chains/h
2013-07-19 06:16:12 primemeter  56236005 prime/h 432883711 test/h      2580 5-chains/h
2013-07-19 06:17:12 primemeter  54281275 prime/h 412524505 test/h      2580 5-chains/h
2013-07-19 06:18:12 primemeter  54689509 prime/h 419307812 test/h      2220 5-chains/h

avg 5-chains/h ~~ 2500




paulthetafy
Hero Member
*****
Offline Offline

Activity: 820
Merit: 1000


View Profile
July 19, 2013, 06:52:37 AM
 #793

Some more stats for people to have fun with:

aws cc2.8xlarge,
primecoin-0.1.1-hp5 native

2013-07-19 06:03:07 primemeter  79132085 prime/h 688566896 test/h      2040 5-chains/h
2013-07-19 06:04:07 primemeter  79653622 prime/h 698384521 test/h      2700 5-chains/h
2013-07-19 06:05:07 primemeter  79337338 prime/h 695558447 test/h      2040 5-chains/h
2013-07-19 06:06:07 primemeter  79792250 prime/h 695628406 test/h      1560 5-chains/h
2013-07-19 06:07:07 primemeter  80470419 prime/h 705139328 test/h      2280 5-chains/h
2013-07-19 06:08:07 primemeter  80764354 prime/h 704518758 test/h      1980 5-chains/h
2013-07-19 06:09:07 primemeter  76383887 prime/h 667428216 test/h      1500 5-chains/h


avg 5-chains/h ~~ 2000

------

aws cc2.8xlarge,
primecoin-0.1.1-hp5 two changes:

1) prime.cpp
const unsigned int nPrimes = (uint64)nTotalPrimes * 8 / 100;  // down from 10

2) main.cpp
static const unsigned int nPrimorialHashFactor = 9; // up from 7

2013-07-19 06:12:12 primemeter  52307908 prime/h 395403610 test/h      2640 5-chains/h
2013-07-19 06:13:12 primemeter  56580497 prime/h 440204443 test/h      2820 5-chains/h
2013-07-19 06:14:12 primemeter  56291842 prime/h 438057079 test/h      3000 5-chains/h
2013-07-19 06:15:12 primemeter  56267549 prime/h 437380981 test/h      2100 5-chains/h
2013-07-19 06:16:12 primemeter  56236005 prime/h 432883711 test/h      2580 5-chains/h
2013-07-19 06:17:12 primemeter  54281275 prime/h 412524505 test/h      2580 5-chains/h
2013-07-19 06:18:12 primemeter  54689509 prime/h 419307812 test/h      2220 5-chains/h

avg 5-chains/h ~~ 2500


Have you found any blocks with these changes? My very poor understanding of the algorithm suggests that changing the has factor will not work...
bidji29
Sr. Member
****
Offline Offline

Activity: 392
Merit: 250


View Profile
July 19, 2013, 07:10:35 AM
 #794

Thanks for the data Astrokev.
We see the pps is lower but the 5-chain bigger with your change. I think it's good, 5chain seems a better indicator.

Did you test with other number aswell?

http://www.freebieservers.com/  100% FREE GAME SERVERS
grc
Newbie
*
Offline Offline

Activity: 40
Merit: 0


View Profile
July 19, 2013, 07:20:29 AM
 #795

2) main.cpp
static const unsigned int nPrimorialHashFactor = 9; // up from 7

I could be wrong, but I'm not convinced this change will make any significant difference. The primorial of 7 is the same as that of 9, since 8 and 9 aren't primes.
AstroKev
Newbie
*
Offline Offline

Activity: 23
Merit: 0


View Profile
July 19, 2013, 07:36:58 AM
Last edit: July 19, 2013, 07:46:59 AM by AstroKev
 #796

Quote
Have you found any blocks with these changes? My very poor understanding of the algorithm suggests that changing the has factor will not work...

No - I only was testing based on some of Koooooj's comments to see if there was a possible tradeoff.
The primecoin paper says:

Quote
In one case, varying nonce and finding a block header hash that is divisible by a small
primorial number – the product of all primes smaller than a given prime p – can help
only slightly. It allows the prime miner to work on somewhat smaller primes, like maybe
a few digits shorter, for prime numbers of typically 100 digits, only a very small
advantage.

which suggested further that this is only used to help make finding candidates faster.

--------

Related, I finally was able to coerce primecoind to compile on FreeBSD.  Here are some stats for an HP DL 585 w/64 cores -- which is actually almost the same for 5-chains as the cc2.8xlarge:
2013-07-19 07:21:20 primemeter  52706242 prime/h 409095802 test/h      2700 5-chains/h
2013-07-19 07:22:20 primemeter  55256799 prime/h 430313188 test/h      2820 5-chains/h
2013-07-19 07:23:20 primemeter  57252732 prime/h 451175301 test/h      3180 5-chains/h
2013-07-19 07:24:20 primemeter  60431918 prime/h 472296745 test/h      2280 5-chains/h
2013-07-19 07:25:20 primemeter  49530089 prime/h 384528982 test/h      2460 5-chains/h
2013-07-19 07:26:20 primemeter  51512423 prime/h 400527689 test/h      1980 5-chains/h


If you're interested in compiling for FreeBSD, you also will need to install the usual libraries and also change init.cpp:
Code:
//    nMaxConnections = std::max(std::min(nMaxConnections, FD_SETSIZE - nBind - MIN_CORE_FILEDESCRIPTORS), 0);
    nMaxConnections = std::max(std::min(nMaxConnections, static_cast<int>(FD_SETSIZE - nBind - MIN_CORE_FILEDESCRIPTORS)), 0);
I had to specify the install paths for a lot of things and remove the explicit -ldl in the makefile as well.. go figure.



Quote
Did you test with other number aswell?
Yes, I did 10, 11, 12, 13, 14, 15, 16, 17.  It starts to get bad around 13 on the big aws instance.

Quote
I could be wrong, but I'm not convinced this change will make any significant difference. The primorial of 7 is the same as that of 9, since 8 and 9 aren't primes.
No this is not what primorial means.  

primorial(1) = 2
primorial(2) = 2 * 3
primorial(3) = 2 * 3 * 5
and so forth.
primorial(7) = 2 * 3 * 5 * 7 * 11 * 13 * 17 = 510510
primorial(9) = 2 * 3 * 5 * 7 * 11 * 13 * 17 * 19 * 23 = 223092870



Notice the list of divisors this produces when using p#9 * some random price
> bc
print 223092870 * 498497689
111211280127377430

http://www.wolframalpha.com/input/?i=factor+%28111211280127377430%29



Honestly I can't say I really understand what the code is doing here, but based on some the comments from Kooooooj and running through gprof, Weave is sucking up all the time -- so I was trying to push some of the work out of there and into the caller function.  I am 100% speculating also that the increases in difficulty may make the primorial a little more important. But anyway, mostly just hacking.


oh well, off to bed.
grc
Newbie
*
Offline Offline

Activity: 40
Merit: 0


View Profile
July 19, 2013, 08:18:45 AM
 #797

Quote
I could be wrong, but I'm not convinced this change will make any significant difference. The primorial of 7 is the same as that of 9, since 8 and 9 aren't primes.
No this is not what primorial means.  

primorial(1) = 2
primorial(2) = 2 * 3
primorial(3) = 2 * 3 * 5
and so forth.
primorial(7) = 2 * 3 * 5 * 7 * 11 * 13 * 17 = 510510
primorial(9) = 2 * 3 * 5 * 7 * 11 * 13 * 17 * 19 * 23 = 223092870



Notice the list of divisors this produces when using p#9 * some random price
> bc
print 223092870 * 498497689
111211280127377430

http://www.wolframalpha.com/input/?i=factor+%28111211280127377430%29



Honestly I can't say I really understand what the code is doing here, but based on some the comments from Kooooooj and running through gprof, Weave is sucking up all the time -- so I was trying to push some of the work out of there and into the caller function.  I am 100% speculating also that the increases in difficulty may make the primorial a little more important. But anyway, mostly just hacking.


oh well, off to bed.

Sorry, I was thinking of this definition, where the primorial of a number is defined as the product of all primes ≤ n.

It seems to be implemented this way in prime.cpp, as the Primorial function stops at the first prime greater than the given number:

Code:
void Primorial(unsigned int p, mpz_class& mpzPrimorial)
{
    mpzPrimorial = 1;
    BOOST_FOREACH(unsigned int nPrime, vPrimes)
    {
        if (nPrime > p) break;
        mpzPrimorial *= nPrime;
    }
}
maco
Sr. Member
****
Offline Offline

Activity: 294
Merit: 250



View Profile
July 19, 2013, 08:36:04 AM
 #798

can someone provide proper instructions for HP5?

Seems like the folders are different and I am getting a blank screen after running the watch command.
bidji29
Sr. Member
****
Offline Offline

Activity: 392
Merit: 250


View Profile
July 19, 2013, 08:53:46 AM
 #799

me too. I reboot my vps and then it work.

http://www.freebieservers.com/  100% FREE GAME SERVERS
mikaelh (OP)
Sr. Member
****
Offline Offline

Activity: 301
Merit: 250


View Profile
July 19, 2013, 09:29:58 AM
 #800

Just wanted to say great miner!  I feel like this is probably the most optimized miner on the market right now.  Looking over the source code of the original miner and yours I think I see a way to make the miner (potentially much) faster from a mathematical standpoint rather than a code-optimization standpoint.  My optimization centers around the Primorial and the loop that occurs in main.cpp on line 4622.

Before getting into the code, it is important to realize why a primorial is helpful (if you already understand this, skip this paragraph).  With numbers on the order of 2256 there is about a 1 in 177 chance that a random number is prime.  If you select 8 random numbers, then, the odds of all of them being prime is about 1 in 1 quintillion--impractically low.  If you limit your search to only odd numbers, though, the odds shoot up tremendously.  Further limiting your search to numbers not divisible by 3, 5, 7, and so on can cause the odds of finding a prime number to become much, much better.  If the hash value is divisible by lots of these small numbers then multiples of that hash ± 1 will not be divisible by any of those numbers.  Thus, it is convenient to use a hash that is already a multiple of 2 * 3 * 5 * 7 * ... as it will produce far more primes than another hash.

As I understand the aforementioned loop, the program is searching for a hash that is divisible by a primorial.  Each iteration of this loop requires a hash to be generated as it increments the nonce value.  In the present form the primorail is of degree 7 (line 4579: static const unsigned int nPrimorialHashFactor = 7).  I suspect that this value is carefully chosen and it's probably ideal with the way that it is written.  However, I think there's an additional step that can be added to make the process much faster.  Increasing the degree of the primorial is incredibly expensive as it gets larger, since adding the 8th prime requires 19 times as many hashes to be checked; the 9th prime requires 23 times as many, and so on.  There is another way, though.

Prime origins are required to be in the form O = H * N where O is the origin, H is the hash, and N is any integer; H is selected to be divisible by p#7 (the primorial shown above).  If we extend this to O = H * N * P2 where P2 is 19 * 23 * 29 * ... * 51--a product of primes starting after the last prime used in the existing search--then the checked origin is still valid (an integer times an integer is still an integer).  This grants the benefits of searching with a higher degree primorial while not requiring a longer search for a working hash.  

Nothing is free, though, as this method inflates the size of the primes to be checked.  If the fast modular exponentiation is implemented through the same method as is used on the Fermat Primality Test Wikipedia page then the algorithmic efficiency is O(log2(n) * log(log(n)) * log(log(log(n))) ).  There should be some sweet spot of how large of a primorial to use where the increased frequency of primes more than offsets the extra time required for the fast modular exponentiation.  It's possible that the sweet spot is 0 extra primes, but I think it's worth looking into.

Definitely a great. I haven't had the time to study the code from a mathematical perspective, so this is helping me understand the code better. Smiley

Unfortunately it seems that Sunny King was ahead of you here. The code is already doing what you proposed. It uses something called a round primorial which is dynamically adjusted. You can see these round primorials in debug.log if you enable the debugging options -debug -printmining. A fixed multiplier is calculated through division by the first primorial used to choose the hash value. This fixed multiplier corresponds to your P2.

I think some improvements could be made to the dynamic adjustment system. It seems to be picking lots of different values.
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 [40] 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 ... 131 »
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!