Browse Source

--rawintensity option, by request of Dead2.

This setting allows to set the GPU intensity value directly without any modifiers, it does not
get any more raw than this! Look at the xintensity description raw for examples of regular
intensity values. You can also set this value through the ncurses interface by pressing:
G -> A -> select device id -> enter value.

Minor xintensity code cleanup as well.

Conflicts:
	driver-opencl.c
	miner.h
	sgminer.c
nfactor-troky
Martin Danielsen 11 years ago committed by Noel Maersk
parent
commit
d11df698d1
  1. 104
      driver-opencl.c
  2. 1
      driver-opencl.h
  3. 9
      miner.h
  4. 7
      sgminer.c

104
driver-opencl.c

@ -564,6 +564,7 @@ char *set_intensity(char *arg) @@ -564,6 +564,7 @@ char *set_intensity(char *arg)
tt = &gpus[device].intensity;
*tt = val;
gpus[device].xintensity = 0; // Disable shader based intensity
gpus[device].rawintensity = 0; // Disable raw intensity
}
device++;
@ -580,6 +581,7 @@ char *set_intensity(char *arg) @@ -580,6 +581,7 @@ char *set_intensity(char *arg)
tt = &gpus[device].intensity;
*tt = val;
gpus[device].xintensity = 0; // Disable shader based intensity
gpus[device].rawintensity = 0; // Disable raw intensity
}
device++;
}
@ -588,6 +590,7 @@ char *set_intensity(char *arg) @@ -588,6 +590,7 @@ char *set_intensity(char *arg)
gpus[i].dynamic = gpus[0].dynamic;
gpus[i].intensity = gpus[0].intensity;
gpus[i].xintensity = 0; // Disable shader based intensity
gpus[i].rawintensity = 0; // Disable raw intensity
}
}
@ -604,10 +607,11 @@ char *set_xintensity(char *arg) @@ -604,10 +607,11 @@ char *set_xintensity(char *arg)
return "Invalid parameters for shader based intensity";
val = atoi(nextptr);
if (val < MIN_XINTENSITY || val > MAX_XINTENSITY)
return "Invalid value passed to set shader intensity";
return "Invalid value passed to set shader-based intensity";
gpus[device].dynamic = false; // Disable dynamic intensity
gpus[device].intensity = 0; // Disable regular intensity
gpus[device].rawintensity = 0; // Disable raw intensity
gpus[device].xintensity = val;
device++;
@ -617,13 +621,54 @@ char *set_xintensity(char *arg) @@ -617,13 +621,54 @@ char *set_xintensity(char *arg)
return "Invalid value passed to set shader based intensity";
gpus[device].dynamic = false; // Disable dynamic intensity
gpus[device].intensity = 0; // Disable regular intensity
gpus[device].rawintensity = 0; // Disable raw intensity
gpus[device].xintensity = val;
device++;
}
if (device == 1)
for (i = device; i < MAX_GPUDEVICES; i++) {
gpus[i].dynamic = gpus[0].dynamic; // Disable dynamic intensity
gpus[i].intensity = gpus[0].intensity; // Disable regular intensity
gpus[i].dynamic = gpus[0].dynamic;
gpus[i].intensity = gpus[0].intensity;
gpus[i].rawintensity = gpus[0].rawintensity;
gpus[i].xintensity = gpus[0].xintensity;
}
return NULL;
}
char *set_rawintensity(char *arg)
{
int i, device = 0, val = 0;
char *nextptr;
nextptr = strtok(arg, ",");
if (nextptr == NULL)
return "Invalid parameters for raw intensity";
val = atoi(nextptr);
if (val < MIN_RAWINTENSITY || val > MAX_RAWINTENSITY)
return "Invalid value passed to set raw intensity";
gpus[device].dynamic = false; // Disable dynamic intensity
gpus[device].intensity = 0; // Disable regular intensity
gpus[device].xintensity = 0; // Disable xintensity
gpus[device].rawintensity = val;
device++;
while ((nextptr = strtok(NULL, ",")) != NULL) {
val = atoi(nextptr);
if (val < MIN_RAWINTENSITY || val > MAX_RAWINTENSITY)
return "Invalid value passed to set raw intensity";
gpus[device].dynamic = false; // Disable dynamic intensity
gpus[device].intensity = 0; // Disable regular intensity
gpus[device].xintensity = 0; // Disable xintensity
gpus[device].rawintensity = val;
device++;
}
if (device == 1)
for (i = device; i < MAX_GPUDEVICES; i++) {
gpus[i].dynamic = gpus[0].dynamic;
gpus[i].intensity = gpus[0].intensity;
gpus[i].rawintensity = gpus[0].rawintensity;
gpus[i].xintensity = gpus[0].xintensity;
}
@ -693,10 +738,10 @@ retry: // TODO: refactor @@ -693,10 +738,10 @@ retry: // TODO: refactor
mhash_base = false;
}
wlog("GPU %d: %.1f / %.1f %sh/s | A:%d R:%d HW:%d U:%.2f/m I:%d xI:%d\n",
wlog("GPU %d: %.1f / %.1f %sh/s | A:%d R:%d HW:%d U:%.2f/m I:%d xI:%d rI:%d\n",
gpu, displayed_rolling, displayed_total, mhash_base ? "M" : "K",
cgpu->accepted, cgpu->rejected, cgpu->hw_errors,
cgpu->utility, cgpu->intensity, cgpu->xintensity);
cgpu->utility, cgpu->intensity, cgpu->xintensity, cgpu->rawintensity);
#ifdef HAVE_ADL
if (gpus[gpu].has_adl) {
int engineclock = 0, memclock = 0, activity = 0, fanspeed = 0, fanpercent = 0, powertune = 0;
@ -764,7 +809,7 @@ retry: // TODO: refactor @@ -764,7 +809,7 @@ retry: // TODO: refactor
wlog("\n");
}
wlogprint("[E]nable [D]isable [I]ntensity [x]Intensity [R]estart GPU %s\n",adl_active ? "[C]hange settings" : "");
wlogprint("[E]nable [D]isable [I]ntensity [x]Intensity R[a]w Intensity [R]estart GPU %s\n",adl_active ? "[C]hange settings" : "");
wlogprint("Or press any other key to continue\n");
logwin_update();
@ -850,7 +895,8 @@ retry: // TODO: refactor @@ -850,7 +895,8 @@ retry: // TODO: refactor
}
gpus[selected].dynamic = false;
gpus[selected].intensity = intensity;
gpus[selected].xintensity = 0; // disable
gpus[selected].xintensity = 0; // Disable xintensity when enabling intensity
gpus[selected].rawintensity = 0; // Disable raw intensity when enabling intensity
wlogprint("Intensity on gpu %d set to %d\n", selected, intensity);
pause_dynamic_threads(selected);
goto retry;
@ -877,11 +923,41 @@ retry: // TODO: refactor @@ -877,11 +923,41 @@ retry: // TODO: refactor
goto retry;
}
gpus[selected].dynamic = false;
gpus[selected].intensity = 0; // disable
gpus[selected].intensity = 0; // Disable intensity when enabling xintensity
gpus[selected].rawintensity = 0; // Disable raw intensity when enabling xintensity
gpus[selected].xintensity = xintensity;
wlogprint("Experimental intensity on gpu %d set to %d\n", selected, xintensity);
pause_dynamic_threads(selected);
goto retry;
} else if (!strncasecmp(&input, "a", 1)) {
int rawintensity;
char *intvar;
if (selected)
selected = curses_int("Select GPU to change raw intensity on");
if (selected < 0 || selected >= nDevs) {
wlogprint("Invalid selection\n");
goto retry;
}
intvar = curses_input("Set raw GPU scan intensity (" MIN_RAWINTENSITY_STR " -> " MAX_RAWINTENSITY_STR ")");
if (!intvar) {
wlogprint("Invalid input\n");
goto retry;
}
rawintensity = atoi(intvar);
free(intvar);
if (rawintensity < MIN_RAWINTENSITY || rawintensity > MAX_RAWINTENSITY) {
wlogprint("Invalid selection\n");
goto retry;
}
gpus[selected].dynamic = false;
gpus[selected].intensity = 0; // Disable intensity when enabling raw intensity
gpus[selected].xintensity = 0; // Disable xintensity when enabling raw intensity
gpus[selected].rawintensity = rawintensity;
wlogprint("Raw intensity on gpu %d set to %d\n", selected, rawintensity);
pause_dynamic_threads(selected);
goto retry;
} else if (!strncasecmp(&input, "r", 1)) {
if (selected)
selected = curses_int("Select GPU to attempt to restart");
@ -942,11 +1018,13 @@ static cl_int queue_scrypt_kernel(_clState *clState, dev_blk_ctx *blk, __maybe_u @@ -942,11 +1018,13 @@ static cl_int queue_scrypt_kernel(_clState *clState, dev_blk_ctx *blk, __maybe_u
}
static void set_threads_hashes(unsigned int vectors, unsigned int compute_shaders, int64_t *hashes, size_t *globalThreads,
unsigned int minthreads, __maybe_unused int *intensity, __maybe_unused int *xintensity)
unsigned int minthreads, __maybe_unused int *intensity, __maybe_unused int *xintensity, __maybe_unused int *rawintensity)
{
unsigned int threads = 0;
while (threads < minthreads) {
if (*xintensity > 0) {
if (*rawintensity > 0) {
threads = *rawintensity;
} else if (*xintensity > 0) {
threads = compute_shaders * *xintensity;
} else {
threads = 1 << *intensity;
@ -1145,7 +1223,9 @@ static void get_opencl_statline_before(char *buf, size_t bufsiz, struct cgpu_inf @@ -1145,7 +1223,9 @@ static void get_opencl_statline_before(char *buf, size_t bufsiz, struct cgpu_inf
static void get_opencl_statline(char *buf, size_t bufsiz, struct cgpu_info *gpu)
{
if (gpu->xintensity > 0)
if (gpu->rawintensity > 0)
tailsprintf(buf, bufsiz, " rI:%3d", gpu->rawintensity);
else if (gpu->xintensity > 0)
tailsprintf(buf, bufsiz, " xI:%3d", gpu->xintensity);
else
tailsprintf(buf, bufsiz, " I:%2d", gpu->intensity);
@ -1314,7 +1394,7 @@ static int64_t opencl_scanhash(struct thr_info *thr, struct work *work, @@ -1314,7 +1394,7 @@ static int64_t opencl_scanhash(struct thr_info *thr, struct work *work,
gpu->intervals = 0;
}
set_threads_hashes(clState->vwidth, clState->compute_shaders, &hashes, globalThreads, localThreads[0], &gpu->intensity, &gpu->xintensity);
set_threads_hashes(clState->vwidth, clState->compute_shaders, &hashes, globalThreads, localThreads[0], &gpu->intensity, &gpu->xintensity, &gpu->rawintensity);
if (hashes > gpu->max_hashes)
gpu->max_hashes = hashes;

1
driver-opencl.h

@ -18,6 +18,7 @@ extern char *set_temp_overheat(char *arg); @@ -18,6 +18,7 @@ extern char *set_temp_overheat(char *arg);
extern char *set_temp_target(char *arg);
extern char *set_intensity(char *arg);
extern char *set_xintensity(char *arg);
extern char *set_rawintensity(char *arg);
extern char *set_vector(char *arg);
extern char *set_worksize(char *arg);
extern char *set_shaders(char *arg);

9
miner.h

@ -465,6 +465,7 @@ struct cgpu_info { @@ -465,6 +465,7 @@ struct cgpu_info {
int virtual_adl;
int intensity;
int xintensity;
int rawintensity;
bool dynamic;
cl_uint vwidth;
@ -1052,8 +1053,12 @@ extern bool add_pool_details(struct pool *pool, bool live, char *url, char *user @@ -1052,8 +1053,12 @@ extern bool add_pool_details(struct pool *pool, bool live, char *url, char *user
#define MAX_INTENSITY_STR "31"
#define MIN_XINTENSITY 1
#define MIN_XINTENSITY_STR "1"
#define MAX_XINTENSITY 999
#define MAX_XINTENSITY_STR "999"
#define MAX_XINTENSITY 9999
#define MAX_XINTENSITY_STR "9999"
#define MIN_RAWINTENSITY 1
#define MIN_RAWINTENSITY_STR "1"
#define MAX_RAWINTENSITY 2147483647
#define MAX_RAWINTENSITY_STR "2147483647"
extern bool hotplug_mode;
extern int hotplug_time;

7
sgminer.c

@ -1089,7 +1089,12 @@ static struct opt_table opt_config_table[] = { @@ -1089,7 +1089,12 @@ static struct opt_table opt_config_table[] = {
",default: d to maintain desktop interactivity)"),
OPT_WITH_ARG("--xintensity|-X",
set_xintensity, NULL, NULL,
"Shader based intensity of GPU scanning (0 to 9999), overrides --intensity|-I."),
"Shader based intensity of GPU scanning (" MIN_XINTENSITY_STR " to "
MAX_XINTENSITY_STR "), overrides --intensity|-I and -rawintensity."),
OPT_WITH_ARG("--rawintensity",
set_rawintensity, NULL, NULL,
"Raw intensity of GPU scanning (" MIN_RAWINTENSITY_STR " to "
MAX_RAWINTENSITY_STR "), overrides --intensity|-I and --xintensity|-X."),
OPT_WITH_ARG("--kernel-path|-K",
opt_set_charp, opt_show_charp, &opt_kernel_path,
"Specify a path to where kernel files are"),

Loading…
Cancel
Save