Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
-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.
  • Loading branch information
Kalroth authored and veox committed Jan 11, 2014
1 parent b4e36e6 commit 31123de
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cgminer.c
Expand Up @@ -1029,10 +1029,14 @@ static struct opt_table opt_config_table[] = {
OPT_WITH_ARG("--gpu-platform",
set_int_0_to_9999, opt_show_intval, &opt_platform_id,
"Select OpenCL platform ID to use for GPU mining"),
#ifndef HAVE_ADL
OPT_WITH_ARG("--gpu-threads|-g",
set_int_1_to_10, opt_show_intval, &opt_g_threads,
"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",
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)"),
Expand Down
34 changes: 34 additions & 0 deletions driver-opencl.c
Expand Up @@ -266,6 +266,35 @@ char *set_gpu_map(char *arg)
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)
{
int i, val1 = 0, val2 = 0, device = 0;
Expand Down Expand Up @@ -1007,7 +1036,12 @@ static void opencl_detect(bool hotplug)
cgpu->deven = DEV_ENABLED;
cgpu->drv = &opencl_drv;
cgpu->device_id = i;
#ifndef HAVE_ADL
cgpu->threads = opt_g_threads;
#else
if (cgpu->threads < 1)
cgpu->threads = 1;
#endif
cgpu->virtual_gpu = i;
add_cgpu(cgpu);
}
Expand Down
1 change: 1 addition & 0 deletions driver-opencl.h
Expand Up @@ -7,6 +7,7 @@
extern void print_ndevs(int *ndevs);
extern void *reinit_gpu(void *userdata);
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_fan(char *arg);
extern char *set_gpu_memclock(char *arg);
Expand Down

0 comments on commit 31123de

Please sign in to comment.