diff --git a/ccminer.cpp b/ccminer.cpp index b919cb6..84bf772 100644 --- a/ccminer.cpp +++ b/ccminer.cpp @@ -340,11 +340,12 @@ struct option options[] = { { "max-rate", 1, NULL, 1062 }, { "pass", 1, NULL, 'p' }, { "pool-name", 1, NULL, 1100 }, // pool - { "pool-removed", 1, NULL, 1101 }, // pool + { "pool-algo", 1, NULL, 1101 }, // pool { "pool-scantime", 1, NULL, 1102 }, // pool { "pool-time-limit", 1, NULL, 1108 }, { "pool-max-diff", 1, NULL, 1161 }, // pool { "pool-max-rate", 1, NULL, 1162 }, // pool + { "pool-disabled", 1, NULL, 1199 }, // pool { "protocol-dump", 0, NULL, 'P' }, { "proxy", 1, NULL, 'x' }, { "quiet", 0, NULL, 'q' }, @@ -1633,6 +1634,9 @@ static void *miner_thread(void *userdata) /* conditional mining */ if (!wanna_mine(thr_id)) { + // free gpu resources + algo_free_all(thr_id); + // conditional pool switch if (num_pools > 1 && conditional_pool_rotate) { if (!pool_is_switching) @@ -2833,8 +2837,8 @@ void parse_arg(int key, char *arg) case 1100: /* pool name */ pool_set_attr(cur_pooln, "name", arg); break; - case 1101: /* pool removed */ - pool_set_attr(cur_pooln, "removed", arg); + case 1101: /* pool algo */ + pool_set_attr(cur_pooln, "algo", arg); break; case 1102: /* pool scantime */ pool_set_attr(cur_pooln, "scantime", arg); @@ -2848,6 +2852,9 @@ void parse_arg(int key, char *arg) case 1162: /* pool max-rate */ pool_set_attr(cur_pooln, "max-rate", arg); break; + case 1199: + pool_set_attr(cur_pooln, "disabled", arg); + break; case 'V': show_version_and_exit(); diff --git a/pools.cpp b/pools.cpp index 51405ef..387dccd 100644 --- a/pools.cpp +++ b/pools.cpp @@ -38,6 +38,8 @@ extern volatile int pool_switch_count; extern volatile bool pool_is_switching; extern uint8_t conditional_state[MAX_GPUS]; +extern double thr_hashrates[MAX_GPUS]; + extern struct option options[]; #define CFG_NULL 0 @@ -51,13 +53,12 @@ struct opt_config_array { { CFG_POOL, "user", NULL }, { CFG_POOL, "pass", NULL }, { CFG_POOL, "userpass", NULL }, - { CFG_POOL, "algo", NULL }, { CFG_POOL, "name", "pool-name" }, + { CFG_POOL, "algo", "pool-algo" }, { CFG_POOL, "scantime", "pool-scantime" }, { CFG_POOL, "max-diff", "pool-max-diff" }, { CFG_POOL, "max-rate", "pool-max-rate" }, - { CFG_POOL, "removed", "pool-removed" }, - { CFG_POOL, "disabled", "pool-removed" }, // sample alias + { CFG_POOL, "disabled", "pool-disabled" }, { CFG_POOL, "time-limit", "pool-time-limit" }, { CFG_NULL, NULL, NULL } }; @@ -117,14 +118,14 @@ void pool_init_defaults() void pool_set_attr(int pooln, const char* key, char* arg) { struct pool_infos *p = &pools[pooln]; - if (!strcasecmp(key, "algo")) { - p->algo = algo_to_int(arg); - return; - } if (!strcasecmp(key, "name")) { snprintf(p->name, sizeof(p->name), "%s", arg); return; } + if (!strcasecmp(key, "algo")) { + p->algo = algo_to_int(arg); + return; + } if (!strcasecmp(key, "scantime")) { p->scantime = atoi(arg); return; @@ -141,7 +142,7 @@ void pool_set_attr(int pooln, const char* key, char* arg) p->time_limit = atoi(arg); return; } - if (!strcasecmp(key, "removed")) { + if (!strcasecmp(key, "disabled")) { int removed = atoi(arg); if (removed) { p->status |= POOL_ST_REMOVED; @@ -154,6 +155,7 @@ void pool_set_attr(int pooln, const char* key, char* arg) bool pool_switch(int thr_id, int pooln) { int prevn = cur_pooln; + bool algo_switch = false; struct pool_infos *prev = &pools[cur_pooln]; struct pool_infos* p = NULL; @@ -195,6 +197,16 @@ bool pool_switch(int thr_id, int pooln) pthread_mutex_unlock(&stratum_work_lock); + // algo "blind" switch without free, not proper + if (p->algo != (int) opt_algo) { + opt_algo = (enum sha_algos) p->algo; + for (int n=0; n