Make the thread concurrency and lookup gap options hidden on the command line and autotune parameters with a newly parsed --shaders option.
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
diff --git a/cgminer.c b/cgminer.c
index efe7894..6e9dd89 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -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,
diff --git a/driver-opencl.c b/driver-opencl.c
index 7b3f8b7..eafdd5d 100644
--- a/driver-opencl.c
+++ b/driver-opencl.c
@@ -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;
diff --git a/driver-opencl.h b/driver-opencl.h
index f09571b..c1d6182 100644
--- a/driver-opencl.h
+++ b/driver-opencl.h
@@ -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
diff --git a/miner.h b/miner.h
index 291574c..68c6e15 100644
--- a/miner.h
+++ b/miner.h
@@ -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;
diff --git a/ocl.c b/ocl.c
index b09291b..f726444 100644
--- a/ocl.c
+++ b/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);
}
}