mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Allow target, overheat and hysteresis temperatures to be set from command line.
This commit is contained in:
parent
847adf689b
commit
e9f886d805
20
adl.c
20
adl.c
@ -20,6 +20,10 @@ bool adl_active;
|
|||||||
|
|
||||||
#include "adl_functions.h"
|
#include "adl_functions.h"
|
||||||
|
|
||||||
|
int opt_hysteresis = 5;
|
||||||
|
int opt_targettemp = 75;
|
||||||
|
int opt_overheattemp = 85;
|
||||||
|
|
||||||
// Memory allocation function
|
// Memory allocation function
|
||||||
static void * __stdcall ADL_Main_Memory_Alloc(int iSize)
|
static void * __stdcall ADL_Main_Memory_Alloc(int iSize)
|
||||||
{
|
{
|
||||||
@ -232,8 +236,8 @@ void init_adl(int nDevs)
|
|||||||
ADL_Overdrive5_FanSpeed_Get(ga->iAdapterIndex, 0, &ga->DefFanSpeedValue);
|
ADL_Overdrive5_FanSpeed_Get(ga->iAdapterIndex, 0, &ga->DefFanSpeedValue);
|
||||||
|
|
||||||
/* Set some default temperatures for autotune when enabled */
|
/* Set some default temperatures for autotune when enabled */
|
||||||
ga->targettemp = 75;
|
ga->targettemp = opt_targettemp;
|
||||||
ga->overtemp = 85;
|
ga->overtemp = opt_overheattemp;
|
||||||
if (opt_autofan)
|
if (opt_autofan)
|
||||||
ga->autofan = true;
|
ga->autofan = true;
|
||||||
if (opt_autoengine)
|
if (opt_autoengine)
|
||||||
@ -328,7 +332,7 @@ int gpu_fanspeed(int gpu)
|
|||||||
return ga->lpFanSpeedValue.iFanSpeed;
|
return ga->lpFanSpeedValue.iFanSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gpu_fanpercent(int gpu)
|
int gpu_fanpercent(int gpu)
|
||||||
{
|
{
|
||||||
struct gpu_adl *ga;
|
struct gpu_adl *ga;
|
||||||
|
|
||||||
@ -581,15 +585,15 @@ void gpu_autotune(int gpu)
|
|||||||
ga = &gpus[gpu].adl;
|
ga = &gpus[gpu].adl;
|
||||||
if (temp && fanpercent >= 0 && ga->autofan) {
|
if (temp && fanpercent >= 0 && ga->autofan) {
|
||||||
if (temp > ga->overtemp && fanpercent < 100) {
|
if (temp > ga->overtemp && fanpercent < 100) {
|
||||||
applog(LOG_WARNING, "Overhead detected, increasing fan to 100%");
|
applog(LOG_WARNING, "Overheat detected, increasing fan to 100%");
|
||||||
newpercent = 100;
|
newpercent = 100;
|
||||||
} else if (temp > ga->targettemp && fanpercent < 85) {
|
} else if (temp > ga->targettemp && fanpercent < 85) {
|
||||||
if (opt_debug)
|
if (opt_debug)
|
||||||
applog(LOG_DEBUG, "Temperature over target, increasing fanspeed");
|
applog(LOG_DEBUG, "Temperature over target, increasing fanspeed");
|
||||||
newpercent = fanpercent + 5;
|
newpercent = fanpercent + 5;
|
||||||
} else if (fanpercent && temp < ga->targettemp - 5) {
|
} else if (fanpercent && temp < ga->targettemp - opt_hysteresis) {
|
||||||
if (opt_debug)
|
if (opt_debug)
|
||||||
applog(LOG_DEBUG, "Temperature 5 degrees below target, decreasing fanspeed");
|
applog(LOG_DEBUG, "Temperature %d degrees below target, decreasing fanspeed", opt_hysteresis);
|
||||||
newpercent = fanpercent - 1;
|
newpercent = fanpercent - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,9 +612,9 @@ void gpu_autotune(int gpu)
|
|||||||
if (temp > ga->overtemp && engine > ga->minspeed) {
|
if (temp > ga->overtemp && engine > ga->minspeed) {
|
||||||
applog(LOG_WARNING, "Overheat detected, decreasing GPU clock speed");
|
applog(LOG_WARNING, "Overheat detected, decreasing GPU clock speed");
|
||||||
newengine = ga->minspeed;
|
newengine = ga->minspeed;
|
||||||
} else if (temp > ga->targettemp + 5 && engine > ga->minspeed && fan_optimal) {
|
} else if (temp > ga->targettemp + opt_hysteresis && engine > ga->minspeed && fan_optimal) {
|
||||||
if (opt_debug)
|
if (opt_debug)
|
||||||
applog(LOG_DEBUG, "Temperature over target, decreasing clock speed");
|
applog(LOG_DEBUG, "Temperature %d degrees over target, decreasing clock speed", opt_hysteresis);
|
||||||
newengine = engine - ga->lpOdParameters.sEngineClock.iStep;
|
newengine = engine - ga->lpOdParameters.sEngineClock.iStep;
|
||||||
} else if (temp < ga->targettemp && engine < ga->maxspeed) {
|
} else if (temp < ga->targettemp && engine < ga->maxspeed) {
|
||||||
if (opt_debug)
|
if (opt_debug)
|
||||||
|
4
adl.h
4
adl.h
@ -2,6 +2,9 @@
|
|||||||
#define __ADL_H__
|
#define __ADL_H__
|
||||||
bool adl_active;
|
bool adl_active;
|
||||||
#ifdef HAVE_ADL
|
#ifdef HAVE_ADL
|
||||||
|
int opt_hysteresis;
|
||||||
|
int opt_targettemp;
|
||||||
|
int opt_overheattemp;
|
||||||
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);
|
||||||
@ -9,6 +12,7 @@ int gpu_memclock(int gpu);
|
|||||||
float gpu_vddc(int gpu);
|
float gpu_vddc(int gpu);
|
||||||
int gpu_activity(int gpu);
|
int gpu_activity(int gpu);
|
||||||
int gpu_fanspeed(int gpu);
|
int gpu_fanspeed(int gpu);
|
||||||
|
int gpu_fanpercent(int gpu);
|
||||||
void change_gpusettings(int gpu);
|
void change_gpusettings(int gpu);
|
||||||
void gpu_autotune(int gpu);
|
void gpu_autotune(int gpu);
|
||||||
void clear_adl(int nDevs);
|
void clear_adl(int nDevs);
|
||||||
|
21
main.c
21
main.c
@ -967,6 +967,11 @@ 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_100(const char *arg, int *i)
|
||||||
|
{
|
||||||
|
return set_int_range(arg, i, 0, 100);
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
@ -1246,7 +1251,17 @@ static struct opt_table opt_config_table[] = {
|
|||||||
opt_set_bool, &use_syslog,
|
opt_set_bool, &use_syslog,
|
||||||
"Use system log for output messages (default: standard error)"),
|
"Use system log for output messages (default: standard error)"),
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_ADL
|
||||||
|
OPT_WITH_ARG("--temp-hysteresis",
|
||||||
|
set_int_0_to_10, opt_show_intval, &opt_hysteresis,
|
||||||
|
"Set how much the temperature can fluctuate outside limits when automanaging speeds"),
|
||||||
|
OPT_WITH_ARG("--temp-overheat",
|
||||||
|
set_int_0_to_100, opt_show_intval, &opt_overheattemp,
|
||||||
|
"Set the overheat temperature when automatically managing fan and GPU speeds"),
|
||||||
|
OPT_WITH_ARG("--temp-target",
|
||||||
|
set_int_0_to_100, opt_show_intval, &opt_targettemp,
|
||||||
|
"Set the target temperature when automatically managing fan and GPU speeds"),
|
||||||
|
#endif
|
||||||
OPT_WITHOUT_ARG("--text-only|-T",
|
OPT_WITHOUT_ARG("--text-only|-T",
|
||||||
opt_set_invbool, &use_curses,
|
opt_set_invbool, &use_curses,
|
||||||
"Disable ncurses formatted screen output"),
|
"Disable ncurses formatted screen output"),
|
||||||
@ -2764,8 +2779,8 @@ retry:
|
|||||||
cgpu->efficiency, cgpu->utility);
|
cgpu->efficiency, cgpu->utility);
|
||||||
#ifdef HAVE_ADL
|
#ifdef HAVE_ADL
|
||||||
if (gpus[gpu].has_adl)
|
if (gpus[gpu].has_adl)
|
||||||
wlog("Temp: %.1f °C\nFan Speed: %d RPM\nEngine Clock: %d MHz\nMemory Clock: %d Mhz\nVddc: %.3f V\nActivity: %d%%\n",
|
wlog("Temp: %.1f °C\nFan Speed: %d%% (%d RPM)\nEngine Clock: %d MHz\nMemory Clock: %d Mhz\nVddc: %.3f V\nActivity: %d%%\n",
|
||||||
gpu_temp(gpu), gpu_fanspeed(gpu), gpu_engineclock(gpu), gpu_memclock(gpu), gpu_vddc(gpu), gpu_activity(gpu));
|
gpu_temp(gpu), gpu_fanpercent(gpu), gpu_fanspeed(gpu), gpu_engineclock(gpu), gpu_memclock(gpu), gpu_vddc(gpu), gpu_activity(gpu));
|
||||||
#endif
|
#endif
|
||||||
wlog("Last initialised: %s\n", cgpu->init);
|
wlog("Last initialised: %s\n", cgpu->init);
|
||||||
for (i = 0; i < mining_threads; i++) {
|
for (i = 0; i < mining_threads; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user