Merge pull request #78 from luke-jr/bugfix_adl Bugfix: Iterate over devices rather than threads for watchdog (and ADL)
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
diff --git a/main.c b/main.c
index 8b47e10..3ba39d5 100644
--- a/main.c
+++ b/main.c
@@ -5014,14 +5014,12 @@ static void *watchdog_thread(void *userdata)
}
#ifdef HAVE_OPENCL
- for (i = 0; i < mining_threads; i++) {
- struct thr_info *thr;
+ for (i = 0; i < total_devices; ++i) {
+ struct cgpu_info *cgpu = devices[i];
+ struct thr_info *thr = cgpu->thread;
bool *enable;
- struct cgpu_info *cgpu;
int gpu;
- thr = &thr_info[i];
- cgpu = thr->cgpu;
if (cgpu->api != &opencl_api)
continue;
/* Use only one thread per device to determine if the GPU is healthy */
@@ -6225,6 +6223,8 @@ retry_pools:
if (unlikely(thr_info_create(thr, NULL, miner_thread, thr)))
quit(1, "thread %d create failed", thr->id);
+
+ cgpu->thread = thr;
}
}
diff --git a/miner.h b/miner.h
index 9743fd6..7393ebd 100644
--- a/miner.h
+++ b/miner.h
@@ -252,6 +252,7 @@ struct cgpu_info {
struct timeval last_message_tv;
int threads;
+ struct thr_info *thread;
bool dynamic;
int intensity;