Implement accepting a range of engine speeds as well to allow a lower limit to be specified on the command line.
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
diff --git a/README b/README
index ae4bfea..fe801a8 100644
--- a/README
+++ b/README
@@ -116,7 +116,7 @@ Options for both config file and command line:
--enable-cpu|-C Enable CPU mining with GPU mining (default: no CPU mining if suitable GPUs exist)
--failover-only Don't leak work to backup pools when primary pool is lagging
--gpu-threads|-g <arg> Number of threads per GPU (1 - 10) (default: 2)
---gpu-engine <arg> Set the GPU engine (over)clock in Mhz - one value for all or separate by commas for per card.
+--gpu-engine <arg> GPU engine (over)clock range in Mhz - one value, range and/or comma separated list (e.g. 850-900,900,750-850)
--gpu-fan <arg> Set the GPU fan percentage - one value for all or separate by commas for per card.
--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.
@@ -180,11 +180,11 @@ cgminer -o http://pool1:port -u pool1username -p pool1password -o http://pool2:p
Add overclocking settings, GPU and fan control for all cards:
-cgminer -o http://pool:port -u username -p password -I 9 --auto-fan --auto-gpu --gpu-engine 950 --gpu-memclock 300
+cgminer -o http://pool:port -u username -p password -I 9 --auto-fan --auto-gpu --gpu-engine 750-950 --gpu-memclock 300
Add overclocking settings, GPU and fan control with different engine settings for 4 cards:
-cgminer -o http://pool:port -u username -p password -I 9 --auto-fan --auto-gpu --gpu-engine 950,945,930,960 --gpu-memclock 300
+cgminer -o http://pool:port -u username -p password -I 9 --auto-fan --auto-gpu --gpu-engine 750-950,945,700-930,960 --gpu-memclock 300
READ WARNINGS AND DOCUMENTATION BELOW ABOUT OVERCLOCKING
@@ -358,6 +358,9 @@ temperature. By default this is set to 75 degrees C but can be changed with:
--temp-target
AUTO FAN:
+i.e.
+--auto-fan
+
Fan control in auto fan works off the theory that the minimum possible fan
required to maintain an optimal temperature will use less power, make less
noise, and prolong the life of the fan. In auto-fan mode, the fan speed is
@@ -369,10 +372,14 @@ is set to 85 degrees by default and can be changed with:
--temp-overheat
AUTO GPU:
+e.g.
+--auto-gpu --gpu-engine 750-950
+--auto-gpu --gpu-engine 750-950,945,700-930,960
+
GPU control in auto gpu tries to maintain as high a clock speed as possible
while not reaching overheat temperatures. As a lower clock speed limit,
the auto-gpu mode checks the GPU card's "normal" clock speed and will not go
-below this unless you have manually set a lower speed at some time. Also,
+below this unless you have manually set a lower speed in the range. Also,
unless a higher clock speed was specified at startup, it will not raise the
clockspeed. If the temperature climbs, fanspeed is adjusted and optimised
before GPU engine clockspeed is adjusted. If fan speed control is not available
diff --git a/adl.c b/adl.c
index 13ffb5a..51be7df 100644
--- a/adl.c
+++ b/adl.c
@@ -261,6 +261,9 @@ void init_adl(int nDevs)
lpOdPerformanceLevels->aLevels[lev].iEngineClock = setengine;
applog(LOG_INFO, "Setting GPU %d engine clock to %d", gpu, gpus[gpu].gpu_engine);
ADL_Overdrive5_ODPerformanceLevels_Set(iAdapterIndex, lpOdPerformanceLevels);
+ ga->maxspeed = setengine;
+ if (gpus[gpu].min_engine)
+ ga->minspeed = gpus[gpu].min_engine * 100;
}
if (gpus[gpu].gpu_memclock) {
int setmem = gpus[gpu].gpu_memclock * 100;
@@ -289,11 +292,6 @@ void init_adl(int nDevs)
ga->iMemoryClock = lpOdPerformanceLevels->aLevels[lev].iMemoryClock;
ga->iVddc = lpOdPerformanceLevels->aLevels[lev].iVddc;
- if (ga->iEngineClock < ga->minspeed)
- ga->minspeed = ga->iEngineClock;
- if (ga->iEngineClock > ga->maxspeed)
- ga->maxspeed = ga->iEngineClock;
-
if (ADL_Overdrive5_FanSpeedInfo_Get(iAdapterIndex, 0, &ga->lpFanSpeedInfo) != ADL_OK) {
applog(LOG_INFO, "Failed to ADL_Overdrive5_FanSpeedInfo_Get");
continue;
@@ -1012,7 +1010,8 @@ updated:
"Memory Clock: %d Mhz\nVddc: %.3f V\nActivity: %d%%\nPowertune: %d%%\n",
temp, fanpercent, fanspeed, engineclock, memclock, vddc, activity, powertune);
wlogprint("Fan autotune is %s\n", ga->autofan ? "enabled" : "disabled");
- wlogprint("GPU engine clock autotune is %s\n", ga->autoengine ? "enabled" : "disabled");
+ wlogprint("GPU engine clock autotune is %s (%d-%d)\n", ga->autoengine ? "enabled" : "disabled",
+ ga->minspeed / 100, ga->maxspeed / 100);
wlogprint("Change [A]utomatic [E]ngine [F]an [M]emory [V]oltage [P]owertune\n");
wlogprint("Or press any other key to continue\n");
input = getch();
diff --git a/main.c b/main.c
index 2fa302c..ddccb3c 100644
--- a/main.c
+++ b/main.c
@@ -1117,29 +1117,45 @@ static char *set_schedtime(const char *arg, struct schedtime *st)
}
#ifdef HAVE_ADL
+static void get_intrange(char *arg, int *val1, int *val2)
+{
+ if (sscanf(arg, "%d-%d", val1, val2) == 1) {
+ *val2 = *val1;
+ *val1 = 0;
+ }
+}
+
static char *set_gpu_engine(char *arg)
{
- int i, val = 0, device = 0;
+ int i, val1 = 0, val2 = 0, device = 0;
char *nextptr;
nextptr = strtok(arg, ",");
if (nextptr == NULL)
return "Invalid parameters for set gpu engine";
- val = atoi(nextptr);
- if (val <= 0 || val >= 9999)
+ get_intrange(nextptr, &val1, &val2);
+ if (val1 < 0 || val1 > 9999 || val2 <= 0 || val2 > 9999)
return "Invalid value passed to set_gpu_engine";
- gpus[device++].gpu_engine = val;
+ gpus[device].min_engine = val1;
+ gpus[device].gpu_engine = val2;
+ device++;
while ((nextptr = strtok(NULL, ",")) != NULL) {
- val = atoi(nextptr);
- if (val <= 0 || val >= 9999)
+ get_intrange(nextptr, &val1, &val2);
+ if (val1 < 0 || val1 > 9999 || val2 <= 0 || val2 > 9999)
return "Invalid value passed to set_gpu_engine";
+ gpus[device].min_engine = val1;
+ gpus[device].gpu_engine = val2;
+ device++;
+ }
- gpus[device++].gpu_engine = val;
+ if (device == 1) {
+ for (i = 1; i < 16; i++) {
+ gpus[i].min_engine = gpus[0].min_engine;
+ gpus[i].gpu_engine = gpus[0].gpu_engine;
+ }
}
- for (i = device; i < 16; i++)
- gpus[i].gpu_engine = val;
return NULL;
}
@@ -1318,7 +1334,7 @@ static struct opt_table opt_config_table[] = {
#ifdef HAVE_ADL
OPT_WITH_ARG("--gpu-engine",
set_gpu_engine, NULL, NULL,
- "Set the GPU engine (over)clock in Mhz - one value for all or separate by commas for per card."),
+ "GPU engine (over)clock range in Mhz - one value, range and/or comma separated list (e.g. 850-900,900,750-850)"),
OPT_WITH_ARG("--gpu-fan",
set_gpu_fan, NULL, NULL,
"Set the GPU fan percentage - one value for all or separate by commas for per card."),
diff --git a/miner.h b/miner.h
index 5d9e22f..97d0d4e 100644
--- a/miner.h
+++ b/miner.h
@@ -205,7 +205,9 @@ struct cgpu_info {
bool has_adl;
struct gpu_adl adl;
int gpu_engine;
+ int min_engine;
int gpu_fan;
+ int min_fan;
int gpu_memclock;
int gpu_powertune;
float gpu_vddc;