Make it possible to run as a pure cpu miner by setting gpu threads to 0.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
diff --git a/cpu-miner.c b/cpu-miner.c
index ac00400..ace1318 100644
--- a/cpu-miner.c
+++ b/cpu-miner.c
@@ -189,7 +189,7 @@ static struct option_help options_help[] = {
"(-D) Enable debug output (default: off)" },
{ "gpu-threads N",
- "(-g N) Number of threads per-GPU (1 - 10, default: 2)" },
+ "(-g N) Number of threads per-GPU (0 - 10, default: 2)" },
{ "intensity",
"(-I) Intensity of scanning (0 - 10, default 4)" },
@@ -802,7 +802,7 @@ static void *miner_thread(void *userdata)
diff.tv_sec++;
if (diff.tv_sec > 0) {
max64 =
- ((uint64_t)hashes_done * opt_scantime) / diff.tv_sec;
+ ((uint64_t)hashes_done * (opt_log_interval ? : opt_scantime)) / diff.tv_sec;
if (max64 > 0xfffffffaULL)
max64 = 0xfffffffaULL;
max_nonce = max64;
@@ -1130,7 +1130,7 @@ static void parse_arg (int key, char *arg)
}
case 'g':
v = atoi(arg);
- if (v < 1 || v > 10)
+ if (v < 0 || v > 10)
show_usage();
opt_g_threads = v;
@@ -1297,8 +1297,6 @@ int main (int argc, char *argv[])
applog(LOG_INFO, "%i", nDevs);
return nDevs;
}
- if (nDevs)
- opt_n_threads = 0;
rpc_url = strdup(DEF_RPC_URL);
@@ -1306,6 +1304,8 @@ int main (int argc, char *argv[])
parse_cmdline(argc, argv);
gpu_threads = nDevs * opt_g_threads;
+ if (gpu_threads)
+ opt_n_threads = 0;
if (!rpc_userpass) {
if (!rpc_user || !rpc_pass) {