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

@ -64,7 +64,7 @@ Usage: " APP_ID " [OPTIONS]\n\
Options:\n"
# ifndef XMRIG_CC_SERVER
"\
-a, --algo=ALGO cryptonight (default) or cryptonight-lite\n\
-a, --algo=ALGO cryptonight (default) / cryptonight-lite or cryptonight-heavy\n\
-o, --url=URL URL of mining server\n\
-O, --userpass=U:P username:password pair for mining server\n\
-u, --user=USERNAME username for mining server\n\
@ -76,6 +76,7 @@ Options:\n"
-r, --retries=N number of times to retry before switch to backup server (default: 5)\n\
-R, --retry-pause=N time to pause between retries (default: 5)\n\
--force-pow-version=N force to use specific PoW variation (default: 0 POW_AUTODETECT, 1 POW_V1, 2 POW_V2)\n\
--multihash-factor=N number of hash blocks to process at a time (not set or 0 enables automatic selection of optimal number of hash blocks)\n\
--multihash-thread-mask for av=2/4 only, limits multihash to given threads (mask), (default: all threads)\n\
--cpu-affinity set process affinity to CPU core(s), mask 0x3 for cores 0 and 1\n\
--cpu-priority set process priority (0 idle, 2 normal to 5 highest)\n\
@ -99,7 +100,7 @@ Options:\n"
--cc-update-interval-s=N status update interval in seconds (default: 10 min: 1)\n"
# endif
# endif
# ifdef XMRIG_CC_SERVER
"\
--cc-user=USERNAME CC Server admin user\n\
@ -111,13 +112,13 @@ Options:\n"
--cc-key-file=FILE when tls is turned on, use this to point to the right key file (default: server.key) \n\
--cc-client-config-folder=FOLDER Folder contains the client config files\n\
--cc-custom-dashboard=FILE loads a custom dashboard and serve it to '/'\n"
# endif
# endif
"\
--no-color disable colored output\n"
# ifdef HAVE_SYSLOG_H
# ifdef HAVE_SYSLOG_H
"\
-S, --syslog use system log for output messages\n"
# endif
# endif
"\
-B, --background run the miner in the background\n\
-c, --config=FILE load a JSON-format configuration file\n\
@ -257,9 +258,8 @@ static struct option const cc_server_options[] = {
static const char *algo_names[] = {
"cryptonight",
# ifndef XMRIG_NO_AEON
"cryptonight-lite"
# endif
"cryptonight-lite",
"cryptonight-heavy"
};
@ -616,7 +616,7 @@ bool Options::parseArg(int key, uint64_t arg)
break;
case 't': /* --threads */
if (arg < 1 || arg > 1024) {
if (arg < 0 || arg > 1024) {
showUsage(1);
return false;
}
@ -919,12 +919,15 @@ bool Options::setAlgo(const char *algo)
break;
}
# ifndef XMRIG_NO_AEON
if (i == ARRAY_SIZE(algo_names) - 1 && !strcmp(algo, "cryptonight-light")) {
m_algo = ALGO_CRYPTONIGHT_LITE;
break;
}
# endif
if (i == ARRAY_SIZE(algo_names) - 1 && !strcmp(algo, "cryptonight-heavy")) {
m_algo = ALGO_CRYPTONIGHT_HEAVY;
break;
}
if (i == ARRAY_SIZE(algo_names) - 1) {
showUsage(1);
@ -977,6 +980,11 @@ void Options::optimizeAlgorithmConfiguration()
m_aesni = aesniFromCpu;
}
if (m_algo == Options::ALGO_CRYPTONIGHT_HEAVY && m_hashFactor > 3) {
fprintf(stderr, "Maximum supported hashfactor for cryptonight-heavy is: 3\n");
m_hashFactor = 3;
}
Cpu::optimizeParameters(m_threads, m_hashFactor, m_algo, m_maxCpuUsage, m_safe);
}