1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-08 22:08:02 +00:00

Fixed x13 and other issues

Corrected the x13 errors and fixed a few issues with the config parser's
handling of the default_profile.
This commit is contained in:
ystarnaud 2014-06-21 15:18:20 -04:00
parent 298a752150
commit 1914cef959
7 changed files with 324 additions and 203 deletions

4
api.c
View File

@ -3585,7 +3585,7 @@ void api(int api_thr_id)
struct sockaddr_in cli; struct sockaddr_in cli;
socklen_t clisiz; socklen_t clisiz;
char cmdbuf[100]; char cmdbuf[100];
char *cmd = NULL, *cmdptr, *cmdsbuf; char *cmd = NULL, *cmdptr, *cmdsbuf = NULL;
char *param; char *param;
bool addrok; bool addrok;
char group; char group;
@ -3593,7 +3593,7 @@ void api(int api_thr_id)
json_t *json_config = NULL; json_t *json_config = NULL;
json_t *json_val; json_t *json_val;
bool isjson; bool isjson;
bool did, isjoin, firstjoin; bool did, isjoin = false, firstjoin;
int i; int i;
SOCKETTYPE *apisock; SOCKETTYPE *apisock;

View File

@ -83,6 +83,7 @@ static struct profile *add_profile()
//default profile name is the profile index //default profile name is the profile index
sprintf(buf, "%d", profile->profile_no); sprintf(buf, "%d", profile->profile_no);
profile->name = strdup(buf); profile->name = strdup(buf);
profile->algorithm.name[0] = '\0';
profiles = (struct profile **)realloc(profiles, sizeof(struct profile *) * (total_profiles + 2)); profiles = (struct profile **)realloc(profiles, sizeof(struct profile *) * (total_profiles + 2));
profiles[total_profiles++] = profile; profiles[total_profiles++] = profile;
@ -146,6 +147,22 @@ static struct profile *get_profile(char *name)
} }
/******* Default profile functions used during config parsing *****/ /******* Default profile functions used during config parsing *****/
char *set_default_algorithm(const char *arg)
{
set_algorithm(&default_profile.algorithm, arg);
applog(LOG_INFO, "Set default algorithm to %s", default_profile.algorithm.name);
return NULL;
}
char *set_default_nfactor(const char *arg)
{
set_algorithm_nfactor(&default_profile.algorithm, (const uint8_t) atoi(arg));
applog(LOG_INFO, "Set algorithm N-factor to %d (N to %d)", default_profile.algorithm.nfactor);
return NULL;
}
char *set_default_devices(const char *arg) char *set_default_devices(const char *arg)
{ {
default_profile.devices = arg; default_profile.devices = arg;
@ -696,19 +713,24 @@ void load_default_profile()
//apply default settings //apply default settings
void apply_defaults() void apply_defaults()
{ {
set_algorithm(&opt_algorithm, default_profile.algorithm.name); //if no algorithm specified, use scrypt as default
if (empty_string(default_profile.algorithm.name))
set_algorithm(&default_profile.algorithm, "scrypt");
if (!empty_string(default_profile.devices)) //by default all unless specified
if (empty_string(default_profile.devices))
default_profile.devices = strdup("all");
set_devices((char *)default_profile.devices); set_devices((char *)default_profile.devices);
if (!empty_string(default_profile.intensity)) //set raw intensity first
set_intensity(default_profile.intensity);
if (!empty_string(default_profile.xintensity))
set_xintensity(default_profile.xintensity);
if (!empty_string(default_profile.rawintensity)) if (!empty_string(default_profile.rawintensity))
set_rawintensity(default_profile.rawintensity); set_rawintensity(default_profile.rawintensity);
//then try xintensity
else if (!empty_string(default_profile.xintensity))
set_xintensity(default_profile.xintensity);
//then try intensity
else if (!empty_string(default_profile.intensity))
set_intensity(default_profile.intensity);
if (!empty_string(default_profile.lookup_gap)) if (!empty_string(default_profile.lookup_gap))
set_lookup_gap((char *)default_profile.lookup_gap); set_lookup_gap((char *)default_profile.lookup_gap);
@ -758,68 +780,167 @@ void apply_pool_profile(struct pool *pool)
{ {
struct profile *profile; struct profile *profile;
//if the pool has a profile set //if the pool has a profile set load it
if(!empty_string(pool->profile)) if(!empty_string(pool->profile))
{ {
applog(LOG_DEBUG, "Loading settings from profile \"%s\" for pool %i", pool->profile, pool->pool_no); applog(LOG_DEBUG, "Loading settings from profile \"%s\" for pool %i", pool->profile, pool->pool_no);
//find profile and apply settings to the pool //find profile and apply settings to the pool
if((profile = get_profile(pool->profile))) if(!(profile = get_profile(pool->profile)))
{ {
//if not found, remove profile name and use default profile.
applog(LOG_DEBUG, "Profile load failed for pool %i: profile %s not found. Using default profile.", pool->pool_no, pool->profile);
//remove profile name
pool->profile[0] = '\0';
profile = &default_profile;
}
}
//no profile specified in pool, use default profile
else
{
applog(LOG_DEBUG, "Loading settings from default_profile for pool %i", pool->profile, pool->pool_no);
profile = &default_profile;
}
//only apply profiles settings not already defined in the pool
//if no algorithm is specified, use profile's or default profile's
if(empty_string(pool->algorithm.name))
{
if(!empty_string(profile->algorithm.name))
pool->algorithm = profile->algorithm; pool->algorithm = profile->algorithm;
else
pool->algorithm = default_profile.algorithm;
}
applog(LOG_DEBUG, "Pool %i Algorithm set to \"%s\"", pool->pool_no, pool->algorithm.name); applog(LOG_DEBUG, "Pool %i Algorithm set to \"%s\"", pool->pool_no, pool->algorithm.name);
if(pool_cmp(pool->devices, default_profile.devices))
{
if(!empty_string(profile->devices))
pool->devices = profile->devices; pool->devices = profile->devices;
else
pool->devices = default_profile.devices;
}
applog(LOG_DEBUG, "Pool %i devices set to \"%s\"", pool->pool_no, pool->devices); applog(LOG_DEBUG, "Pool %i devices set to \"%s\"", pool->pool_no, pool->devices);
if(pool_cmp(pool->lookup_gap, default_profile.lookup_gap))
{
if(!empty_string(profile->lookup_gap))
pool->lookup_gap = profile->lookup_gap; pool->lookup_gap = profile->lookup_gap;
else
pool->lookup_gap = default_profile.lookup_gap;
}
applog(LOG_DEBUG, "Pool %i lookup gap set to \"%s\"", pool->pool_no, pool->lookup_gap); applog(LOG_DEBUG, "Pool %i lookup gap set to \"%s\"", pool->pool_no, pool->lookup_gap);
if(pool_cmp(pool->intensity, default_profile.intensity))
{
if(!empty_string(profile->intensity))
pool->intensity = profile->intensity; pool->intensity = profile->intensity;
else
pool->intensity = default_profile.intensity;
}
applog(LOG_DEBUG, "Pool %i Intensity set to \"%s\"", pool->pool_no, pool->intensity); applog(LOG_DEBUG, "Pool %i Intensity set to \"%s\"", pool->pool_no, pool->intensity);
if(pool_cmp(pool->xintensity, default_profile.xintensity))
{
if(!empty_string(profile->xintensity))
pool->xintensity = profile->xintensity; pool->xintensity = profile->xintensity;
else
pool->xintensity = default_profile.xintensity;
}
applog(LOG_DEBUG, "Pool %i XIntensity set to \"%s\"", pool->pool_no, pool->xintensity); applog(LOG_DEBUG, "Pool %i XIntensity set to \"%s\"", pool->pool_no, pool->xintensity);
if(pool_cmp(pool->rawintensity, default_profile.rawintensity))
{
if(!empty_string(profile->rawintensity))
pool->rawintensity = profile->rawintensity; pool->rawintensity = profile->rawintensity;
else
pool->rawintensity = default_profile.rawintensity;
}
applog(LOG_DEBUG, "Pool %i Raw Intensity set to \"%s\"", pool->pool_no, pool->rawintensity); applog(LOG_DEBUG, "Pool %i Raw Intensity set to \"%s\"", pool->pool_no, pool->rawintensity);
if(pool_cmp(pool->thread_concurrency, default_profile.thread_concurrency))
{
if(!empty_string(profile->thread_concurrency))
pool->thread_concurrency = profile->thread_concurrency; pool->thread_concurrency = profile->thread_concurrency;
else
pool->thread_concurrency = default_profile.thread_concurrency;
}
applog(LOG_DEBUG, "Pool %i Thread Concurrency set to \"%s\"", pool->pool_no, pool->thread_concurrency); applog(LOG_DEBUG, "Pool %i Thread Concurrency set to \"%s\"", pool->pool_no, pool->thread_concurrency);
#ifdef HAVE_ADL #ifdef HAVE_ADL
if(pool_cmp(pool->gpu_engine, default_profile.gpu_engine))
{
if(!empty_string(profile->gpu_engine))
pool->gpu_engine = profile->gpu_engine; pool->gpu_engine = profile->gpu_engine;
else
pool->gpu_engine = default_profile.gpu_engine;
}
applog(LOG_DEBUG, "Pool %i GPU Clock set to \"%s\"", pool->pool_no, pool->gpu_engine); applog(LOG_DEBUG, "Pool %i GPU Clock set to \"%s\"", pool->pool_no, pool->gpu_engine);
if(pool_cmp(pool->gpu_memclock, default_profile.gpu_memclock))
{
if(!empty_string(profile->gpu_memclock))
pool->gpu_memclock = profile->gpu_memclock; pool->gpu_memclock = profile->gpu_memclock;
else
pool->gpu_memclock = default_profile.gpu_memclock;
}
applog(LOG_DEBUG, "Pool %i GPU Memory clock set to \"%s\"", pool->pool_no, pool->gpu_memclock); applog(LOG_DEBUG, "Pool %i GPU Memory clock set to \"%s\"", pool->pool_no, pool->gpu_memclock);
if(pool_cmp(pool->gpu_threads, default_profile.gpu_threads))
{
if(!empty_string(profile->gpu_threads))
pool->gpu_threads = profile->gpu_threads; pool->gpu_threads = profile->gpu_threads;
else
pool->gpu_threads = default_profile.gpu_threads;
}
applog(LOG_DEBUG, "Pool %i GPU Threads set to \"%s\"", pool->pool_no, pool->gpu_threads); applog(LOG_DEBUG, "Pool %i GPU Threads set to \"%s\"", pool->pool_no, pool->gpu_threads);
if(pool_cmp(pool->gpu_fan, default_profile.gpu_fan))
{
if(!empty_string(profile->gpu_fan))
pool->gpu_fan = profile->gpu_fan; pool->gpu_fan = profile->gpu_fan;
else
pool->gpu_fan = default_profile.gpu_fan;
}
applog(LOG_DEBUG, "Pool %i GPU Fan set to \"%s\"", pool->pool_no, pool->gpu_fan); applog(LOG_DEBUG, "Pool %i GPU Fan set to \"%s\"", pool->pool_no, pool->gpu_fan);
if(pool_cmp(pool->gpu_powertune, default_profile.gpu_powertune))
{
if(!empty_string(profile->gpu_powertune))
pool->gpu_powertune = profile->gpu_powertune; pool->gpu_powertune = profile->gpu_powertune;
else
pool->gpu_powertune = default_profile.gpu_powertune;
}
applog(LOG_DEBUG, "Pool %i GPU Powertune set to \"%s\"", pool->pool_no, pool->gpu_powertune); applog(LOG_DEBUG, "Pool %i GPU Powertune set to \"%s\"", pool->pool_no, pool->gpu_powertune);
if(pool_cmp(pool->gpu_vddc, default_profile.gpu_vddc))
{
if(!empty_string(profile->gpu_vddc))
pool->gpu_vddc = profile->gpu_vddc; pool->gpu_vddc = profile->gpu_vddc;
else
pool->gpu_vddc = default_profile.gpu_vddc;
}
applog(LOG_DEBUG, "Pool %i GPU Vddc set to \"%s\"", pool->pool_no, pool->gpu_vddc); applog(LOG_DEBUG, "Pool %i GPU Vddc set to \"%s\"", pool->pool_no, pool->gpu_vddc);
#endif #endif
if(pool_cmp(pool->shaders, default_profile.shaders))
{
if(!empty_string(profile->shaders))
pool->shaders = profile->shaders; pool->shaders = profile->shaders;
else
pool->shaders = default_profile.shaders;
}
applog(LOG_DEBUG, "Pool %i Shaders set to \"%s\"", pool->pool_no, pool->shaders); applog(LOG_DEBUG, "Pool %i Shaders set to \"%s\"", pool->pool_no, pool->shaders);
pool->worksize = profile->worksize; if(pool_cmp(pool->worksize, default_profile.worksize))
applog(LOG_DEBUG, "Pool %i Worksize set to \"%s\"", pool->pool_no, pool->worksize);
}
else
{ {
applog(LOG_DEBUG, "Profile load failed for pool %i: profile %s not found.", pool->pool_no, pool->profile); if(!empty_string(profile->worksize))
//remove profile name pool->worksize = profile->worksize;
pool->profile[0] = '\0'; else
} pool->worksize = default_profile.worksize;
} }
applog(LOG_DEBUG, "Pool %i Worksize set to \"%s\"", pool->pool_no, pool->worksize);
} }
//helper function to add json values to pool object //helper function to add json values to pool object
@ -1291,7 +1412,7 @@ void write_config(const char *filename)
else else
{ {
//save algorithm name //save algorithm name
if(json_object_set(config, "algorithm", json_string(opt_algorithm.name)) == -1) if(json_object_set(config, "algorithm", json_string(default_profile.algorithm.name)) == -1)
{ {
applog(LOG_ERR, "Error: config_parser::write_config():\n json_object_set() failed on algorithm"); applog(LOG_ERR, "Error: config_parser::write_config():\n json_object_set() failed on algorithm");
return; return;

View File

@ -12,7 +12,10 @@
#define empty_string(str) ((str && str[0] != '\0')?0:1) #define empty_string(str) ((str && str[0] != '\0')?0:1)
#endif #endif
#ifndef safe_cmp #ifndef safe_cmp
#define safe_cmp(val1, val2) (((val1 && strcmp(val1, val2) != 0) || empty_string(val1))?1:0) #define safe_cmp(val1, val2) (((val1 && strcasecmp(val1, val2) != 0) || empty_string(val1))?1:0)
#endif
#ifndef pool_cmp
#define pool_cmp(val1, val2) (((val1 && val2 && strcasecmp(val1, val2) == 0) || empty_string(val1))?1:0)
#endif #endif
#ifndef isnull #ifndef isnull
#define isnull(str, default_str) ((str == NULL)?default_str:str) #define isnull(str, default_str) ((str == NULL)?default_str:str)
@ -60,6 +63,8 @@ extern struct profile **profiles;
extern int total_profiles; extern int total_profiles;
/* option parser functions */ /* option parser functions */
extern char *set_default_algorithm(const char *arg);
extern char *set_default_nfactor(const char *arg);
extern char *set_default_devices(const char *arg); extern char *set_default_devices(const char *arg);
extern char *set_default_lookup_gap(const char *arg); extern char *set_default_lookup_gap(const char *arg);
extern char *set_default_intensity(const char *arg); extern char *set_default_intensity(const char *arg);

View File

@ -28,6 +28,7 @@
#include "compat.h" #include "compat.h"
#include "miner.h" #include "miner.h"
#include "config_parser.h"
#include "driver-opencl.h" #include "driver-opencl.h"
#include "findnonce.h" #include "findnonce.h"
#include "ocl.h" #include "ocl.h"
@ -1161,7 +1162,7 @@ static void opencl_detect(bool hotplug)
cgpu->threads = 1; cgpu->threads = 1;
#endif #endif
cgpu->virtual_gpu = i; cgpu->virtual_gpu = i;
cgpu->algorithm = opt_algorithm; cgpu->algorithm = default_profile.algorithm;
add_cgpu(cgpu); add_cgpu(cgpu);
} }

View File

@ -203,7 +203,7 @@ __kernel void search1(__global hash_t* hashes)
mv[12] = 0; mv[12] = 0;
mv[13] = 0; mv[13] = 0;
mv[14] = 0; mv[14] = 0;
mv[15] = SPH_C64(512) mv[15] = SPH_C64(512);
tmp = (mv[5] ^ BMW_H[5]) - (mv[7] ^ BMW_H[7]) + (mv[10] ^ BMW_H[10]) + (mv[13] ^ BMW_H[13]) + (mv[14] ^ BMW_H[14]); tmp = (mv[5] ^ BMW_H[5]) - (mv[7] ^ BMW_H[7]) + (mv[10] ^ BMW_H[10]) + (mv[13] ^ BMW_H[13]) + (mv[14] ^ BMW_H[14]);
q[0] = (SHR(tmp, 1) ^ SHL(tmp, 3) ^ SPH_ROTL64(tmp, 4) ^ SPH_ROTL64(tmp, 37)) + BMW_H[1]; q[0] = (SHR(tmp, 1) ^ SHL(tmp, 3) ^ SPH_ROTL64(tmp, 4) ^ SPH_ROTL64(tmp, 37)) + BMW_H[1];
@ -1234,7 +1234,7 @@ __kernel void search12(__global hash_t* hashes, __global uint* output, const ulo
hash->h4[14] = SWAP4(S29); hash->h4[14] = SWAP4(S29);
hash->h4[15] = SWAP4(S30); hash->h4[15] = SWAP4(S30);
bool result = (hash.h8[3] <= target); bool result = (hash->h8[3] <= target);
if (result) if (result)
output[atomic_inc(output+0xFF)] = SWAP4(gid); output[atomic_inc(output+0xFF)] = SWAP4(gid);

View File

@ -1008,7 +1008,7 @@ extern int opt_queue;
extern int opt_scantime; extern int opt_scantime;
extern int opt_expiry; extern int opt_expiry;
extern algorithm_t opt_algorithm; //extern algorithm_t opt_algorithm;
extern cglock_t control_lock; extern cglock_t control_lock;
extern pthread_mutex_t hash_lock; extern pthread_mutex_t hash_lock;

View File

@ -91,7 +91,7 @@ int opt_queue = 1;
int opt_scantime = 7; int opt_scantime = 7;
int opt_expiry = 28; int opt_expiry = 28;
algorithm_t opt_algorithm; //algorithm_t opt_algorithm;
unsigned long long global_hashrate; unsigned long long global_hashrate;
unsigned long global_quota_gcd = 1; unsigned long global_quota_gcd = 1;
@ -513,9 +513,7 @@ struct pool *add_pool(void)
buf[0] = '\0'; buf[0] = '\0';
pool->name = strdup(buf); pool->name = strdup(buf);
pool->profile = strdup(buf); //profile blank by default pool->profile = strdup(buf); //profile blank by default
pool->algorithm.name[0] = '\0'; //blank algorithm name
/* Algorithm */
pool->algorithm = opt_algorithm;
pools = (struct pool **)realloc(pools, sizeof(struct pool *) * (total_pools + 2)); pools = (struct pool **)realloc(pools, sizeof(struct pool *) * (total_pools + 2));
pools[total_pools++] = pool; pools[total_pools++] = pool;
@ -645,9 +643,9 @@ char *set_devices(char *arg)
return NULL; return NULL;
} }
//all devices enabled //all devices enabled
else if(*arg == '*') else if(*arg == '*' || !strcasecmp(arg, "all"))
{ {
applog(LOG_DEBUG, "set_devices(%s)", arg); applog(LOG_DEBUG, "set_devices(all)");
opt_devs_enabled = 0; opt_devs_enabled = 0;
return NULL; return NULL;
} }
@ -1165,31 +1163,6 @@ static void load_temp_cutoffs()
} }
} }
static char *set_algo(const char *arg)
{
if ((json_array_index < 0) || (total_pools == 0)) {
set_algorithm(&opt_algorithm, arg);
applog(LOG_INFO, "Set default algorithm to %s", opt_algorithm.name);
} else {
set_pool_algorithm(arg);
}
return NULL;
}
static char *set_nfactor(const char *arg)
{
if ((json_array_index < 0) || (total_pools == 0)) {
set_algorithm_nfactor(&opt_algorithm, (const uint8_t) atoi(arg));
applog(LOG_INFO, "Set algorithm N-factor to %d (N to %d)",
opt_algorithm.nfactor, opt_algorithm.n);
} else {
set_pool_nfactor(arg);
}
return NULL;
}
static char *set_api_allow(const char *arg) static char *set_api_allow(const char *arg)
{ {
opt_set_charp(arg, &opt_api_allow); opt_set_charp(arg, &opt_api_allow);
@ -1251,7 +1224,7 @@ char *set_difficulty_multiplier(char *arg)
/* These options are available from config file or commandline */ /* These options are available from config file or commandline */
struct opt_table opt_config_table[] = { struct opt_table opt_config_table[] = {
OPT_WITH_ARG("--algorithm", OPT_WITH_ARG("--algorithm",
set_algo, NULL, NULL, set_default_algorithm, NULL, NULL,
"Set mining algorithm and most common defaults, default: scrypt"), "Set mining algorithm and most common defaults, default: scrypt"),
OPT_WITH_ARG("--api-allow", OPT_WITH_ARG("--api-allow",
set_api_allow, NULL, NULL, set_api_allow, NULL, NULL,
@ -1437,7 +1410,7 @@ struct opt_table opt_config_table[] = {
opt_set_bool, &opt_delaynet, opt_set_bool, &opt_delaynet,
"Impose small delays in networking to not overload slow routers"), "Impose small delays in networking to not overload slow routers"),
OPT_WITH_ARG("--nfactor", OPT_WITH_ARG("--nfactor",
set_nfactor, NULL, NULL, set_default_nfactor, NULL, NULL,
"Override default scrypt N-factor parameter."), "Override default scrypt N-factor parameter."),
#ifdef HAVE_ADL #ifdef HAVE_ADL
OPT_WITHOUT_ARG("--no-adl", OPT_WITHOUT_ARG("--no-adl",
@ -5925,8 +5898,10 @@ static void get_work_prepare_thread(struct thr_info *mythr, struct work *work)
bool soft_restart = !work->pool->gpu_threads; bool soft_restart = !work->pool->gpu_threads;
rd_lock(&mining_thr_lock); rd_lock(&mining_thr_lock);
// Shutdown all threads first (necessary) // Shutdown all threads first (necessary)
if (soft_restart) { if (soft_restart)
for (i = 0; i < start_threads; i++) { {
for (i = 0; i < start_threads; i++)
{
struct thr_info *thr = mining_thr[i]; struct thr_info *thr = mining_thr[i];
thr->cgpu->drv->thread_shutdown(thr); thr->cgpu->drv->thread_shutdown(thr);
} }
@ -5955,23 +5930,38 @@ static void get_work_prepare_thread(struct thr_info *mythr, struct work *work)
else if(!empty_string(default_profile.lookup_gap)) else if(!empty_string(default_profile.lookup_gap))
set_lookup_gap((char *)default_profile.lookup_gap); set_lookup_gap((char *)default_profile.lookup_gap);
//intensity //raw intensity from pool
if(!empty_string(work->pool->intensity))
set_intensity(work->pool->intensity);
else if(!empty_string(default_profile.intensity))
set_intensity(default_profile.intensity);
//xintensity
if (!empty_string(work->pool->xintensity))
set_xintensity(work->pool->xintensity);
else if(!empty_string(default_profile.xintensity))
set_xintensity(default_profile.xintensity);
//raw intensity
if (!empty_string(work->pool->rawintensity)) if (!empty_string(work->pool->rawintensity))
set_rawintensity(work->pool->rawintensity); set_rawintensity(work->pool->rawintensity);
//raw intensity from default profile
else if(!empty_string(default_profile.rawintensity)) else if(!empty_string(default_profile.rawintensity))
set_rawintensity(default_profile.rawintensity); set_rawintensity(default_profile.rawintensity);
//if no rawintensity is set try xintensity
else
{
//xintensity from pool
if (!empty_string(work->pool->xintensity))
set_xintensity(work->pool->xintensity);
//xintensity from default profile
else if(!empty_string(default_profile.xintensity))
set_xintensity(default_profile.xintensity);
//no xintensity set try intensity
else
{
//intensity from pool
if(!empty_string(work->pool->intensity))
set_intensity(work->pool->intensity);
//intensity from defaults
else if(!empty_string(default_profile.intensity))
set_intensity(default_profile.intensity);
//nothing set anywhere, use 8
else
{
default_profile.intensity = strdup("8");
set_intensity(default_profile.intensity);
}
}
}
//shaders //shaders
if (!empty_string(work->pool->shaders)) if (!empty_string(work->pool->shaders))
@ -6032,7 +6022,8 @@ static void get_work_prepare_thread(struct thr_info *mythr, struct work *work)
{ {
struct thr_info *thr = mining_thr[i]; struct thr_info *thr = mining_thr[i];
thr->cgpu->algorithm = work->pool->algorithm; thr->cgpu->algorithm = work->pool->algorithm;
if (soft_restart) { if (soft_restart)
{
thr->cgpu->drv->thread_prepare(thr); thr->cgpu->drv->thread_prepare(thr);
thr->cgpu->drv->thread_init(thr); thr->cgpu->drv->thread_init(thr);
} }
@ -6040,6 +6031,7 @@ static void get_work_prepare_thread(struct thr_info *mythr, struct work *work)
// Necessary because algorithms can have dramatically different diffs // Necessary because algorithms can have dramatically different diffs
thr->cgpu->drv->working_diff = 1; thr->cgpu->drv->working_diff = 1;
} }
rd_unlock(&mining_thr_lock); rd_unlock(&mining_thr_lock);
// Finish switching pools // Finish switching pools
@ -6111,7 +6103,9 @@ static void get_work_prepare_thread(struct thr_info *mythr, struct work *work)
pthread_cond_broadcast(&algo_switch_wait_cond); pthread_cond_broadcast(&algo_switch_wait_cond);
mutex_unlock(&algo_switch_wait_lock); mutex_unlock(&algo_switch_wait_lock);
// Not all threads are waiting, join the waiting list // Not all threads are waiting, join the waiting list
} else { }
else
{
mutex_unlock(&algo_switch_lock); mutex_unlock(&algo_switch_lock);
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
// Wait for signal to start working again // Wait for signal to start working again
@ -7785,7 +7779,7 @@ int main(int argc, char *argv[])
#endif #endif
/* Default algorithm specified in algorithm.c ATM */ /* Default algorithm specified in algorithm.c ATM */
set_algorithm(&opt_algorithm, "scrypt"); set_algorithm(&default_profile.algorithm, "scrypt");
devcursor = 8; devcursor = 8;
logstart = devcursor + 1; logstart = devcursor + 1;