Allow the refresh interval to be adjusted in dynamic intensity with a --gpu-dyninterval parameter.
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
diff --git a/README b/README
index c1d63fb..f3c0a26 100644
--- a/README
+++ b/README
@@ -173,6 +173,7 @@ GPU only options:
--device|-d <arg> Select device to use, (Use repeat -d for multiple devices, default: all)
--disable-gpu|-G Disable GPU mining even if suitable devices exist
--gpu-threads|-g <arg> Number of threads per GPU (1 - 10) (default: 2)
+--gpu-dyninterval <arg> Set the refresh interval in ms for GPUs using dynamic intensity (default: 7)
--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> GPU fan percentage range - one value, range and/or comma separated list (e.g. 25-85,85,65)
--gpu-memclock <arg> Set the GPU memory (over)clock in Mhz - one value for all or separate by commas for per card.
diff --git a/cgminer.c b/cgminer.c
index fc8c683..f61bf4d 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -100,6 +100,7 @@ int opt_bench_algo = -1;
static const bool opt_time = true;
#ifdef HAVE_OPENCL
+int opt_dynamic_interval = 7;
static bool opt_restart = true;
static bool opt_nogpu;
#endif
@@ -674,6 +675,9 @@ static struct opt_table opt_config_table[] = {
opt_set_bool, &opt_fail_only,
"Don't leak work to backup pools when primary pool is lagging"),
#ifdef HAVE_OPENCL
+ OPT_WITH_ARG("--gpu-dyninterval",
+ set_int_1_to_65535, opt_show_intval, &opt_dynamic_interval,
+ "Set the refresh interval in ms for GPUs using dynamic intensity"),
OPT_WITH_ARG("--gpu-platform",
set_int_0_to_9999, opt_show_intval, &opt_platform_id,
"Select OpenCL platform ID to use for GPU mining"),
diff --git a/device-gpu.c b/device-gpu.c
index 2113dc9..687e3d2 100644
--- a/device-gpu.c
+++ b/device-gpu.c
@@ -1176,6 +1176,8 @@ static bool opencl_prepare_work(struct thr_info __maybe_unused *thr, struct work
return true;
}
+extern int opt_dynamic_interval;
+
static uint64_t opencl_scanhash(struct thr_info *thr, struct work *work,
uint64_t __maybe_unused max_nonce)
{
@@ -1209,10 +1211,10 @@ static uint64_t opencl_scanhash(struct thr_info *thr, struct work *work,
/* 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 (gpu_ms_average > opt_dynamic_interval) {
if (gpu->intensity > MIN_INTENSITY)
--gpu->intensity;
- } else if (gpu_ms_average < 3) {
+ } else if (gpu_ms_average < ((opt_dynamic_interval / 2) ? : 1)) {
if (gpu->intensity < MAX_INTENSITY)
++gpu->intensity;
}