From 212009a48aa566415a6531f076146fb8ad2dcbb4 Mon Sep 17 00:00:00 2001 From: ystarnaud Date: Mon, 23 Jun 2014 17:20:26 -0400 Subject: [PATCH] GPU Initialization update Moved the GPU initialization block to happen when a pool is actually switched to. Sometimes the first pool alive isn't the first pool switched to. This would result in unnecessary kernel loading if the first pool detected alive isn't used right away. --- sgminer.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sgminer.c b/sgminer.c index 9c751b13..a414fa48 100644 --- a/sgminer.c +++ b/sgminer.c @@ -4072,20 +4072,20 @@ void switch_pools(struct pool *selected) applog(LOG_WARNING, "Switching to %s", get_pool_name(pool)); if (pool_localgen(pool) || opt_fail_only) clear_pool_work(last_pool); + + //if startup, initialize gpus and start mining threads + if(startup) + { + startup = false; //remove startup flag so we don't enter this block again + applog(LOG_NOTICE, "Startup GPU initialization... Using settings from pool %s.", get_pool_name(pool)); + + //apply gpu settings based on first alive pool + apply_initial_gpu_settings(pool); + gpu_initialized = true; //gpus initialized + } } } - //if startup, initialize gpus and start mining threads - if(startup) - { - startup = false; //remove startup flag so we don't enter this block again - applog(LOG_NOTICE, "Startup GPU initialization... Using settings from pool %s.", get_pool_name(pool)); - - //apply gpu settings based on first alive pool - apply_initial_gpu_settings(pool); - gpu_initialized = true; //gpus initialized - } - mutex_lock(&lp_lock); pthread_cond_broadcast(&lp_cond); mutex_unlock(&lp_lock);