mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-06 03:54:25 +00:00
Fix the setting of number of processors.
Add scan intensity variable.
This commit is contained in:
parent
407df0f4b1
commit
c08be809f2
31
cpu-miner.c
31
cpu-miner.c
@ -128,8 +128,9 @@ static enum sha256_algos opt_algo = ALGO_SSE2_64;
|
|||||||
static enum sha256_algos opt_algo = ALGO_C;
|
static enum sha256_algos opt_algo = ALGO_C;
|
||||||
#endif
|
#endif
|
||||||
static int nDevs;
|
static int nDevs;
|
||||||
static int opt_n_threads;
|
static int opt_n_threads = 1;
|
||||||
static int num_processors;
|
static int num_processors;
|
||||||
|
static int scan_intensity = 5;
|
||||||
static char *rpc_url;
|
static char *rpc_url;
|
||||||
static char *rpc_userpass;
|
static char *rpc_userpass;
|
||||||
static char *rpc_user, *rpc_pass;
|
static char *rpc_user, *rpc_pass;
|
||||||
@ -181,6 +182,9 @@ static struct option_help options_help[] = {
|
|||||||
{ "debug",
|
{ "debug",
|
||||||
"(-D) Enable debug output (default: off)" },
|
"(-D) Enable debug output (default: off)" },
|
||||||
|
|
||||||
|
{ "intensity",
|
||||||
|
"(-I) Intensity of scanning (0 - 15, default 4)" },
|
||||||
|
|
||||||
{ "ndevs",
|
{ "ndevs",
|
||||||
"(-n) Display number of detected GPUs" },
|
"(-n) Display number of detected GPUs" },
|
||||||
|
|
||||||
@ -232,6 +236,7 @@ static struct option options[] = {
|
|||||||
{ "config", 1, NULL, 'c' },
|
{ "config", 1, NULL, 'c' },
|
||||||
{ "debug", 0, NULL, 'D' },
|
{ "debug", 0, NULL, 'D' },
|
||||||
{ "help", 0, NULL, 'h' },
|
{ "help", 0, NULL, 'h' },
|
||||||
|
{ "intensity", 1, NULL, 'I' },
|
||||||
{ "ndevs", 0, NULL, 'n' },
|
{ "ndevs", 0, NULL, 'n' },
|
||||||
{ "no-longpoll", 0, NULL, 1003 },
|
{ "no-longpoll", 0, NULL, 1003 },
|
||||||
{ "pass", 1, NULL, 'p' },
|
{ "pass", 1, NULL, 'p' },
|
||||||
@ -816,7 +821,7 @@ static void *gpuminer_thread(void *userdata)
|
|||||||
|
|
||||||
struct work *work = malloc(sizeof(struct work));
|
struct work *work = malloc(sizeof(struct work));
|
||||||
bool need_work = true;
|
bool need_work = true;
|
||||||
unsigned int threads = 1 << 21;
|
unsigned int threads = 1 << (15 + scan_intensity);
|
||||||
unsigned int vectors = 4;
|
unsigned int vectors = 4;
|
||||||
unsigned int hashes_done = threads * vectors;
|
unsigned int hashes_done = threads * vectors;
|
||||||
|
|
||||||
@ -1001,15 +1006,6 @@ static void parse_arg (int key, char *arg)
|
|||||||
{
|
{
|
||||||
int v, i;
|
int v, i;
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
if (!opt_n_threads)
|
|
||||||
opt_n_threads = 1;
|
|
||||||
#else
|
|
||||||
num_processors = sysconf(_SC_NPROCESSORS_ONLN);
|
|
||||||
if (!opt_n_threads)
|
|
||||||
opt_n_threads = num_processors;
|
|
||||||
#endif /* !WIN32 */
|
|
||||||
|
|
||||||
switch(key) {
|
switch(key) {
|
||||||
case 'a':
|
case 'a':
|
||||||
for (i = 0; i < ARRAY_SIZE(algo_names); i++) {
|
for (i = 0; i < ARRAY_SIZE(algo_names); i++) {
|
||||||
@ -1036,6 +1032,12 @@ static void parse_arg (int key, char *arg)
|
|||||||
case 'q':
|
case 'q':
|
||||||
opt_quiet = true;
|
opt_quiet = true;
|
||||||
break;
|
break;
|
||||||
|
case 'I':
|
||||||
|
v = atoi(arg);
|
||||||
|
if (v < 0 || v > 16) /* sanity check */
|
||||||
|
show_usage();
|
||||||
|
scan_intensity = v;
|
||||||
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
opt_debug = true;
|
opt_debug = true;
|
||||||
break;
|
break;
|
||||||
@ -1157,6 +1159,13 @@ int main (int argc, char *argv[])
|
|||||||
int i;
|
int i;
|
||||||
char name[32];
|
char name[32];
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
opt_n_threads = 1;
|
||||||
|
#else
|
||||||
|
num_processors = sysconf(_SC_NPROCESSORS_ONLN);
|
||||||
|
opt_n_threads = num_processors;
|
||||||
|
#endif /* !WIN32 */
|
||||||
|
|
||||||
nDevs = clDevicesNum();
|
nDevs = clDevicesNum();
|
||||||
if (opt_ndevs) {
|
if (opt_ndevs) {
|
||||||
printf("%i\n", nDevs);
|
printf("%i\n", nDevs);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user