Browse Source

With huge variation in GPU performance, allow intensity to go from -10 to +10.

nfactor-troky
Con Kolivas 14 years ago
parent
commit
9e42d63cd6
  1. 31
      main.c

31
main.c

@ -327,10 +327,10 @@ static char *set_int_0_to_9999(const char *arg, int *i)
return set_int_range(arg, i, 0, 9999); return set_int_range(arg, i, 0, 9999);
} }
static char *forced_int_0_to_14(const char *arg, int *i) static char *forced_int_1010(const char *arg, int *i)
{ {
opt_dynamic = false; opt_dynamic = false;
return set_int_range(arg, i, 0, 14); return set_int_range(arg, i, -10, 10);
} }
static char *force_nthreads_int(const char *arg, int *i) static char *force_nthreads_int(const char *arg, int *i)
@ -501,8 +501,8 @@ static struct opt_table opt_config_table[] = {
set_int_0_to_10, opt_show_intval, &opt_g_threads, set_int_0_to_10, opt_show_intval, &opt_g_threads,
"Number of threads per GPU (0 - 10)"), "Number of threads per GPU (0 - 10)"),
OPT_WITH_ARG("--intensity|-I", OPT_WITH_ARG("--intensity|-I",
forced_int_0_to_14, opt_show_intval, &scan_intensity, forced_int_1010, opt_show_intval, &scan_intensity,
"Intensity of GPU scanning (0 - 14, default: dynamic to maintain desktop interactivity)"), "Intensity of GPU scanning (-10 -> 10, default: dynamic to maintain desktop interactivity)"),
#endif #endif
OPT_WITHOUT_ARG("--load-balance", OPT_WITHOUT_ARG("--load-balance",
set_loadbalance, &pool_strategy, set_loadbalance, &pool_strategy,
@ -1680,8 +1680,8 @@ retry:
restart_longpoll(); restart_longpoll();
goto retry; goto retry;
} else if (!strncasecmp(&input, "i", 1)) { } else if (!strncasecmp(&input, "i", 1)) {
selected = curses_int("Set GPU scan intensity (0-10)"); selected = curses_int("Set GPU scan intensity (-10 -> 10)");
if (selected < 0 || selected > 10) { if (selected < -10 || selected > 10) {
wprintw(logwin, "Invalid selection\n"); wprintw(logwin, "Invalid selection\n");
goto retry; goto retry;
} }
@ -2410,9 +2410,14 @@ static inline cl_int queue_kernel_parameters(_clState *clState, dev_blk_ctx *blk
} }
static void set_threads_hashes(unsigned int vectors, unsigned int *threads, static void set_threads_hashes(unsigned int vectors, unsigned int *threads,
unsigned int *hashes, size_t *globalThreads) unsigned int *hashes, size_t *globalThreads,
{ unsigned int minthreads)
*globalThreads = *threads = 1 << (15 + scan_intensity); {
int intensity = scan_intensity + 10;
*threads = 1 << (5 + intensity);
if (*threads < minthreads)
*threads = minthreads;
*globalThreads = *threads;
*hashes = *threads * vectors; *hashes = *threads * vectors;
} }
@ -2499,13 +2504,13 @@ static void *gpuminer_thread(void *userdata)
* increase intensity when the system is idle, unless * increase intensity when the system is idle, unless
* dynamic is disabled. */ * dynamic is disabled. */
if (gpu_ms_average > 7) { if (gpu_ms_average > 7) {
if (scan_intensity > 0) if (scan_intensity > -10)
scan_intensity--; scan_intensity--;
set_threads_hashes(vectors, &threads, &hashes, globalThreads); set_threads_hashes(vectors, &threads, &hashes, globalThreads, localThreads[0]);
} else if (gpu_ms_average < 3) { } else if (gpu_ms_average < 3) {
if (scan_intensity < 14) if (scan_intensity < 10)
scan_intensity++; scan_intensity++;
set_threads_hashes(vectors, &threads, &hashes, globalThreads); set_threads_hashes(vectors, &threads, &hashes, globalThreads, localThreads[0]);
} }
} }

Loading…
Cancel
Save