Browse Source

Initialise devices before attempting to connect to pools to allow their thread prepare function to be called before having to connect to pools.

Conflicts:
	cgminer.c
nfactor-troky
Con Kolivas 11 years ago committed by Noel Maersk
parent
commit
79521fe8f0
  1. 69
      cgminer.c

69
cgminer.c

@ -7801,6 +7801,37 @@ int main(int argc, char *argv[])
quit(1, "Failed to calloc mining_thr[%d]", i); quit(1, "Failed to calloc mining_thr[%d]", i);
} }
// Start threads
k = 0;
for (i = 0; i < total_devices; ++i) {
struct cgpu_info *cgpu = devices[i];
cgpu->thr = malloc(sizeof(*cgpu->thr) * (cgpu->threads+1));
cgpu->thr[cgpu->threads] = NULL;
cgpu->status = LIFE_INIT;
for (j = 0; j < cgpu->threads; ++j, ++k) {
thr = get_thread(k);
thr->id = k;
thr->cgpu = cgpu;
thr->device_thread = j;
if (!cgpu->drv->thread_prepare(thr))
continue;
if (unlikely(thr_info_create(thr, NULL, miner_thread, thr)))
quit(1, "thread %d create failed", thr->id);
cgpu->thr[j] = thr;
/* Enable threads for devices set not to mine but disable
* their queue in case we wish to enable them later */
if (cgpu->deven != DEV_DISABLED) {
applog(LOG_DEBUG, "Pushing sem post to thread %d", thr->id);
cgsem_post(&thr->sem);
}
}
}
if (opt_benchmark) if (opt_benchmark)
goto begin_bench; goto begin_bench;
@ -7858,44 +7889,6 @@ begin_bench:
cgtime(&total_tv_end); cgtime(&total_tv_end);
get_datestamp(datestamp, sizeof(datestamp), &total_tv_start); get_datestamp(datestamp, sizeof(datestamp), &total_tv_start);
// Start threads
k = 0;
for (i = 0; i < total_devices; ++i) {
struct cgpu_info *cgpu = devices[i];
cgpu->thr = malloc(sizeof(*cgpu->thr) * (cgpu->threads+1));
cgpu->thr[cgpu->threads] = NULL;
cgpu->status = LIFE_INIT;
for (j = 0; j < cgpu->threads; ++j, ++k) {
thr = get_thread(k);
thr->id = k;
thr->cgpu = cgpu;
thr->device_thread = j;
if (!cgpu->drv->thread_prepare(thr))
continue;
if (unlikely(thr_info_create(thr, NULL, miner_thread, thr)))
quit(1, "thread %d create failed", thr->id);
cgpu->thr[j] = thr;
/* Enable threads for devices set not to mine but disable
* their queue in case we wish to enable them later */
if (cgpu->deven != DEV_DISABLED) {
applog(LOG_DEBUG, "Pushing sem post to thread %d", thr->id);
cgsem_post(&thr->sem);
}
}
}
applog(LOG_INFO, "%d gpu miner threads started", gpu_threads);
for (i = 0; i < nDevs; i++)
pause_dynamic_threads(i);
cgtime(&total_tv_start);
cgtime(&total_tv_end);
watchpool_thr_id = 2; watchpool_thr_id = 2;
thr = &control_thr[watchpool_thr_id]; thr = &control_thr[watchpool_thr_id];
/* start watchpool thread */ /* start watchpool thread */

Loading…
Cancel
Save