Browse Source

Make the thread concurrency and lookup gap options hidden on the command line and autotune parameters with a newly parsed --shaders option.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
9a6c082ad1
  1. 7
      cgminer.c
  2. 25
      driver-opencl.c
  3. 1
      driver-opencl.h
  4. 1
      miner.h
  5. 3
      ocl.c

7
cgminer.c

@ -857,7 +857,7 @@ static struct opt_table opt_config_table[] = { @@ -857,7 +857,7 @@ static struct opt_table opt_config_table[] = {
#ifdef USE_SCRYPT
OPT_WITH_ARG("--lookup-gap",
set_lookup_gap, NULL, NULL,
"Set GPU lookup gap for scrypt mining, comma separated"),
opt_hidden),
#endif
OPT_WITH_ARG("--intensity|-I",
set_intensity, NULL, NULL,
@ -965,6 +965,9 @@ static struct opt_table opt_config_table[] = { @@ -965,6 +965,9 @@ static struct opt_table opt_config_table[] = {
OPT_WITHOUT_ARG("--scrypt",
opt_set_bool, &opt_scrypt,
"Use the scrypt algorithm for mining (litecoin only)"),
OPT_WITH_ARG("--shaders",
set_shaders, NULL, NULL,
"GPU shaders per card for tuning scrypt, comma separated"),
#endif
OPT_WITH_ARG("--sharelog",
set_sharelog, NULL, NULL,
@ -1007,7 +1010,7 @@ static struct opt_table opt_config_table[] = { @@ -1007,7 +1010,7 @@ static struct opt_table opt_config_table[] = {
#ifdef USE_SCRYPT
OPT_WITH_ARG("--thread-concurrency",
set_thread_concurrency, NULL, NULL,
"Set GPU thread concurrency for scrypt mining, comma separated"),
opt_hidden),
#endif
OPT_WITH_ARG("--url|-o",
set_url, NULL, NULL,

25
driver-opencl.c

@ -128,6 +128,31 @@ char *set_worksize(char *arg) @@ -128,6 +128,31 @@ char *set_worksize(char *arg)
}
#ifdef USE_SCRYPT
char *set_shaders(char *arg)
{
int i, val = 0, device = 0;
char *nextptr;
nextptr = strtok(arg, ",");
if (nextptr == NULL)
return "Invalid parameters for set lookup gap";
val = atoi(nextptr);
gpus[device++].shaders = val;
while ((nextptr = strtok(NULL, ",")) != NULL) {
val = atoi(nextptr);
gpus[device++].shaders = val;
}
if (device == 1) {
for (i = device; i < MAX_GPUDEVICES; i++)
gpus[i].shaders = gpus[0].shaders;
}
return NULL;
}
char *set_lookup_gap(char *arg)
{
int i, val = 0, device = 0;

1
driver-opencl.h

@ -19,6 +19,7 @@ extern char *set_intensity(char *arg); @@ -19,6 +19,7 @@ extern char *set_intensity(char *arg);
extern char *set_vector(char *arg);
extern char *set_worksize(char *arg);
#ifdef USE_SCRYPT
extern char *set_shaders(char *arg);
extern char *set_lookup_gap(char *arg);
extern char *set_thread_concurrency(char *arg);
#endif

1
miner.h

@ -365,6 +365,7 @@ struct cgpu_info { @@ -365,6 +365,7 @@ struct cgpu_info {
#ifdef USE_SCRYPT
int lookup_gap;
int thread_concurrency;
int shaders;
#endif
struct timeval tv_gpustart;;
struct timeval tv_gpuend;

3
ocl.c

@ -478,6 +478,9 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) @@ -478,6 +478,9 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
}
if (!gpus[gpu].thread_concurrency) {
gpus[gpu].thread_concurrency = gpus[gpu].max_alloc / 32768 / gpus[gpu].lookup_gap;
if (gpus[gpu].shaders && gpus[gpu].thread_concurrency > gpus[gpu].shaders)
gpus[gpu].thread_concurrency -= gpus[gpu].thread_concurrency % gpus[gpu].shaders;
applog(LOG_DEBUG, "GPU %d: selecting thread concurrency of %u",gpu, gpus[gpu].thread_concurrency);
}
}

Loading…
Cancel
Save