Skip to content

Commit

Permalink
Improved cpu autodetection for cn-ultralite
Browse files Browse the repository at this point in the history
  • Loading branch information
Bendr0id committed Jan 13, 2019
1 parent d05244e commit eadd17f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/Cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ void CpuImpl::optimizeParameters(size_t& threadsCount, size_t& hashFactor,
if (algo == Options::ALGO_CRYPTONIGHT_HEAVY || powVariant == POW_XFH) {
maximumReasonableHashFactor = 3;
} else if (algo == Options::ALGO_CRYPTONIGHT_ULTRA_LITE) {
maximumReasonableHashFactor = 2;
if (m_asmOptimization == ASM_INTEL) {
maximumReasonableHashFactor = 2;
} else {
maximumReasonableHashFactor = 1;
}
}
if (safeMode) {
if (threadsCount > maximumReasonableThreadCount) {
Expand Down
8 changes: 4 additions & 4 deletions src/crypto/CryptoNight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,9 @@ bool CryptoNight::selfTest(int algo)
} else if (algo == Options::ALGO_CRYPTONIGHT_SUPER_LITE) {

} else if (algo == Options::ALGO_CRYPTONIGHT_ULTRA_LITE) {
// cn ultralite turtle
// cn ultralite (cnv8 + turtle)

cryptonight_hash_ctx[0](asmOptimization, PowVariant::POW_TURTLE, test_input, 76, output, scratchPads);
cryptonight_hash_ctx[0](asmOptimization, PowVariant::POW_V0, test_input, 76, output, scratchPads);
resultUltraLite = resultUltraLite && memcmp(output, test_output_turtle, 32) == 0;

} else {
Expand Down Expand Up @@ -593,7 +593,7 @@ bool CryptoNight::selfTest(int algo)
result = result && memcmp(output, test_output_v1, 160) == 0;
#endif

// cn v7 + xtl
// cnv7 + xtl

cryptonight_hash_ctx[0](asmOptimization, PowVariant::POW_XTL,test_input, 76, output, scratchPads);
result = result && memcmp(output, test_output_xtl, 32) == 0;
Expand All @@ -608,7 +608,7 @@ bool CryptoNight::selfTest(int algo)
cryptonight_hash_ctx[0](asmOptimization, PowVariant::POW_ALLOY,test_input, 76, output, scratchPads);
result = result && memcmp(output, test_output_alloy, 32) == 0;

// cn v8 aka cnv2
// cnv8 aka cnv2

cryptonight_hash_ctx[0](asmOptimization, PowVariant::POW_V2, test_input, 76, output, scratchPads);
result = result && memcmp(output, test_output_v2, 32) == 0;
Expand Down
2 changes: 1 addition & 1 deletion src/net/Job.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ bool Job::setTarget(const char *target)
PowVariant Job::powVariant() const
{
if (Options::i()->algo() == Options::ALGO_CRYPTONIGHT_ULTRA_LITE) {
return PowVariant::POW_TURTLE;
return PowVariant::POW_V0;
}

if (m_powVariant == PowVariant::POW_AUTODETECT) {
Expand Down
4 changes: 4 additions & 0 deletions src/net/strategies/DonateStrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ DonateStrategy::DonateStrategy(const char *agent, IStrategyListener *listener) :
url = new Url("donate2.graef.in", 8443, userId, nullptr, true, false, true);
} else if (Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE) {
url = new Url("donate2.graef.in", 1080, userId, nullptr, true, false, true);
} else if (Options::i()->algo() == Options::ALGO_CRYPTONIGHT_ULTRA_LITE) {
url = new Url("donate2.graef.in", 8090, userId, nullptr, true, false, true);
} else {
url = new Url("donate2.graef.in", 443, userId, nullptr, true, false, true);
}
Expand All @@ -68,6 +70,8 @@ DonateStrategy::DonateStrategy(const char *agent, IStrategyListener *listener) :
url = new Url("donate.graef.in", 8443, userId, nullptr, false, false, true);
} else if (Options::i()->algo() == Options::ALGO_CRYPTONIGHT_LITE) {
url = new Url("donate.graef.in", 1080, userId, nullptr, false, false, true);
} else if (Options::i()->algo() == Options::ALGO_CRYPTONIGHT_ULTRA_LITE) {
url = new Url("donate2.graef.in", 8088, userId, nullptr, false, false, true);
} else {
url = new Url("donate2.graef.in", 80, userId, nullptr, false, false, true);
}
Expand Down

0 comments on commit eadd17f

Please sign in to comment.