Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make it possible to set the intensity on a per-card basis, dynamic or…

… static values.
  • Loading branch information...
commit 21c2bc469fb073018304e11c58c62a4291faea86 1 parent 5b40f97
@ckolivas ckolivas authored
Showing with 108 additions and 53 deletions.
  1. +7 −6 README
  2. +99 −47 main.c
  3. +2 −0  miner.h
View
13 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
View
146 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 @@ static void set_options(void)
}
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 @@ static void manage_gpu(void)
}
#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 @@ static void manage_gpu(void)
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 @@ static void manage_gpu(void)
}
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");
View
2  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;
Please sign in to comment.
Something went wrong with that request. Please try again.