Added new action control-all (allows a combination of controls)

This commit is contained in:
HackTestes
2024-05-18 12:04:37 -03:00
parent f4603e0d0a
commit a5e5b557b5
4 changed files with 26 additions and 1 deletions

View File

@@ -366,7 +366,7 @@ WantedBy=multi-user.target
- [x] Temperature threshold control
- [ ] Enable all controls
- [x] Enable all controls
- [x] Help action must not require NVML initialization

View File

@@ -429,4 +429,22 @@ def temp_control(configuration):
if configuration.single_use == True:
break
time.sleep(configuration.time_interval)
def control_all(configuration):
gpu_handle = get_GPU_handle(configuration.gpu_name, configuration.gpu_uuid)
print_GPU_info(gpu_handle)
while(True):
if configuration.power_limit != 0:
power_control_subroutine(gpu_handle, configuration.power_limit, configuration.dry_run)
if configuration.acoustic_temp_limit != 0:
temp_control_subroutine(gpu_handle, configuration.acoustic_temp_limit, configuration.dry_run)
fan_control_subroutine(gpu_handle, configuration)
time.sleep(configuration.time_interval)

View File

@@ -49,6 +49,10 @@ def main():
# Temperature threshold control
case 'temp-control':
main_funcs.temp_control(config)
# Enable everything
case 'control-all':
main_funcs.control_all(config)
# One should call shutdown with or without erros, this is why I am using finally
finally:

View File

@@ -133,6 +133,9 @@ def parse_cmd_args(args):
elif (action == 'temp-control'):
configuration.action = 'temp-control'
elif (action == 'control-all'):
configuration.action = 'control-all'
else:
print(f'Invalid action: {action}')
raise InvalidAction("The action passed as argument is incorrect")