Make sure intensity is carried over to thread count and is at least the minimum necessary to work.
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 50 51 52 53
diff --git a/main.c b/main.c
index 3859aab..aaf4b94 100644
--- a/main.c
+++ b/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 minthreads)
{
- int intensity = scan_intensity + 10;
- *threads = 1 << (5 + intensity);
+ *threads = 1 << (15 + scan_intensity);
if (*threads < minthreads)
*threads = minthreads;
*globalThreads = *threads;
@@ -2448,9 +2447,9 @@ static void *gpuminer_thread(void *userdata)
const cl_kernel *kernel = &clState->kernel;
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 int hashes = threads * vectors;
+ unsigned int hashes;
unsigned int hashes_done = 0;
/* 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);
- globalThreads[0] = threads;
localThreads[0] = clState->work_size;
+ set_threads_hashes(vectors, &threads, &hashes, &globalThreads[0],
+ localThreads[0]);
+
diff.tv_sec = 0;
gettimeofday(&tv_end, NULL);
@@ -2518,13 +2519,12 @@ static void *gpuminer_thread(void *userdata)
if (gpu_ms_average > 7) {
if (scan_intensity > -10)
scan_intensity--;
- set_threads_hashes(vectors, &threads, &hashes, globalThreads, localThreads[0]);
} else if (gpu_ms_average < 3) {
if (scan_intensity < 10)
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 ||
work->blk.nonce >= MAXTHREADS - hashes ||