mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 04:24:19 +00:00
Fix worksize per GPU
Improper use of strtok() on the original config string instead of a copy resulted in the worksize being cut down to GPU0's worksize only after first use.
This commit is contained in:
parent
ba9818a707
commit
b53cc151aa
@ -91,32 +91,38 @@ char *set_vector(char *arg)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *set_worksize(char *arg)
|
char *set_worksize(const char *arg)
|
||||||
{
|
{
|
||||||
int i, val = 0, device = 0;
|
int i, val = 0, device = 0;
|
||||||
|
char *tmpstr = strdup(arg);
|
||||||
char *nextptr;
|
char *nextptr;
|
||||||
|
|
||||||
nextptr = strtok(arg, ",");
|
if ((nextptr = strtok(tmpstr, ",")) == NULL) {
|
||||||
if (nextptr == NULL)
|
free(tmpstr);
|
||||||
return "Invalid parameters for set work size";
|
return "Invalid parameters for set work size";
|
||||||
val = atoi(nextptr);
|
}
|
||||||
if (val < 1 || val > 9999)
|
|
||||||
return "Invalid value passed to set_worksize";
|
|
||||||
|
|
||||||
gpus[device++].work_size = val;
|
do {
|
||||||
|
|
||||||
while ((nextptr = strtok(NULL, ",")) != NULL) {
|
|
||||||
val = atoi(nextptr);
|
val = atoi(nextptr);
|
||||||
if (val < 1 || val > 9999)
|
|
||||||
|
if (val < 1 || val > 9999) {
|
||||||
|
free(tmpstr);
|
||||||
return "Invalid value passed to set_worksize";
|
return "Invalid value passed to set_worksize";
|
||||||
|
}
|
||||||
|
|
||||||
|
applog(LOG_DEBUG, "GPU %d Worksize set to %u.", device, val);
|
||||||
gpus[device++].work_size = val;
|
gpus[device++].work_size = val;
|
||||||
}
|
} while ((nextptr = strtok(NULL, ",")) != NULL);
|
||||||
|
|
||||||
|
// if only 1 worksize was passed, assign the same worksize for all remaining GPUs
|
||||||
if (device == 1) {
|
if (device == 1) {
|
||||||
for (i = device; i < MAX_GPUDEVICES; i++)
|
for (i = device; i < total_devices; ++i) {
|
||||||
gpus[i].work_size = gpus[0].work_size;
|
gpus[i].work_size = gpus[0].work_size;
|
||||||
|
applog(LOG_DEBUG, "GPU %d Worksize set to %u.", i, gpus[i].work_size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(tmpstr);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ extern char *set_intensity(const char *arg);
|
|||||||
extern char *set_xintensity(const char *arg);
|
extern char *set_xintensity(const char *arg);
|
||||||
extern char *set_rawintensity(const char *arg);
|
extern char *set_rawintensity(const char *arg);
|
||||||
extern char *set_vector(char *arg);
|
extern char *set_vector(char *arg);
|
||||||
extern char *set_worksize(char *arg);
|
extern char *set_worksize(const char *arg);
|
||||||
extern char *set_shaders(char *arg);
|
extern char *set_shaders(char *arg);
|
||||||
extern char *set_lookup_gap(char *arg);
|
extern char *set_lookup_gap(char *arg);
|
||||||
extern char *set_thread_concurrency(const char *arg);
|
extern char *set_thread_concurrency(const char *arg);
|
||||||
|
@ -6015,7 +6015,7 @@ static void apply_initial_gpu_settings(struct pool *pool)
|
|||||||
|
|
||||||
//worksize
|
//worksize
|
||||||
if(!empty_string((opt = get_pool_setting(pool->worksize, default_profile.worksize))))
|
if(!empty_string((opt = get_pool_setting(pool->worksize, default_profile.worksize))))
|
||||||
set_worksize((char *)opt);
|
set_worksize(opt);
|
||||||
|
|
||||||
//apply algorithm
|
//apply algorithm
|
||||||
for (i = 0; i < nDevs; i++)
|
for (i = 0; i < nDevs; i++)
|
||||||
@ -6415,7 +6415,7 @@ static void get_work_prepare_thread(struct thr_info *mythr, struct work *work)
|
|||||||
if(opt_isset(pool_switch_options, SWITCHER_APPLY_WORKSIZE))
|
if(opt_isset(pool_switch_options, SWITCHER_APPLY_WORKSIZE))
|
||||||
{
|
{
|
||||||
if(!empty_string((opt = get_pool_setting(work->pool->worksize, default_profile.worksize))))
|
if(!empty_string((opt = get_pool_setting(work->pool->worksize, default_profile.worksize))))
|
||||||
set_worksize((char *)opt);
|
set_worksize(opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_ADL
|
#ifdef HAVE_ADL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user