1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-14 16:58:05 +00:00

Reference correct GPU and only try to restart if it reaches DEAD.

This commit is contained in:
Con Kolivas 2011-07-30 02:16:29 +10:00
parent 947a74bfa3
commit bb575a5585

23
main.c
View File

@ -3550,24 +3550,23 @@ static void *watchdog_thread(void *userdata)
//for (i = 0; i < mining_threads; i++) { //for (i = 0; i < mining_threads; i++) {
for (i = 0; i < gpu_threads; i++) { for (i = 0; i < gpu_threads; i++) {
struct thr_info *thr = &thr_info[i]; struct thr_info *thr = &thr_info[i];
int gpu = thr->cgpu->cpu_gpu;
/* Thread is waiting on getwork or disabled */ /* Thread is waiting on getwork or disabled */
if (thr->getwork || !gpu_devices[i]) if (thr->getwork || !gpu_devices[gpu])
continue; continue;
if (gpus[i].status != LIFE_WELL && now.tv_sec - thr->last.tv_sec < 60) { if (gpus[gpu].status != LIFE_WELL && now.tv_sec - thr->last.tv_sec < 60) {
applog(LOG_ERR, "Thread %d recovered, GPU %d declared WELL!", i, gpus[i]); applog(LOG_ERR, "Thread %d recovered, GPU %d declared WELL!", i, gpu);
gpus[i].status = LIFE_WELL; gpus[gpu].status = LIFE_WELL;
} else if (now.tv_sec - thr->last.tv_sec > 60 && gpus[i].status == LIFE_WELL) { } else if (now.tv_sec - thr->last.tv_sec > 60 && gpus[gpu].status == LIFE_WELL) {
thr->rolling = thr->cgpu->rolling = 0; thr->rolling = thr->cgpu->rolling = 0;
gpus[i].status = LIFE_SICK; gpus[gpu].status = LIFE_SICK;
applog(LOG_ERR, "Thread %d idle for more than 60 seconds, GPU %d declared SICK!", i, gpus[i]); applog(LOG_ERR, "Thread %d idle for more than 60 seconds, GPU %d declared SICK!", i, gpu);
applog(LOG_ERR, "Attempting to restart thread");
reinit_thread(thr);
} else if (now.tv_sec - thr->last.tv_sec > 600 && gpus[i].status == LIFE_SICK) { } else if (now.tv_sec - thr->last.tv_sec > 600 && gpus[i].status == LIFE_SICK) {
gpus[i].status = LIFE_DEAD; gpus[gpu].status = LIFE_DEAD;
applog(LOG_ERR, "Thread %d idle for more than 10 minutes, GPU %d declared DEAD!", i, gpus[i]); applog(LOG_ERR, "Thread %d idle for more than 10 minutes, GPU %d declared DEAD!", i, gpu);
applog(LOG_ERR, "Attempting to restart thread one last time"); applog(LOG_ERR, "Attempting to restart thread");
reinit_thread(thr); reinit_thread(thr);
} }
} }