mirror of
https://github.com/brockar/NVML-GPU-Control.git
synced 2026-01-12 07:20:58 -03:00
Added new action control-all (allows a combination of controls)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -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:
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user