1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-22 12:34:27 +00:00

-g or --gpu-threads now support comma separated values, yaaay!

It is exactly what it says, now you can finally put that Frankenrig configuration in one file.
The parameter follows the same design as gpu-engine and gpu-memclock.
This commit is contained in:
Martin Danielsen 2014-01-09 22:01:08 +01:00 committed by Noel Maersk
parent b4e36e69e8
commit 31123de410
3 changed files with 40 additions and 1 deletions

View File

@ -1029,10 +1029,14 @@ static struct opt_table opt_config_table[] = {
OPT_WITH_ARG("--gpu-platform", OPT_WITH_ARG("--gpu-platform",
set_int_0_to_9999, opt_show_intval, &opt_platform_id, set_int_0_to_9999, opt_show_intval, &opt_platform_id,
"Select OpenCL platform ID to use for GPU mining"), "Select OpenCL platform ID to use for GPU mining"),
#ifndef HAVE_ADL
OPT_WITH_ARG("--gpu-threads|-g", OPT_WITH_ARG("--gpu-threads|-g",
set_int_1_to_10, opt_show_intval, &opt_g_threads, set_int_1_to_10, opt_show_intval, &opt_g_threads,
"Number of threads per GPU (1 - 10)"), "Number of threads per GPU (1 - 10)"),
#ifdef HAVE_ADL #else
OPT_WITH_ARG("--gpu-threads|-g",
set_gpu_threads, NULL, NULL,
"Number of threads per GPU - one value or comma separated list (e.g. 1,2,1)"),
OPT_WITH_ARG("--gpu-engine", OPT_WITH_ARG("--gpu-engine",
set_gpu_engine, NULL, NULL, set_gpu_engine, NULL, NULL,
"GPU engine (over)clock range in Mhz - one value, range and/or comma separated list (e.g. 850-900,900,750-850)"), "GPU engine (over)clock range in Mhz - one value, range and/or comma separated list (e.g. 850-900,900,750-850)"),

View File

@ -266,6 +266,35 @@ char *set_gpu_map(char *arg)
return NULL; return NULL;
} }
char *set_gpu_threads(char *arg)
{
int i, val = 1, device = 0;
char *nextptr;
nextptr = strtok(arg, ",");
if (nextptr == NULL)
return "Invalid parameters for set_gpu_threads";
val = atoi(nextptr);
if (val < 1 || val > 10)
return "Invalid value passed to set_gpu_threads";
gpus[device++].threads = val;
while ((nextptr = strtok(NULL, ",")) != NULL) {
val = atoi(nextptr);
if (val < 1 || val > 10)
return "Invalid value passed to set_gpu_threads";
gpus[device++].threads = val;
}
if (device == 1) {
for (i = device; i < MAX_GPUDEVICES; i++)
gpus[i].threads = gpus[0].threads;
}
return NULL;
}
char *set_gpu_engine(char *arg) char *set_gpu_engine(char *arg)
{ {
int i, val1 = 0, val2 = 0, device = 0; int i, val1 = 0, val2 = 0, device = 0;
@ -1007,7 +1036,12 @@ static void opencl_detect(bool hotplug)
cgpu->deven = DEV_ENABLED; cgpu->deven = DEV_ENABLED;
cgpu->drv = &opencl_drv; cgpu->drv = &opencl_drv;
cgpu->device_id = i; cgpu->device_id = i;
#ifndef HAVE_ADL
cgpu->threads = opt_g_threads; cgpu->threads = opt_g_threads;
#else
if (cgpu->threads < 1)
cgpu->threads = 1;
#endif
cgpu->virtual_gpu = i; cgpu->virtual_gpu = i;
add_cgpu(cgpu); add_cgpu(cgpu);
} }

View File

@ -7,6 +7,7 @@
extern void print_ndevs(int *ndevs); extern void print_ndevs(int *ndevs);
extern void *reinit_gpu(void *userdata); extern void *reinit_gpu(void *userdata);
extern char *set_gpu_map(char *arg); extern char *set_gpu_map(char *arg);
extern char *set_gpu_threads(char *arg);
extern char *set_gpu_engine(char *arg); extern char *set_gpu_engine(char *arg);
extern char *set_gpu_fan(char *arg); extern char *set_gpu_fan(char *arg);
extern char *set_gpu_memclock(char *arg); extern char *set_gpu_memclock(char *arg);