Browse Source

Make sure intensity is carried over to thread count and is at least the minimum necessary to work.

nfactor-troky
Con Kolivas 14 years ago
parent
commit
f94ca32dcf
  1. 14
      main.c

14
main.c

@ -2422,8 +2422,7 @@ 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) unsigned int minthreads)
{ {
int intensity = scan_intensity + 10; *threads = 1 << (15 + scan_intensity);
*threads = 1 << (5 + intensity);
if (*threads < minthreads) if (*threads < minthreads)
*threads = minthreads; *threads = minthreads;
*globalThreads = *threads; *globalThreads = *threads;
@ -2448,9 +2447,9 @@ static void *gpuminer_thread(void *userdata)
const cl_kernel *kernel = &clState->kernel; const cl_kernel *kernel = &clState->kernel;
struct work *work = malloc(sizeof(struct work)); struct work *work = malloc(sizeof(struct work));
unsigned int threads = 1 << (15 + scan_intensity); unsigned int threads;
unsigned const int vectors = clState->preferred_vwidth; unsigned const int vectors = clState->preferred_vwidth;
unsigned int hashes = threads * vectors; unsigned int hashes;
unsigned int hashes_done = 0; unsigned int hashes_done = 0;
/* Request the next work item at 2/3 of the scantime */ /* Request the next work item at 2/3 of the scantime */
@ -2476,8 +2475,10 @@ static void *gpuminer_thread(void *userdata)
} }
gettimeofday(&tv_start, NULL); gettimeofday(&tv_start, NULL);
globalThreads[0] = threads;
localThreads[0] = clState->work_size; localThreads[0] = clState->work_size;
set_threads_hashes(vectors, &threads, &hashes, &globalThreads[0],
localThreads[0]);
diff.tv_sec = 0; diff.tv_sec = 0;
gettimeofday(&tv_end, NULL); gettimeofday(&tv_end, NULL);
@ -2518,13 +2519,12 @@ static void *gpuminer_thread(void *userdata)
if (gpu_ms_average > 7) { if (gpu_ms_average > 7) {
if (scan_intensity > -10) if (scan_intensity > -10)
scan_intensity--; scan_intensity--;
set_threads_hashes(vectors, &threads, &hashes, globalThreads, localThreads[0]);
} else if (gpu_ms_average < 3) { } else if (gpu_ms_average < 3) {
if (scan_intensity < 10) if (scan_intensity < 10)
scan_intensity++; scan_intensity++;
set_threads_hashes(vectors, &threads, &hashes, globalThreads, localThreads[0]);
} }
} }
set_threads_hashes(vectors, &threads, &hashes, globalThreads, localThreads[0]);
if (diff.tv_sec > opt_scantime || if (diff.tv_sec > opt_scantime ||
work->blk.nonce >= MAXTHREADS - hashes || work->blk.nonce >= MAXTHREADS - hashes ||

Loading…
Cancel
Save