mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-10 23:08:07 +00:00
Allow temperature targets to be set on a per-card basis on the command line.
This commit is contained in:
parent
d6f3bd0564
commit
e0a9f1aae3
15
adl.c
15
adl.c
@ -22,9 +22,9 @@
|
|||||||
bool adl_active;
|
bool adl_active;
|
||||||
|
|
||||||
int opt_hysteresis = 3;
|
int opt_hysteresis = 3;
|
||||||
int opt_targettemp = 75;
|
const int opt_targettemp = 75;
|
||||||
int opt_overheattemp = 85;
|
const int opt_overheattemp = 85;
|
||||||
int opt_cutofftemp = 95;
|
const int opt_cutofftemp = 95;
|
||||||
static pthread_mutex_t adl_lock;
|
static pthread_mutex_t adl_lock;
|
||||||
|
|
||||||
// Memory allocation function
|
// Memory allocation function
|
||||||
@ -321,9 +321,12 @@ void init_adl(int nDevs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Set some default temperatures for autotune when enabled */
|
/* Set some default temperatures for autotune when enabled */
|
||||||
ga->targettemp = opt_targettemp;
|
if (!ga->targettemp)
|
||||||
ga->overtemp = opt_overheattemp;
|
ga->targettemp = opt_targettemp;
|
||||||
ga->cutofftemp = opt_cutofftemp;
|
if (!ga->overtemp)
|
||||||
|
ga->overtemp = opt_overheattemp;
|
||||||
|
if (!ga->cutofftemp)
|
||||||
|
ga->cutofftemp = opt_cutofftemp;
|
||||||
if (opt_autofan) {
|
if (opt_autofan) {
|
||||||
ga->autofan = true;
|
ga->autofan = true;
|
||||||
/* Set a safe starting default if we're automanaging fan speeds */
|
/* Set a safe starting default if we're automanaging fan speeds */
|
||||||
|
6
adl.h
6
adl.h
@ -3,9 +3,9 @@
|
|||||||
#ifdef HAVE_ADL
|
#ifdef HAVE_ADL
|
||||||
bool adl_active;
|
bool adl_active;
|
||||||
int opt_hysteresis;
|
int opt_hysteresis;
|
||||||
int opt_targettemp;
|
const int opt_targettemp;
|
||||||
int opt_overheattemp;
|
const int opt_overheattemp;
|
||||||
int opt_cutofftemp;
|
const int opt_cutofftemp;
|
||||||
void init_adl(int nDevs);
|
void init_adl(int nDevs);
|
||||||
float gpu_temp(int gpu);
|
float gpu_temp(int gpu);
|
||||||
int gpu_engineclock(int gpu);
|
int gpu_engineclock(int gpu);
|
||||||
|
121
main.c
121
main.c
@ -972,11 +972,6 @@ static char *set_int_0_to_10(const char *arg, int *i)
|
|||||||
return set_int_range(arg, i, 0, 10);
|
return set_int_range(arg, i, 0, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *set_int_0_to_200(const char *arg, int *i)
|
|
||||||
{
|
|
||||||
return set_int_range(arg, i, 0, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *set_int_1_to_10(const char *arg, int *i)
|
static char *set_int_1_to_10(const char *arg, int *i)
|
||||||
{
|
{
|
||||||
return set_int_range(arg, i, 1, 10);
|
return set_int_range(arg, i, 1, 10);
|
||||||
@ -1278,6 +1273,104 @@ static char *set_gpu_vddc(char *arg)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *set_temp_cutoff(char *arg)
|
||||||
|
{
|
||||||
|
int i, val = 0, device = 0, *tco;
|
||||||
|
char *nextptr;
|
||||||
|
|
||||||
|
nextptr = strtok(arg, ",");
|
||||||
|
if (nextptr == NULL)
|
||||||
|
return "Invalid parameters for set temp cutoff";
|
||||||
|
val = atoi(nextptr);
|
||||||
|
if (val < 0 || val > 200)
|
||||||
|
return "Invalid value passed to set temp cutoff";
|
||||||
|
|
||||||
|
tco = &gpus[device++].adl.cutofftemp;
|
||||||
|
*tco = val;
|
||||||
|
|
||||||
|
while ((nextptr = strtok(NULL, ",")) != NULL) {
|
||||||
|
val = atoi(nextptr);
|
||||||
|
if (val < 0 || val > 200)
|
||||||
|
return "Invalid value passed to set temp cutoff";
|
||||||
|
|
||||||
|
tco = &gpus[device++].adl.cutofftemp;
|
||||||
|
*tco = val;
|
||||||
|
}
|
||||||
|
if (device == 1) {
|
||||||
|
for (i = device; i < 16; i++) {
|
||||||
|
tco = &gpus[i].adl.cutofftemp;
|
||||||
|
*tco = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *set_temp_overheat(char *arg)
|
||||||
|
{
|
||||||
|
int i, val = 0, device = 0, *to;
|
||||||
|
char *nextptr;
|
||||||
|
|
||||||
|
nextptr = strtok(arg, ",");
|
||||||
|
if (nextptr == NULL)
|
||||||
|
return "Invalid parameters for set temp overheat";
|
||||||
|
val = atoi(nextptr);
|
||||||
|
if (val < 0 || val > 200)
|
||||||
|
return "Invalid value passed to set temp overheat";
|
||||||
|
|
||||||
|
to = &gpus[device++].adl.overtemp;
|
||||||
|
*to = val;
|
||||||
|
|
||||||
|
while ((nextptr = strtok(NULL, ",")) != NULL) {
|
||||||
|
val = atoi(nextptr);
|
||||||
|
if (val < 0 || val > 200)
|
||||||
|
return "Invalid value passed to set temp overheat";
|
||||||
|
|
||||||
|
to = &gpus[device++].adl.overtemp;
|
||||||
|
*to = val;
|
||||||
|
}
|
||||||
|
if (device == 1) {
|
||||||
|
for (i = device; i < 16; i++) {
|
||||||
|
to = &gpus[i].adl.overtemp;
|
||||||
|
*to = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *set_temp_target(char *arg)
|
||||||
|
{
|
||||||
|
int i, val = 0, device = 0, *tt;
|
||||||
|
char *nextptr;
|
||||||
|
|
||||||
|
nextptr = strtok(arg, ",");
|
||||||
|
if (nextptr == NULL)
|
||||||
|
return "Invalid parameters for set temp target";
|
||||||
|
val = atoi(nextptr);
|
||||||
|
if (val < 0 || val > 200)
|
||||||
|
return "Invalid value passed to set temp target";
|
||||||
|
|
||||||
|
tt = &gpus[device++].adl.targettemp;
|
||||||
|
*tt = val;
|
||||||
|
|
||||||
|
while ((nextptr = strtok(NULL, ",")) != NULL) {
|
||||||
|
val = atoi(nextptr);
|
||||||
|
if (val < 0 || val > 200)
|
||||||
|
return "Invalid value passed to set temp target";
|
||||||
|
|
||||||
|
tt = &gpus[device++].adl.targettemp;
|
||||||
|
*tt = val;
|
||||||
|
}
|
||||||
|
if (device == 1) {
|
||||||
|
for (i = device; i < 16; i++) {
|
||||||
|
tt = &gpus[i].adl.targettemp;
|
||||||
|
*tt = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* These options are available from config file or commandline */
|
/* These options are available from config file or commandline */
|
||||||
@ -1349,13 +1442,13 @@ static struct opt_table opt_config_table[] = {
|
|||||||
"GPU fan percentage range - one value, range and/or comma separated list (e.g. 0-85,85,65)"),
|
"GPU fan percentage range - one value, range and/or comma separated list (e.g. 0-85,85,65)"),
|
||||||
OPT_WITH_ARG("--gpu-memclock",
|
OPT_WITH_ARG("--gpu-memclock",
|
||||||
set_gpu_memclock, NULL, NULL,
|
set_gpu_memclock, NULL, NULL,
|
||||||
"Set the GPU memory (over)clock in Mhz - one value for all or separate by commas for per card."),
|
"Set the GPU memory (over)clock in Mhz - one value for all or separate by commas for per card"),
|
||||||
OPT_WITH_ARG("--gpu-powertune",
|
OPT_WITH_ARG("--gpu-powertune",
|
||||||
set_gpu_powertune, NULL, NULL,
|
set_gpu_powertune, NULL, NULL,
|
||||||
"Set the GPU powertune percentage - one value for all or separate by commas for per card."),
|
"Set the GPU powertune percentage - one value for all or separate by commas for per card"),
|
||||||
OPT_WITH_ARG("--gpu-vddc",
|
OPT_WITH_ARG("--gpu-vddc",
|
||||||
set_gpu_vddc, NULL, NULL,
|
set_gpu_vddc, NULL, NULL,
|
||||||
"Set the GPU voltage in Volts - one value for all or separate by commas for per card."),
|
"Set the GPU voltage in Volts - one value for all or separate by commas for per card"),
|
||||||
#endif
|
#endif
|
||||||
OPT_WITH_ARG("--intensity|-I",
|
OPT_WITH_ARG("--intensity|-I",
|
||||||
forced_int_1010, NULL, &scan_intensity,
|
forced_int_1010, NULL, &scan_intensity,
|
||||||
@ -1443,17 +1536,17 @@ static struct opt_table opt_config_table[] = {
|
|||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_ADL
|
#ifdef HAVE_ADL
|
||||||
OPT_WITH_ARG("--temp-cutoff",
|
OPT_WITH_ARG("--temp-cutoff",
|
||||||
set_int_0_to_200, opt_show_intval, &opt_cutofftemp,
|
set_temp_cutoff, opt_show_intval, &opt_cutofftemp,
|
||||||
"Set the temperature where a GPU device will be automatically disabled"),
|
"Temperature where a GPU device will be automatically disabled, one value or comma separated list"),
|
||||||
OPT_WITH_ARG("--temp-hysteresis",
|
OPT_WITH_ARG("--temp-hysteresis",
|
||||||
set_int_1_to_10, opt_show_intval, &opt_hysteresis,
|
set_int_1_to_10, opt_show_intval, &opt_hysteresis,
|
||||||
"Set how much the temperature can fluctuate outside limits when automanaging speeds"),
|
"Set how much the temperature can fluctuate outside limits when automanaging speeds"),
|
||||||
OPT_WITH_ARG("--temp-overheat",
|
OPT_WITH_ARG("--temp-overheat",
|
||||||
set_int_0_to_200, opt_show_intval, &opt_overheattemp,
|
set_temp_overheat, opt_show_intval, &opt_overheattemp,
|
||||||
"Set the overheat temperature when automatically managing fan and GPU speeds"),
|
"Overheat temperature when automatically managing fan and GPU speeds, one value or comma separated list"),
|
||||||
OPT_WITH_ARG("--temp-target",
|
OPT_WITH_ARG("--temp-target",
|
||||||
set_int_0_to_200, opt_show_intval, &opt_targettemp,
|
set_temp_target, opt_show_intval, &opt_targettemp,
|
||||||
"Set the target temperature when automatically managing fan and GPU speeds"),
|
"Target temperature when automatically managing fan and GPU speeds, one value or comma separated list"),
|
||||||
#endif
|
#endif
|
||||||
OPT_WITHOUT_ARG("--text-only|-T",
|
OPT_WITHOUT_ARG("--text-only|-T",
|
||||||
opt_set_invbool, &use_curses,
|
opt_set_invbool, &use_curses,
|
||||||
|
Loading…
Reference in New Issue
Block a user