Browse Source

Make it possible to run as a pure cpu miner by setting gpu threads to 0.

Con Kolivas 14 years ago
parent
commit
24a28e29e9
1 changed files with 5 additions and 5 deletions
  1. 5 5
      cpu-miner.c

+ 5 - 5
cpu-miner.c

@@ -189,7 +189,7 @@ static struct option_help options_help[] = {
 	  "(-D) Enable debug output (default: off)" },
 	  "(-D) Enable debug output (default: off)" },
 
 
 	{ "gpu-threads N",
 	{ "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",
 	{ "intensity",
 	  "(-I) Intensity of scanning (0 - 10, default 4)" },
 	  "(-I) Intensity of scanning (0 - 10, default 4)" },
@@ -802,7 +802,7 @@ static void *miner_thread(void *userdata)
 			diff.tv_sec++;
 			diff.tv_sec++;
 		if (diff.tv_sec > 0) {
 		if (diff.tv_sec > 0) {
 			max64 =
 			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)
 			if (max64 > 0xfffffffaULL)
 				max64 = 0xfffffffaULL;
 				max64 = 0xfffffffaULL;
 			max_nonce = max64;
 			max_nonce = max64;
@@ -1130,7 +1130,7 @@ static void parse_arg (int key, char *arg)
 	}
 	}
 	case 'g':
 	case 'g':
 		v = atoi(arg);
 		v = atoi(arg);
-		if (v < 1 || v > 10)
+		if (v < 0 || v > 10)
 			show_usage();
 			show_usage();
 
 
 		opt_g_threads = v;
 		opt_g_threads = v;
@@ -1297,8 +1297,6 @@ int main (int argc, char *argv[])
 		applog(LOG_INFO, "%i", nDevs);
 		applog(LOG_INFO, "%i", nDevs);
 		return nDevs;
 		return nDevs;
 	}
 	}
-	if (nDevs)
-		opt_n_threads = 0;
 
 
 	rpc_url = strdup(DEF_RPC_URL);
 	rpc_url = strdup(DEF_RPC_URL);
 
 
@@ -1306,6 +1304,8 @@ int main (int argc, char *argv[])
 	parse_cmdline(argc, argv);
 	parse_cmdline(argc, argv);
 
 
 	gpu_threads = nDevs * opt_g_threads;
 	gpu_threads = nDevs * opt_g_threads;
+	if (gpu_threads)
+		opt_n_threads = 0;
 
 
 	if (!rpc_userpass) {
 	if (!rpc_userpass) {
 		if (!rpc_user || !rpc_pass) {
 		if (!rpc_user || !rpc_pass) {