Make it possible to set the intensity on a per-card basis, dynamic or static values.
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 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
diff --git a/README b/README
index 9a7930d..632555b 100644
--- a/README
+++ b/README
@@ -125,7 +125,7 @@ Options for both config file and command line:
--gpu-memclock <arg> Set the GPU memory (over)clock in Mhz - one value for all or separate by commas for per card.
--gpu-powertune <arg> Set the GPU powertune percentage - one value for all or separate by commas for per card.
--gpu-vddc <arg> Set the GPU voltage in Volts - one value for all or separate by commas for per card.
---intensity|-I <arg> Intensity of GPU scanning (-10 -> 10, default: dynamic to maintain desktop interactivity)
+--intensity|-I <arg> Intensity of GPU scanning (d or -10 -> 10, default: d to maintain desktop interactivity)
--kernel-path|-K <arg> Specify a path to where the kernel .cl files are (default: "/usr/local/bin")
--kernel|-k <arg> Select kernel to use (poclbm or phatk - default: auto)
--load-balance Change multipool strategy from failover to even load balance
@@ -179,6 +179,10 @@ Single pool, dedicated miner:
cgminer -o http://pool:port -u username -p password -I 9
+Single pool, first card regular desktop, 3 other dedicated cards:
+
+cgminer -o http://pool:port -u username -p password -I d,9,9,9
+
Multiple pool, dedicated miner:
cgminer -o http://pool1:port -u pool1username -p pool1password -o http://pool2:port -u pool2usernmae -p pool2password -I 9
@@ -215,9 +219,7 @@ Current pool management strategy: Failover
S gives you:
-[D]ynamic mode: On
[L]ongpoll: On
-[I]ntensity: Dynamic
[Q]ueue: 0
[S]cantime: 60
[R]etries: -1
@@ -270,7 +272,7 @@ The number of hardware erorrs
The utility defines as the number of shares / minute
The cgminer status line shows:
- TQ: 1 ST: 1 SS: 0 DW: 0 NB: 1 LW: 8 GF: 1 RF: 1 I: 2
+ TQ: 1 ST: 1 SS: 0 DW: 0 NB: 1 LW: 8 GF: 1 RF: 1
TQ is Total Queued work items.
ST is STaged work items (ready to use).
@@ -280,7 +282,6 @@ NB is New Blocks detected on the network
LW is Locally generated Work items
GF is Getwork Fail Occasions (server slow to provide work)
RF is Remote Fail occasions (server slow to accept work)
-I is current Intensity (changes in dynamic mode).
NOTE: Running intensities above 9 with current hardware is likely to only
diminish return performance even if the hash rate might appear better. A good
@@ -471,7 +472,7 @@ not work on stale blocks, and having different blocks from two networks would
make it invalidate the work from each other.
Q: Can I change the intensity settings individually for each GPU?
-A: Not currently.
+A: Yes, pass a list separated by commas such as -I d,4,9,9
Q: Can I put multiple pools in the json config file?
A: Not currently, but you can use multiple config files and specify each with
diff --git a/main.c b/main.c
index c5cecda..e5fefb7 100644
--- a/main.c
+++ b/main.c
@@ -191,7 +191,6 @@ static int opt_fail_pause = 5;
static int fail_pause = 5;
static int opt_log_interval = 5;
bool opt_log_output = false;
-static bool opt_dynamic = true;
static int opt_queue = 1;
int opt_vectors;
int opt_worksize;
@@ -216,7 +215,6 @@ static bool forced_n_threads;
static int opt_n_threads;
static int mining_threads;
static int num_processors;
-static int scan_intensity;
bool use_curses = true;
static bool opt_submit_stale;
static bool opt_nogpu;
@@ -947,12 +945,6 @@ static char *set_int_0_to_9999(const char *arg, int *i)
return set_int_range(arg, i, 0, 9999);
}
-static char *forced_int_1010(const char *arg, int *i)
-{
- opt_dynamic = false;
- return set_int_range(arg, i, -10, 10);
-}
-
static char *force_nthreads_int(const char *arg, int *i)
{
forced_n_threads = true;
@@ -1370,6 +1362,50 @@ static char *set_temp_target(char *arg)
return NULL;
}
#endif
+#ifdef HAVE_OPENCL
+static char *set_intensity(char *arg)
+{
+ int i, device = 0, *tt;
+ char *nextptr, val = 0;
+
+ nextptr = strtok(arg, ",");
+ if (nextptr == NULL)
+ return "Invalid parameters for set intensity";
+ if (!strncasecmp(nextptr, "d", 1))
+ gpus[device].dynamic = true;
+ else {
+ val = atoi(nextptr);
+ if (val < -10 || val > 10)
+ return "Invalid value passed to set intensity";
+ tt = &gpus[device].intensity;
+ *tt = val;
+ }
+
+ device++;
+
+ while ((nextptr = strtok(NULL, ",")) != NULL) {
+ if (!strncasecmp(nextptr, "d", 1))
+ gpus[device].dynamic = true;
+ else {
+ val = atoi(nextptr);
+ if (val < -10 || val > 10)
+ return "Invalid value passed to set intensity";
+
+ tt = &gpus[device].intensity;
+ *tt = val;
+ }
+ device++;
+ }
+ if (device == 1) {
+ for (i = device; i < MAX_GPUDEVICES; i++) {
+ gpus[i].dynamic = gpus[0].dynamic;
+ gpus[i].intensity = gpus[0].intensity;
+ }
+ }
+
+ return NULL;
+}
+#endif
/* These options are available from config file or commandline */
static struct opt_table opt_config_table[] = {
@@ -1449,8 +1485,8 @@ static struct opt_table opt_config_table[] = {
"Set the GPU voltage in Volts - one value for all or separate by commas for per card"),
#endif
OPT_WITH_ARG("--intensity|-I",
- forced_int_1010, NULL, &scan_intensity,
- "Intensity of GPU scanning (-10 -> 10, default: dynamic to maintain desktop interactivity)"),
+ set_intensity, NULL, NULL,
+ "Intensity of GPU scanning (d or -10 -> 10, default: d to maintain desktop interactivity)"),
OPT_WITH_ARG("--kernel-path|-K",
opt_set_charp, opt_show_charp, &opt_kernel_path,
"Specify a path to where the kernel .cl files are"),
@@ -1854,9 +1890,9 @@ static void curses_print_status(void)
mvwhline(statuswin, 1, 0, '-', 80);
mvwprintw(statuswin, 2, 0, " %s", statusline);
wclrtoeol(statuswin);
- mvwprintw(statuswin, 3, 0, " TQ: %d ST: %d SS: %d DW: %d NB: %d LW: %d GF: %d RF: %d I: %d",
+ mvwprintw(statuswin, 3, 0, " TQ: %d ST: %d SS: %d DW: %d NB: %d LW: %d GF: %d RF: %d",
total_queued, requests_staged(), total_stale, total_discarded, new_blocks,
- local_work, total_go, total_ro, scan_intensity);
+ local_work, total_go, total_ro);
wclrtoeol(statuswin);
if (pool_strategy == POOL_LOADBALANCE && total_pools > 1)
mvwprintw(statuswin, 4, 0, " Connected to multiple pools with%s LP",
@@ -3067,12 +3103,7 @@ static void set_options(void)
immedok(logwin, true);
clear_logwin();
retry:
- wlogprint("\n[D]ynamic mode: %s\n[L]ongpoll: %s\n",
- opt_dynamic ? "On" : "Off", want_longpoll ? "On" : "Off");
- if (opt_dynamic)
- wlogprint("[I]ntensity: Dynamic\n");
- else
- wlogprint("[I]ntensity: %d\n", scan_intensity);
+ wlogprint("\n[L]ongpoll: %s\n", want_longpoll ? "On" : "Off");
wlogprint("[Q]ueue: %d\n[S]cantime: %d\n[R]etries: %d\n[P]ause: %d\n",
opt_queue, opt_scantime, opt_retries, opt_fail_pause);
wlogprint("Select an option or any other key to return\n");
@@ -3086,23 +3117,11 @@ retry:
}
opt_queue = selected;
goto retry;
- } else if (!strncasecmp(&input, "d", 1)) {
- opt_dynamic ^= true;
- goto retry;
} else if (!strncasecmp(&input, "l", 1)) {
want_longpoll ^= true;
applog(LOG_WARNING, "Longpoll %s", want_longpoll ? "enabled" : "disabled");
restart_longpoll();
goto retry;
- } else if (!strncasecmp(&input, "i", 1)) {
- selected = curses_int("Set GPU scan intensity (-10 -> 10)");
- if (selected < -10 || selected > 10) {
- wlogprint("Invalid selection\n");
- goto retry;
- }
- opt_dynamic = false;
- scan_intensity = selected;
- goto retry;
} else if (!strncasecmp(&input, "s", 1)) {
selected = curses_int("Set scantime in seconds");
if (selected < 0 || selected > 9999) {
@@ -3194,6 +3213,11 @@ retry:
}
#endif
wlog("Last initialised: %s\n", cgpu->init);
+ wlog("Intensity: ");
+ if (gpus[gpu].dynamic)
+ wlog("Dynamic\n");
+ else
+ wlog("%u\n", gpus[gpu].intensity);
for (i = 0; i < mining_threads; i++) {
thr = &thr_info[i];
if (thr->cgpu != cgpu)
@@ -3220,7 +3244,7 @@ retry:
wlog("\n");
}
- wlogprint("[E]nable [D]isable [R]estart GPU %s\n",adl_active ? "[C]hange settings" : "");
+ wlogprint("[E]nable [D]isable [I]ntensity [R]estart GPU %s\n",adl_active ? "[C]hange settings" : "");
wlogprint("Or press any other key to continue\n");
input = getch();
@@ -3269,6 +3293,37 @@ retry:
}
gpu_devices[selected] = false;
goto retry;
+ } else if (!strncasecmp(&input, "i", 1)) {
+ int intensity;
+ char *intvar;
+
+ if (selected)
+ selected = curses_int("Select GPU to change intensity on");
+ if (selected < 0 || selected >= nDevs) {
+ wlogprint("Invalid selection\n");
+ goto retry;
+ }
+ intvar = curses_input("Set GPU scan intensity (d or -10 -> 10)");
+ if (!intvar) {
+ wlogprint("Invalid input\n");
+ goto retry;
+ }
+ if (!strncasecmp(intvar, "d", 1)) {
+ wlogprint("Dynamic mode enabled on gpu %d\n", selected);
+ gpus[selected].dynamic = true;
+ free(intvar);
+ goto retry;
+ }
+ intensity = atoi(intvar);
+ free(intvar);
+ if (intensity < -10 || intensity > 10) {
+ wlogprint("Invalid selection\n");
+ goto retry;
+ }
+ gpus[selected].dynamic = false;
+ gpus[selected].intensity = intensity;
+ wlogprint("Intensity on gpu %d set to %d\n", selected, intensity);
+ goto retry;
} else if (!strncasecmp(&input, "r", 1)) {
if (selected)
selected = curses_int("Select GPU to attempt to restart");
@@ -4152,9 +4207,9 @@ static cl_int queue_phatk_kernel(_clState *clState, dev_blk_ctx *blk)
static void set_threads_hashes(unsigned int vectors, unsigned int *threads,
unsigned int *hashes, size_t *globalThreads,
- unsigned int minthreads)
+ unsigned int minthreads, int intensity)
{
- *threads = 1 << (15 + scan_intensity);
+ *threads = 1 << (15 + intensity);
if (*threads < minthreads)
*threads = minthreads;
*globalThreads = *threads;
@@ -4203,12 +4258,6 @@ static void *gpuminer_thread(void *userdata)
break;
}
- if (opt_dynamic) {
- /* Minimise impact on desktop if we want dynamic mode */
- setpriority(PRIO_PROCESS, 0, 19);
- drop_policy();
- }
-
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
res = calloc(BUFFERSIZE, 1);
@@ -4222,7 +4271,7 @@ static void *gpuminer_thread(void *userdata)
gettimeofday(&tv_start, NULL);
localThreads[0] = clState->work_size;
set_threads_hashes(vectors, &threads, &hashes, &globalThreads[0],
- localThreads[0]);
+ localThreads[0], gpus[gpu].intensity);
diff.tv_sec = 0;
gettimeofday(&tv_end, NULL);
@@ -4262,19 +4311,20 @@ static void *gpuminer_thread(void *userdata)
timeval_subtract(&diff, &tv_gpuend, &tv_gpustart);
gpu_us = diff.tv_sec * 1000000 + diff.tv_usec;
decay_time(&gpu_ms_average, gpu_us / 1000);
- if (opt_dynamic) {
+ if (gpus[gpu].dynamic) {
/* Try to not let the GPU be out for longer than 6ms, but
* increase intensity when the system is idle, unless
* dynamic is disabled. */
if (gpu_ms_average > 7) {
- if (scan_intensity > -10)
- scan_intensity--;
+ if (gpus[gpu].intensity > -10)
+ gpus[gpu].intensity--;
} else if (gpu_ms_average < 3) {
- if (scan_intensity < 10)
- scan_intensity++;
+ if (gpus[gpu].intensity < 10)
+ gpus[gpu].intensity++;
}
}
- set_threads_hashes(vectors, &threads, &hashes, globalThreads, localThreads[0]);
+ set_threads_hashes(vectors, &threads, &hashes, globalThreads,
+ localThreads[0], gpus[gpu].intensity);
if (diff.tv_sec > opt_scantime ||
work->blk.nonce >= MAXTHREADS - hashes ||
@@ -5213,8 +5263,10 @@ int main (int argc, char *argv[])
#ifdef HAVE_OPENCL
if (!skip_to_bench) {
- for (i = 0; i < MAX_GPUDEVICES; i++)
+ for (i = 0; i < MAX_GPUDEVICES; i++) {
gpu_devices[i] = false;
+ gpus[i].dynamic = true;
+ }
nDevs = clDevicesNum();
if (nDevs < 0) {
applog(LOG_ERR, "clDevicesNum returned error, none usable");
diff --git a/miner.h b/miner.h
index 5fa8331..52e4993 100644
--- a/miner.h
+++ b/miner.h
@@ -202,6 +202,8 @@ struct cgpu_info {
char init[40];
struct timeval last_message_tv;
+ bool dynamic;
+ int intensity;
#ifdef HAVE_ADL
bool has_adl;
struct gpu_adl adl;