mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 20:44:19 +00:00
Implement setting the GPU fan speed of all devices or each device as a comma separated value.
This commit is contained in:
parent
8ae273c56c
commit
3a5663cac1
8
adl.c
8
adl.c
@ -252,6 +252,14 @@ void init_adl(int nDevs)
|
|||||||
|
|
||||||
/* Save the fanspeed values as defaults in case we reset later */
|
/* Save the fanspeed values as defaults in case we reset later */
|
||||||
ADL_Overdrive5_FanSpeed_Get(ga->iAdapterIndex, 0, &ga->DefFanSpeedValue);
|
ADL_Overdrive5_FanSpeed_Get(ga->iAdapterIndex, 0, &ga->DefFanSpeedValue);
|
||||||
|
if (gpus[gpu].gpu_fan) {
|
||||||
|
ADL_Overdrive5_FanSpeed_Get(ga->iAdapterIndex, 0, &ga->lpFanSpeedValue);
|
||||||
|
ga->lpFanSpeedValue.iFanSpeed = gpus[gpu].gpu_fan;
|
||||||
|
ga->lpFanSpeedValue.iFlags = ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED;
|
||||||
|
ga->lpFanSpeedValue.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_PERCENT;
|
||||||
|
applog(LOG_INFO, "Setting GPU %d fan speed to %d%%", gpu, gpus[gpu].gpu_fan);
|
||||||
|
ADL_Overdrive5_FanSpeed_Set(ga->iAdapterIndex, 0, &ga->lpFanSpeedValue);
|
||||||
|
}
|
||||||
|
|
||||||
/* Set some default temperatures for autotune when enabled */
|
/* Set some default temperatures for autotune when enabled */
|
||||||
ga->targettemp = opt_targettemp;
|
ga->targettemp = opt_targettemp;
|
||||||
|
30
main.c
30
main.c
@ -1139,6 +1139,33 @@ static char *set_gpu_engine(char *arg)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *set_gpu_fan(char *arg)
|
||||||
|
{
|
||||||
|
int i, val = 0, device = 0;
|
||||||
|
char *saveptr = NULL, *nextptr;
|
||||||
|
|
||||||
|
nextptr = strtok_r(arg, ",", &saveptr);
|
||||||
|
if (nextptr == NULL)
|
||||||
|
return "Invalid parameters for set gpu fan";
|
||||||
|
val = atoi(nextptr);
|
||||||
|
if (val < 0 || val > 100)
|
||||||
|
return "Invalid value passed to set_gpu_fan";
|
||||||
|
|
||||||
|
gpus[device++].gpu_fan = val;
|
||||||
|
|
||||||
|
while ((nextptr = strtok_r(NULL, ",", &saveptr)) != NULL) {
|
||||||
|
val = atoi(nextptr);
|
||||||
|
if (val < 0 || val > 100)
|
||||||
|
return "Invalid value passed to set_gpu_fan";
|
||||||
|
|
||||||
|
gpus[device++].gpu_fan = val;
|
||||||
|
}
|
||||||
|
for (i = device; i < 16; i++)
|
||||||
|
gpus[i].gpu_fan = val;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static char *set_gpu_memclock(char *arg)
|
static char *set_gpu_memclock(char *arg)
|
||||||
{
|
{
|
||||||
int i, val = 0, device = 0;
|
int i, val = 0, device = 0;
|
||||||
@ -1260,6 +1287,9 @@ static struct opt_table opt_config_table[] = {
|
|||||||
OPT_WITH_ARG("--gpu-engine",
|
OPT_WITH_ARG("--gpu-engine",
|
||||||
set_gpu_engine, NULL, NULL,
|
set_gpu_engine, NULL, NULL,
|
||||||
"Set the GPU engine (over)clock in Mhz - one value for all or separate by commas for per card."),
|
"Set the GPU engine (over)clock in Mhz - one value for all or separate by commas for per card."),
|
||||||
|
OPT_WITH_ARG("--gpu-fan",
|
||||||
|
set_gpu_fan, NULL, NULL,
|
||||||
|
"Set the GPU fan percentage - one value for all or separate by commas for per card."),
|
||||||
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."),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user