diff --git a/README.txt b/README.txt index 14f19ef..98ba40e 100644 --- a/README.txt +++ b/README.txt @@ -86,7 +86,8 @@ its command line interface and options. Alternatively give string names of your card like gtx780ti or gt640#2 (matching 2nd gt640 in the PC). - -i, --intensity GPU threads per call 0-31 (default: 0=auto) + -i, --intensity GPU threads per call 8-31 (default: 0=auto) + Decimals are allowed for fine tuning -f, --diff Divide difficulty by this factor (std is 1) -v, --vote Heavycoin block vote (default: 512) -o, --url=URL URL of mining server @@ -171,6 +172,7 @@ features. v1.5.0 Upgrade compat jansson to 2.6 (for windows) Add pool mining.set_extranonce support + Allow intermediate intensity with decimals Allow increased scan ranges (wip) Some internal changes to use the C++ compiler New API 1.2 with some new commands (read only) diff --git a/ccminer.cpp b/ccminer.cpp index 0b165ac..fd0c774 100644 --- a/ccminer.cpp +++ b/ccminer.cpp @@ -239,6 +239,7 @@ double global_diff = 0.0; int opt_statsavg = 30; int opt_intensity = 0; uint32_t opt_work_size = 0; /* default */ +uint32_t opt_work_adds = 0; char *opt_api_allow = (char*) "127.0.0.1"; /* 0.0.0.0 for all ips */ int opt_api_listen = 4068; /* 0 to disable */ @@ -287,7 +288,8 @@ 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\ + -i --intensity=N GPU intensity 8-31 (default: auto) \n\ + Decimals are allowed for fine tuning \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\ @@ -901,7 +903,7 @@ static void stratum_gen_work(struct stratum_ctx *sctx, struct work *work) case ALGO_KECCAK: case ALGO_BLAKECOIN: case ALGO_WHC: - SHA256((uint8_t*)sctx->job.coinbase, sctx->job.coinbase_size, (uint8_t*)merkle_root); + SHA256((uchar*)sctx->job.coinbase, sctx->job.coinbase_size, (uchar*)merkle_root); break; default: sha256d(merkle_root, sctx->job.coinbase, (int)sctx->job.coinbase_size); @@ -1693,12 +1695,22 @@ static void parse_arg(int key, char *arg) break; } case 'i': - v = atoi(arg); + d = atof(arg); + v = (uint32_t) d; if (v < 0 || v > 31) show_usage_and_exit(1); opt_intensity = v; - if (v > 0) /* 0 = default */ + if (v > 7) { /* 0 = default */ opt_work_size = (1 << v); + if ((d - v) > 0.0) { + opt_work_adds = (uint32_t) floor((d - v) * (1 << (v-8))) * 256; + opt_work_size += opt_work_adds; + applog(LOG_INFO, "Adding %u threads to intensity %u, %u cuda threads", + opt_work_adds, v, opt_work_size); + } else { + applog(LOG_INFO, "Intensity set to %u, %u cuda threads", v, opt_work_size); + } + } break; case 'D': opt_debug = true; diff --git a/miner.h b/miner.h index 5fcea1c..52d538c 100644 --- a/miner.h +++ b/miner.h @@ -117,6 +117,14 @@ typedef unsigned char uchar; #define UINT32_MAX UINT_MAX #endif +static inline bool is_windows(void) { +#ifdef WIN32 + return 1; +#else + return 0; +#endif +} + #if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) #define WANT_BUILTIN_BSWAP #else diff --git a/x11/x11.cu b/x11/x11.cu index 55d4dc0..ca2944c 100644 --- a/x11/x11.cu +++ b/x11/x11.cu @@ -129,16 +129,6 @@ extern "C" void x11hash(void *output, const void *input) memcpy(output, hash, 32); } -/* reduce by one default intensity on windows */ -static int is_windows(void) -{ -#ifdef WIN32 - return 1; -#else - return 0; -#endif -} - extern "C" int scanhash_x11(int thr_id, uint32_t *pdata, const uint32_t *ptarget, uint32_t max_nonce, unsigned long *hashes_done) diff --git a/x13/x13.cu b/x13/x13.cu index e9e3cd4..c174742 100644 --- a/x13/x13.cu +++ b/x13/x13.cu @@ -151,7 +151,8 @@ extern "C" int scanhash_x13(int thr_id, uint32_t *pdata, { const uint32_t first_nonce = pdata[19]; static bool init[8] = { 0 }; - int throughput = opt_work_size ? opt_work_size : (1 << 19); // 256*256*8; + int intensity = 19; // (device_sm[device_map[thr_id]] > 500 && !is_windows()) ? 20 : 19; + int throughput = opt_work_size ? opt_work_size : (1 << intensity); // 19=256*256*8; throughput = min(throughput, (int)(max_nonce - first_nonce)); if (opt_benchmark)