1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-10 14:58:01 +00:00

Allow the worksize to be set per-device.

This commit is contained in:
Con Kolivas 2012-02-22 16:59:28 +11:00
parent deff55c640
commit 26c59fbf0f
4 changed files with 37 additions and 9 deletions

View File

@ -91,8 +91,6 @@ static int opt_fail_pause = 5;
static int fail_pause = 5;
int opt_log_interval = 5;
static int opt_queue = 1;
int opt_vectors;
int opt_worksize;
int opt_scantime = 60;
int opt_expiry = 120;
int opt_bench_algo = -1;
@ -839,8 +837,8 @@ static struct opt_table opt_config_table[] = {
"Log verbose output to stderr as well as status output"),
#ifdef HAVE_OPENCL
OPT_WITH_ARG("--worksize|-w",
set_int_0_to_9999, opt_show_intval, &opt_worksize,
"Override detected optimal worksize"),
set_worksize, NULL, NULL,
"Override detected optimal worksize - one value or comma separated list"),
#endif
OPT_WITH_ARG("--userpass|-O",
set_userpass, NULL, NULL,

View File

@ -93,6 +93,36 @@ char *set_vector(char *arg)
return NULL;
}
char *set_worksize(char *arg)
{
int i, val = 0, device = 0;
char *nextptr;
nextptr = strtok(arg, ",");
if (nextptr == NULL)
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;
while ((nextptr = strtok(NULL, ",")) != NULL) {
val = atoi(nextptr);
if (val < 1 || val > 9999)
return "Invalid value passed to set_worksize";
gpus[device++].work_size = val;
}
if (device == 1) {
for (i = device; i < MAX_GPUDEVICES; i++)
gpus[i].work_size = gpus[0].work_size;
}
return NULL;
}
#endif
#ifdef HAVE_ADL

View File

@ -16,6 +16,7 @@ extern char *set_temp_overheat(char *arg);
extern char *set_temp_target(char *arg);
extern char *set_intensity(char *arg);
extern char *set_vector(char *arg);
extern char *set_worksize(char *arg);
void manage_gpu(void);
extern void pause_dynamic_threads(int gpu);

9
ocl.c
View File

@ -33,7 +33,6 @@
#include "findnonce.h"
#include "ocl.h"
extern int opt_worksize;
int opt_platform_id;
char *file_contents(const char *filename, int *length)
@ -349,12 +348,12 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
else
clState->vwidth = preferred_vwidth;
if (opt_worksize && opt_worksize <= (int)clState->max_work_size)
clState->work_size = opt_worksize;
if (gpus[gpu].work_size && gpus[gpu].work_size <= clState->max_work_size)
clState->wsize = gpus[gpu].work_size;
else if (strstr(name, "Tahiti"))
clState->work_size = 64;
clState->wsize = 64;
else
clState->work_size = (clState->max_work_size <= 256 ? clState->max_work_size : 256) / clState->vwidth;
clState->wsize = (clState->max_work_size <= 256 ? clState->max_work_size : 256) / clState->vwidth;
/* Create binary filename based on parameters passed to opencl
* compiler to ensure we only load a binary that matches what would