def main(self): logger.info(f'starting amdgpu-fan') speed_by_card = {} while True: for name, card in self._scanner.cards.items(): current_speed = speed_by_card.get(name) # Reset current speed if it is off for more than 10% if current_speed is not None and abs(current_speed - card.fan_speed) > 10: current_speed = None temp = card.gpu_temp speed = max(0, int(self.curve.get_speed(int(temp)))) if current_speed is not None and current_speed >= speed: speed = max( 0, int(self.curve.get_speed(int(temp) + self.temp_drop))) if current_speed <= speed: continue logger.debug( f'{name}: Temp {temp}, Setting fan speed to: {speed}, fan speed: {card.fan_speed}, min: {card.fan_min}, max: {card.fan_max}' ) card.set_fan_speed(speed) speed_by_card[name] = speed time.sleep(self._interval)
def main(self): logger.info(f'starting amdgpu-fan') while True: for name, card in self._scanner.cards.items(): temp = card.gpu_temp speed = int(self.curve.get_speed(int(temp))) if speed < 0: speed = 0 logger.debug(f'{name}: Temp {temp}, Setting fan speed to: {speed}, fan speed{card.fan_speed}, min:{card.fan_min}, max:{card.fan_max}') card.set_fan_speed(speed) time.sleep(self._frequency)
def load_config(path): logger.debug(f'loading config from {path}') with open(path) as f: return yaml.load(f, Loader=yaml.FullLoader)
def load_config(path): logger.debug(f'loading config from {path}') with open(path) as f: return yaml.safe_load(f)