KlausT / ccminer

Software for mining various cryptocoins
GNU General Public License v3.0
403 stars 312 forks source link

Nonce Selection Question ? #219

Open santaniitr opened 6 years ago

santaniitr commented 6 years ago

I am trying to test in neoscrypt by selectively taking the nonce from a function, instead of sequentially for full range of 0 to 4G. Currently i have not yet figured out a clean way, as it seems to link at many places (start_nonce, end_nonce, max_nonce) using UINT32_MAX.

Can you help me what should be modified... lets take a very simple case... If we need to search only the nonce field from 0xffff to 0xffffff only..... during each job received from pool. Then where should be the change and recompile.

KlausT commented 6 years ago

Why would you want to search a limited range?

First you have to split up the nonce range if you have multiple gpus. The lowest nonce for each card is calculated here: https://github.com/KlausT/ccminer/blob/2cf05c2664c6444a6c453e0fb9bbbb1910a08d1c/ccminer.cpp#L1553 You could probably do it like this: nonceptr[0] = lowlimit + ((highlimit - lowlimit + 1) / opt_n_threads) * thr_id;

The highest nonce for each card is calculated here: https://github.com/KlausT/ccminer/blob/2cf05c2664c6444a6c453e0fb9bbbb1910a08d1c/ccminer.cpp#L1387 You could change it like this: uint32_t end_nonce = lowlimit - 1 + (highlimit - lowlimit + 1) / opt_n_threads * (thr_id + 1);

Then change this line https://github.com/KlausT/ccminer/blob/2cf05c2664c6444a6c453e0fb9bbbb1910a08d1c/ccminer.cpp#L1479 to if(nonceptr[0] >= end_nonce || extrajob) And change this line https://github.com/KlausT/ccminer/blob/2cf05c2664c6444a6c453e0fb9bbbb1910a08d1c/ccminer.cpp#L1497 to if((time(NULL) - g_work_time) >= scan_time || nonceptr[0] >= end_nonce))

(By the way, I just realized that the calculation in my code is probably sligthly wrong)

santaniitr commented 6 years ago

Thank you very much KlausT for such a wonderful reply. I will continue my testing now and let you know once we get the extra benefit. Nonce range search is always limited in these algo where Hhshrate is of the order of few MH/s per card. We never complete the full range in them. Ultimately we want to find more shares even if the hashrate is similar. Let me see. Thanks.