1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-03-13 06:01:03 +00:00

Make the thread concurrency and lookup gap options hidden on the command line and autotune parameters with a newly parsed --shaders option.

This commit is contained in:
Con Kolivas 2012-07-24 20:27:37 +10:00
parent f98774c35c
commit 9a6c082ad1
5 changed files with 35 additions and 2 deletions

View File

@ -857,7 +857,7 @@ static struct opt_table opt_config_table[] = {
#ifdef USE_SCRYPT
OPT_WITH_ARG("--lookup-gap",
set_lookup_gap, NULL, NULL,
"Set GPU lookup gap for scrypt mining, comma separated"),
opt_hidden),
#endif
OPT_WITH_ARG("--intensity|-I",
set_intensity, NULL, NULL,
@ -965,6 +965,9 @@ static struct opt_table opt_config_table[] = {
OPT_WITHOUT_ARG("--scrypt",
opt_set_bool, &opt_scrypt,
"Use the scrypt algorithm for mining (litecoin only)"),
OPT_WITH_ARG("--shaders",
set_shaders, NULL, NULL,
"GPU shaders per card for tuning scrypt, comma separated"),
#endif
OPT_WITH_ARG("--sharelog",
set_sharelog, NULL, NULL,
@ -1007,7 +1010,7 @@ static struct opt_table opt_config_table[] = {
#ifdef USE_SCRYPT
OPT_WITH_ARG("--thread-concurrency",
set_thread_concurrency, NULL, NULL,
"Set GPU thread concurrency for scrypt mining, comma separated"),
opt_hidden),
#endif
OPT_WITH_ARG("--url|-o",
set_url, NULL, NULL,

View File

@ -128,6 +128,31 @@ char *set_worksize(char *arg)
}
#ifdef USE_SCRYPT
char *set_shaders(char *arg)
{
int i, val = 0, device = 0;
char *nextptr;
nextptr = strtok(arg, ",");
if (nextptr == NULL)
return "Invalid parameters for set lookup gap";
val = atoi(nextptr);
gpus[device++].shaders = val;
while ((nextptr = strtok(NULL, ",")) != NULL) {
val = atoi(nextptr);
gpus[device++].shaders = val;
}
if (device == 1) {
for (i = device; i < MAX_GPUDEVICES; i++)
gpus[i].shaders = gpus[0].shaders;
}
return NULL;
}
char *set_lookup_gap(char *arg)
{
int i, val = 0, device = 0;

View File

@ -19,6 +19,7 @@ extern char *set_intensity(char *arg);
extern char *set_vector(char *arg);
extern char *set_worksize(char *arg);
#ifdef USE_SCRYPT
extern char *set_shaders(char *arg);
extern char *set_lookup_gap(char *arg);
extern char *set_thread_concurrency(char *arg);
#endif

View File

@ -365,6 +365,7 @@ struct cgpu_info {
#ifdef USE_SCRYPT
int lookup_gap;
int thread_concurrency;
int shaders;
#endif
struct timeval tv_gpustart;;
struct timeval tv_gpuend;

3
ocl.c
View File

@ -478,6 +478,9 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
}
if (!gpus[gpu].thread_concurrency) {
gpus[gpu].thread_concurrency = gpus[gpu].max_alloc / 32768 / gpus[gpu].lookup_gap;
if (gpus[gpu].shaders && gpus[gpu].thread_concurrency > gpus[gpu].shaders)
gpus[gpu].thread_concurrency -= gpus[gpu].thread_concurrency % gpus[gpu].shaders;
applog(LOG_DEBUG, "GPU %d: selecting thread concurrency of %u",gpu, gpus[gpu].thread_concurrency);
}
}