Browse Source

-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.
nfactor-troky
Martin Danielsen 11 years ago committed by Noel Maersk
parent
commit
31123de410
  1. 6
      cgminer.c
  2. 34
      driver-opencl.c
  3. 1
      driver-opencl.h

6
cgminer.c

@ -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)"),

34
driver-opencl.c

@ -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);
} }

1
driver-opencl.h

@ -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);

Loading…
Cancel
Save