Permalink
Browse files

Make the thread concurrency and lookup gap options hidden on the comm…

…and line and autotune parameters with a newly parsed --shaders option.
  • Loading branch information...
1 parent f98774c commit 9a6c082ad159935375915994372e8cc1944c2da2 @ckolivas committed Jul 24, 2012
Showing with 35 additions and 2 deletions.
  1. +5 −2 cgminer.c
  2. +25 −0 driver-opencl.c
  3. +1 −0 driver-opencl.h
  4. +1 −0 miner.h
  5. +3 −0 ocl.c
View
@@ -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[] = {
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[] = {
#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,
View
@@ -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;
View
@@ -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
View
@@ -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;
View
3 ocl.c
@@ -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);
}
}

0 comments on commit 9a6c082

Please sign in to comment.