Implemented CN-Heavy algo, Algo tests and fixed n-loop variants (#86)

* Debouncing of connection retry when connecting donation server fails
* When PoW variant is set on proxy, it will overrule local set PoW
* Implementation of cn_heavy algo
* Added self test for cn-heavy
* Fixed n-loop variant of powV2 and cn-heavy
* Fixed n-loop variant of powV2 and added cn-heavy for ARM
* Fixing n-loop for arm
* Limited cn-heavy to max hashfactor 3 on higher seltest fails.
* Removed a lot of casts
* Fixed algo selftest
This commit is contained in:
Ben Gräf 2018-04-07 21:20:24 +02:00 committed by GitHub
parent 06bb082041
commit 1ce9d2bf3c
17 changed files with 2682 additions and 450 deletions

View file

@ -55,7 +55,7 @@ void CpuImpl::optimizeParameters(size_t& threadsCount, size_t& hashFactor,
Options::Algo algo, size_t maxCpuUsage, bool safeMode)
{
// limits hashfactor to maximum possible value defined by compiler flag
hashFactor = std::min(hashFactor, static_cast<size_t>(MAX_NUM_HASH_BLOCKS));
hashFactor = std::min(hashFactor, algo == Options::ALGO_CRYPTONIGHT_HEAVY ? 3 : static_cast<size_t>(MAX_NUM_HASH_BLOCKS));
if (!safeMode && threadsCount > 0 && hashFactor > 0)
{
@ -69,6 +69,9 @@ void CpuImpl::optimizeParameters(size_t& threadsCount, size_t& hashFactor,
case Options::ALGO_CRYPTONIGHT_LITE:
algoBlockSize = 1024;
break;
case Options::ALGO_CRYPTONIGHT_HEAVY:
algoBlockSize = 4096;
break;
case Options::ALGO_CRYPTONIGHT:
default:
algoBlockSize = 2048;
@ -77,7 +80,7 @@ void CpuImpl::optimizeParameters(size_t& threadsCount, size_t& hashFactor,
size_t maximumReasonableFactor = std::max(cache / algoBlockSize, static_cast<size_t>(1ul));
size_t maximumReasonableThreadCount = std::min(maximumReasonableFactor, m_totalThreads);
size_t maximumReasonableHashFactor = std::min(maximumReasonableFactor, static_cast<size_t>(MAX_NUM_HASH_BLOCKS));
size_t maximumReasonableHashFactor = std::min(maximumReasonableFactor, algo == Options::ALGO_CRYPTONIGHT_HEAVY ? 3 : static_cast<size_t>(MAX_NUM_HASH_BLOCKS));
if (safeMode) {
if (threadsCount > maximumReasonableThreadCount) {