1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-22 20:44:19 +00:00

Use different variables for command line specified lookup gap and thread concurrency to differentiate user defined versus auto chosen values.

This commit is contained in:
Con Kolivas 2012-08-05 15:32:44 +10:00
parent 7611499b11
commit fc44b6d7a1
3 changed files with 15 additions and 12 deletions

View File

@ -163,16 +163,16 @@ char *set_lookup_gap(char *arg)
return "Invalid parameters for set lookup gap"; return "Invalid parameters for set lookup gap";
val = atoi(nextptr); val = atoi(nextptr);
gpus[device++].lookup_gap = val; gpus[device++].opt_lg = val;
while ((nextptr = strtok(NULL, ",")) != NULL) { while ((nextptr = strtok(NULL, ",")) != NULL) {
val = atoi(nextptr); val = atoi(nextptr);
gpus[device++].lookup_gap = val; gpus[device++].opt_lg = val;
} }
if (device == 1) { if (device == 1) {
for (i = device; i < MAX_GPUDEVICES; i++) for (i = device; i < MAX_GPUDEVICES; i++)
gpus[i].lookup_gap = gpus[0].lookup_gap; gpus[i].opt_lg = gpus[0].opt_lg;
} }
return NULL; return NULL;
@ -188,16 +188,16 @@ char *set_thread_concurrency(char *arg)
return "Invalid parameters for set thread concurrency"; return "Invalid parameters for set thread concurrency";
val = atoi(nextptr); val = atoi(nextptr);
gpus[device++].thread_concurrency = val; gpus[device++].opt_tc = val;
while ((nextptr = strtok(NULL, ",")) != NULL) { while ((nextptr = strtok(NULL, ",")) != NULL) {
val = atoi(nextptr); val = atoi(nextptr);
gpus[device++].thread_concurrency = val; gpus[device++].opt_tc = val;
} }
if (device == 1) { if (device == 1) {
for (i = device; i < MAX_GPUDEVICES; i++) for (i = device; i < MAX_GPUDEVICES; i++)
gpus[i].thread_concurrency = gpus[0].thread_concurrency; gpus[i].opt_tc = gpus[0].opt_tc;
} }
return NULL; return NULL;

View File

@ -362,8 +362,8 @@ struct cgpu_info {
cl_ulong max_alloc; cl_ulong max_alloc;
#ifdef USE_SCRYPT #ifdef USE_SCRYPT
int lookup_gap; int opt_lg, lookup_gap;
int thread_concurrency; int opt_tc, thread_concurrency;
int shaders; int shaders;
#endif #endif
struct timeval tv_gpustart;; struct timeval tv_gpustart;;

11
ocl.c
View File

@ -476,11 +476,13 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
cl_ulong ma = cgpu->max_alloc, mt; cl_ulong ma = cgpu->max_alloc, mt;
int pow2 = 0; int pow2 = 0;
if (!cgpu->lookup_gap) { if (!cgpu->opt_lg) {
applog(LOG_DEBUG, "GPU %d: selecting lookup gap of 2", gpu); applog(LOG_DEBUG, "GPU %d: selecting lookup gap of 2", gpu);
cgpu->lookup_gap = 2; cgpu->lookup_gap = 2;
} } else
if (!cgpu->thread_concurrency) { cgpu->lookup_gap = cgpu->opt_lg;
if (!cgpu->opt_tc) {
cgpu->thread_concurrency = ma / 32768 / cgpu->lookup_gap; cgpu->thread_concurrency = ma / 32768 / cgpu->lookup_gap;
if (cgpu->shaders && cgpu->thread_concurrency > cgpu->shaders) { if (cgpu->shaders && cgpu->thread_concurrency > cgpu->shaders) {
cgpu->thread_concurrency -= cgpu->thread_concurrency % cgpu->shaders; cgpu->thread_concurrency -= cgpu->thread_concurrency % cgpu->shaders;
@ -489,7 +491,8 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
} }
applog(LOG_DEBUG, "GPU %d: selecting thread concurrency of %u",gpu, cgpu->thread_concurrency); applog(LOG_DEBUG, "GPU %d: selecting thread concurrency of %u",gpu, cgpu->thread_concurrency);
} } else
cgpu->thread_concurrency = cgpu->opt_tc;
/* If we have memory to spare, try to find a power of 2 value /* If we have memory to spare, try to find a power of 2 value
* >= required amount to map nicely to an intensity */ * >= required amount to map nicely to an intensity */