Sick/dead handling for non-gpus
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
diff --git a/cgminer.c b/cgminer.c
index cef4c8c..db1339d 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -4347,19 +4347,18 @@ static void *watchdog_thread(void __maybe_unused *userdata)
struct thr_info *thr = cgpu->thr[0];
enum dev_enable *denable;
int gpu;
+ char dev_str[8];
- if (cgpu->api->get_stats) {
- cgpu->api->get_stats(cgpu);
- }
+ if (cgpu->api->get_stats)
+ cgpu->api->get_stats(cgpu);
-#ifdef HAVE_OPENCL
- if (cgpu->api != &opencl_api)
- continue;
/* Use only one thread per device to determine if the GPU is healthy */
if (i >= nDevs)
break;
gpu = thr->cgpu->device_id;
denable = &cgpu->deven;
+ sprintf(dev_str, "%s%d", cgpu->api->name, gpu);
+
#ifdef HAVE_ADL
if (adl_active && gpus[gpu].has_adl)
gpu_autotune(gpu, denable);
@@ -4378,13 +4377,13 @@ static void *watchdog_thread(void __maybe_unused *userdata)
continue;
if (gpus[gpu].status != LIFE_WELL && now.tv_sec - thr->last.tv_sec < 60) {
- applog(LOG_ERR, "Device %d recovered, GPU %d declared WELL!", i, gpu);
+ applog(LOG_ERR, "%s: Recovered, declaring WELL!", dev_str);
gpus[gpu].status = LIFE_WELL;
gpus[gpu].device_last_well = time(NULL);
} else if (now.tv_sec - thr->last.tv_sec > 60 && gpus[gpu].status == LIFE_WELL) {
thr->rolling = thr->cgpu->rolling = 0;
gpus[gpu].status = LIFE_SICK;
- applog(LOG_ERR, "Device %d idle for more than 60 seconds, GPU %d declared SICK!", i, gpu);
+ applog(LOG_ERR, "%s: Idle for more than 60 seconds, declaring SICK!", dev_str);
gettimeofday(&thr->sick, NULL);
gpus[gpu].device_last_not_well = time(NULL);
@@ -4397,12 +4396,12 @@ static void *watchdog_thread(void __maybe_unused *userdata)
} else
#endif
if (opt_restart) {
- applog(LOG_ERR, "Attempting to restart GPU");
+ applog(LOG_ERR, "%s: Attempting to restart", dev_str);
reinit_device(thr->cgpu);
}
} else if (now.tv_sec - thr->last.tv_sec > 600 && gpus[i].status == LIFE_SICK) {
gpus[gpu].status = LIFE_DEAD;
- applog(LOG_ERR, "Device %d not responding for more than 10 minutes, GPU %d declared DEAD!", i, gpu);
+ applog(LOG_ERR, "%s: Not responded for more than 10 minutes, declaring DEAD!", dev_str);
gettimeofday(&thr->sick, NULL);
gpus[gpu].device_last_not_well = time(NULL);
@@ -4420,9 +4419,7 @@ static void *watchdog_thread(void __maybe_unused *userdata)
if (opt_restart)
reinit_device(thr->cgpu);
}
-#endif /* HAVE_OPENCL */
}
-
}
return NULL;
@@ -5296,6 +5293,7 @@ begin_bench:
quit(1, "watchdog thread create failed");
pthread_detach(thr->pth);
+#ifdef HAVE_OPENCL
/* Create reinit gpu thread */
gpur_thr_id = mining_threads + 4;
thr = &thr_info[gpur_thr_id];
@@ -5304,6 +5302,7 @@ begin_bench:
quit(1, "tq_new failed for gpur_thr_id");
if (thr_info_create(thr, NULL, reinit_gpu, thr))
quit(1, "reinit_gpu thread create failed");
+#endif
/* Create API socket thread */
api_thr_id = mining_threads + 5;
@@ -5312,6 +5311,7 @@ begin_bench:
quit(1, "API thread create failed");
pthread_detach(thr->pth);
+
#ifdef HAVE_CURSES
/* Create curses input thread for keyboard input. Create this last so
* that we know all threads are created since this can call kill_work