From 9f62014690a479976c6ba6af1ed5f51c07f7e86a Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sun, 9 Nov 2014 21:50:55 +0100 Subject: [PATCH] Add intensity parameter (-i 0:31) Like cgminer, the value equals to 1 << n if 0, we keep the default value defined in algo (19 for Xn algos) 19 = 524288 threads per gpu call GTX 970 and 980 handle a higher number of threads compared to the 750 Ti Signed-off-by: Tanguy Pruvot --- cpu-miner.c | 25 ++++++++++++++++--------- miner.h | 1 + 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/cpu-miner.c b/cpu-miner.c index e764922..aa37c4f 100644 --- a/cpu-miner.c +++ b/cpu-miner.c @@ -235,6 +235,8 @@ static unsigned long rejected_count = 0L; static double *thr_hashrates; uint64_t global_hashrate = 0; +uint32_t opt_work_size = 0; /* default */ + #ifdef HAVE_GETOPT_LONG #include #else @@ -279,6 +281,7 @@ Options:\n\ Device IDs start counting from 0! Alternatively takes\n\ string names of your cards like gtx780ti or gt640#2\n\ (matching 2nd gt640 in the PC)\n\ + -i --intensity=N GPU intensity 0-31 (default: auto) \n\ -f, --diff Divide difficulty by this factor (std is 1) \n\ -v, --vote=VOTE block reward vote (for HeavyCoin)\n\ -m, --trust-pool trust the max block reward vote (maxvote) sent by the pool\n\ @@ -298,7 +301,7 @@ Options:\n\ --no-longpoll disable X-Long-Polling support\n\ --no-stratum disable X-Stratum support\n\ -q, --quiet disable per-thread hashmeter output\n\ - -K, --no-color disable colored output\n\ + --no-color disable colored output\n\ -D, --debug enable debug output\n\ -P, --protocol-dump verbose dump of protocol-level activities\n" #ifdef HAVE_SYSLOG_H @@ -324,7 +327,7 @@ static char const short_options[] = #ifdef HAVE_SYSLOG_H "S" #endif - "a:c:CKDhp:Px:qr:R:s:t:T:o:u:O:Vd:f:mv:"; + "a:c:i:Dhp:Px:qr:R:s:t:T:o:u:O:Vd:f:mv:"; static struct option const options[] = { { "algo", 1, NULL, 'a' }, @@ -335,9 +338,10 @@ static struct option const options[] = { { "cputest", 0, NULL, 1006 }, { "cert", 1, NULL, 1001 }, { "config", 1, NULL, 'c' }, - { "no-color", 0, NULL, 'K' }, + { "no-color", 0, NULL, 1002 }, { "debug", 0, NULL, 'D' }, { "help", 0, NULL, 'h' }, + { "intensity", 1, NULL, 'i' }, { "no-longpoll", 0, NULL, 1003 }, { "no-stratum", 0, NULL, 1007 }, { "pass", 1, NULL, 'p' }, @@ -1603,12 +1607,12 @@ static void parse_arg (int key, char *arg) } break; } - case 'C': - /* color for compat */ - use_colors = true; - break; - case 'K': - use_colors = false; + case 'i': + v = atoi(arg); + if (v < 0 || v > 31) + show_usage_and_exit(1); + if (v > 0) /* 0 = default */ + opt_work_size = (1 << v); break; case 'D': opt_debug = true; @@ -1738,6 +1742,9 @@ static void parse_arg (int key, char *arg) free(opt_cert); opt_cert = strdup(arg); break; + case 1002: + use_colors = false; + break; case 1005: opt_benchmark = true; want_longpoll = false; diff --git a/miner.h b/miner.h index 8b59612..13faecd 100644 --- a/miner.h +++ b/miner.h @@ -370,6 +370,7 @@ extern int stratum_thr_id; extern struct work_restart *work_restart; extern bool opt_trust_pool; extern uint16_t opt_vote; +extern uint32_t opt_work_size; extern uint64_t global_hashrate; #define CL_N "\x1B[0m"