Eraden / amdgpud

MIT License
193 stars 11 forks source link

Feature gpu usage #60

Closed Eraden closed 12 months ago

Eraden commented 1 year ago

Resolves #59

emansom commented 1 year ago

Thanks for implementing this. When testing a locally built amdfand from this PR: the UsagePoint matrix currently doesn't seem to blast the fans during gaming with the following mapping.toml. Whichever matrix has the highest speed defined should take precedent, right?

Mapping: `/etc/amdfand/mapping.toml` ```toml temp_input = "temp1_input" log_level = "Debug" update_rate = 6000 [[temp_matrix]] temp = 0.0 speed = 0.0 [[temp_matrix]] temp = 30.0 speed = 0.0 [[temp_matrix]] temp = 35.0 speed = 10.0 [[temp_matrix]] temp = 40.0 speed = 25.0 [[temp_matrix]] temp = 50.0 speed = 35.0 [[temp_matrix]] temp = 60.0 speed = 70.0 [[usage_matrix]] usage = 20.0 speed = 10.0 [[usage_matrix]] usage = 30.0 speed = 65.0 [[usage_matrix]] usage = 65.0 speed = 70.0 ```
Eraden commented 1 year ago

Yes. This is still in progress but it should works now. When did you cloned and built? Only newest version is working correctly

emansom commented 1 year ago

Yes. This is still in progress but it should works now. When did you cloned and built? Only newest version is working correctly

I built it yesterday 23:21:39 CEST (Central European Summer Time). Testing with a rebuilt version now yields the same result. If the matrix calculations are working correctly, then I hypothesize the usage calculation needs to be calculated differently.

As some game engines tend to batch queue draw calls, where a few milliseconds the GPU is at 99% load, and most of the time 0-10%.

A way to combat this would be to calculate an accurate busy percentage by comparing measurements, similar to how nvtop implements it here and here.

Eraden commented 1 year ago

Thanks for resources. And I will also try to solve this ASAP

Eraden commented 1 year ago

Hi, current code should works properly. I tested it with glmark2 and amdfand did use GPU usage to manage fan speed.

I need to fix GUI so this will be on hold until fix but you can compile from this branch and use it safely.

cargo build --release --bin amdfand
emansom commented 1 year ago

It does detect GPU usage now and ramps up accordingly! However, it now seems to sporadically set the speed to 100.

Debug log: ``` apr 21 15:10:46 x11sslf systemd[1]: Started AMD GPU fan daemon. apr 21 15:10:46 x11sslf amdfand[1273420]: Config { path: "/etc/amdfand/mapping.toml", temp_input: Some(TempInput(1)), log_level: Debug, cards: None, update_rate: 6000, temp_matrix: [TempPoint { temp: 0.0, speed: 0.0 }, TempPoint { temp: 30.0, speed: 0.0 }, TempPoint { temp: 35.0, speed: 10.0 }, TempPoint { temp: 40.0, speed: 25.0 }, TempPoint { temp: 50.0, speed: 35.0 }, TempPoint { temp: 60.0, speed: 70.0 }], usage_matrix: [UsagePoint { usage: 0.0, speed: 0.0 }, UsagePoint { usage: 30.0, speed: 10.0 }, UsagePoint { usage: 100.0, speed: 33.0 }] } apr 21 15:10:46 x11sslf amdfand[1273420]: 2023-04-21T13:10:46.114077Z DEBUG amdgpu::lock_file: Creating pid lock for path "/var/lib/amdfand/amdfand.pid" apr 21 15:10:46 x11sslf amdfand[1273420]: 2023-04-21T13:10:46.114104Z DEBUG amdgpu::lock_file: PID LOCK acquiring /var/lib/amdfand/amdfand.pid apr 21 15:10:46 x11sslf amdfand[1273420]: 2023-04-21T13:10:46.114111Z DEBUG amdgpu::lock_file: No collision detected apr 21 15:10:46 x11sslf amdfand[1273420]: 2023-04-21T13:10:46.114199Z INFO amdgpu::utils: opening hw mon for Card(0) apr 21 15:10:46 x11sslf amdfand[1273420]: 2023-04-21T13:10:46.114231Z INFO amdgpu::utils: is vendor ok? true apr 21 15:10:46 x11sslf amdfand[1273420]: 2023-04-21T13:10:46.114250Z INFO amdgpu::utils: is hwmon name ok? true apr 21 15:10:46 x11sslf amdfand[1273420]: 2023-04-21T13:10:46.114338Z DEBUG amdfand::service: Changing speed to 13.00 apr 21 15:10:52 x11sslf amdfand[1273420]: 2023-04-21T13:10:52.114538Z DEBUG amdfand::service: Speed should not change apr 21 15:10:58 x11sslf amdfand[1273420]: 2023-04-21T13:10:58.114694Z DEBUG amdfand::service: Changing speed to 30.37 apr 21 15:11:04 x11sslf amdfand[1273420]: 2023-04-21T13:11:04.115006Z DEBUG amdfand::service: Changing speed to 19.00 apr 21 15:11:10 x11sslf amdfand[1273420]: 2023-04-21T13:11:10.115259Z DEBUG amdfand::service: Speed should not change apr 21 15:11:16 x11sslf amdfand[1273420]: 2023-04-21T13:11:16.115387Z DEBUG amdfand::service: Changing speed to 100.00 apr 21 15:11:22 x11sslf amdfand[1273420]: 2023-04-21T13:11:22.115591Z DEBUG amdfand::service: Changing speed to 25.00 apr 21 15:11:28 x11sslf amdfand[1273420]: 2023-04-21T13:11:28.115816Z DEBUG amdfand::service: Changing speed to 100.00 apr 21 15:11:34 x11sslf amdfand[1273420]: 2023-04-21T13:11:34.116374Z DEBUG amdfand::service: Changing speed to 25.00 apr 21 15:11:40 x11sslf amdfand[1273420]: 2023-04-21T13:11:40.116692Z DEBUG amdfand::service: Changing speed to 13.00 apr 21 15:11:46 x11sslf amdfand[1273420]: 2023-04-21T13:11:46.117041Z DEBUG amdfand::service: Speed should not change apr 21 15:11:52 x11sslf amdfand[1273420]: 2023-04-21T13:11:52.117413Z DEBUG amdfand::service: Speed should not change apr 21 15:11:58 x11sslf amdfand[1273420]: 2023-04-21T13:11:58.117583Z DEBUG amdfand::service: Changing speed to 16.00 apr 21 15:12:04 x11sslf amdfand[1273420]: 2023-04-21T13:12:04.117809Z DEBUG amdfand::service: Changing speed to 13.00 ```
Mapping: `/etc/amdfand/mapping.toml` ```toml temp_input = "temp1_input" log_level = "Debug" update_rate = 6000 [[temp_matrix]] temp = 0.0 speed = 0.0 [[temp_matrix]] temp = 30.0 speed = 0.0 [[temp_matrix]] temp = 35.0 speed = 10.0 [[temp_matrix]] temp = 40.0 speed = 25.0 [[temp_matrix]] temp = 50.0 speed = 35.0 [[temp_matrix]] temp = 60.0 speed = 70.0 [[usage_matrix]] usage = 0.0 speed = 0.0 [[usage_matrix]] usage = 30.0 speed = 10.0 [[usage_matrix]] usage = 100.0 speed = 33.0 ```
emansom commented 1 year ago

I presume this line here is the root cause.

Instead of fixed constants, the min and max should be more variable, similar to the min_speed and max_speed functions. (refactored to use the usage matrix)

emansom commented 1 year ago

The speed still sporadically goes to 100, while the defined max is set to 33.

With light desktop usage around the 5-10% GPU load, it seems to think the max is reached somehow.

Schermafdruk van 2023-04-21 20-12-42

Eraden commented 1 year ago

I added some additional logs. Can you share your logs with me?

Please git fetch && git reset origin/feature-gpu-usage and compile.

Then run with at least Debug log level and share output of there was at least couple full speed occurs

This will allows me to understand why this is happening.

Also consider adding 2 additional points in usage matrix to tune service a little bit

emansom commented 1 year ago

Appreciate the detailed instructions, however, you don't have to bother. Have created an AUR package called amdfand and am building from a locally modified version that pulls the feature-gpu-usage branch. 🙂

Debug log: ``` apr 21 22:13:39 x11sslf systemd[1]: Started AMD GPU fan daemon. apr 21 22:13:39 x11sslf amdfand[1412949]: 2023-04-21T20:13:39.324597Z DEBUG amdgpu::lock_file: Creating pid lock for path "/var/lib/amdfand/amdfand.pid" apr 21 22:13:39 x11sslf amdfand[1412949]: 2023-04-21T20:13:39.324613Z DEBUG amdgpu::lock_file: PID LOCK acquiring /var/lib/amdfand/amdfand.pid apr 21 22:13:39 x11sslf amdfand[1412949]: 2023-04-21T20:13:39.324620Z DEBUG amdgpu::lock_file: No collision detected apr 21 22:13:39 x11sslf amdfand[1412949]: 2023-04-21T20:13:39.324686Z INFO amdgpu::utils: opening hw mon for Card(0) apr 21 22:13:39 x11sslf amdfand[1412949]: 2023-04-21T20:13:39.324718Z INFO amdgpu::utils: is vendor ok? true apr 21 22:13:39 x11sslf amdfand[1412949]: 2023-04-21T20:13:39.324739Z INFO amdgpu::utils: is hwmon name ok? true apr 21 22:13:39 x11sslf amdfand[1412949]: 2023-04-21T20:13:39.324813Z DEBUG amdfand::service: { gpu_temp: 34.00, gpu_usage: 1.00, temp_fan_speed: 8.00, usage_fan_speed: 0.33, value: 8.00 } apr 21 22:13:39 x11sslf amdfand[1412949]: 2023-04-21T20:13:39.324818Z DEBUG amdfand::service: Changing speed to 8.00 apr 21 22:13:45 x11sslf amdfand[1412949]: 2023-04-21T20:13:45.325084Z DEBUG amdfand::service: { gpu_temp: 33.00, gpu_usage: 1.00, temp_fan_speed: 6.00, usage_fan_speed: 0.33, value: 6.00 } apr 21 22:13:45 x11sslf amdfand[1412949]: 2023-04-21T20:13:45.325097Z DEBUG amdfand::service: Changing speed to 6.00 apr 21 22:13:51 x11sslf amdfand[1412949]: 2023-04-21T20:13:51.325350Z DEBUG amdfand::service: { gpu_temp: 33.00, gpu_usage: 1.00, temp_fan_speed: 6.00, usage_fan_speed: 0.33, value: 6.00 } apr 21 22:13:51 x11sslf amdfand[1412949]: 2023-04-21T20:13:51.325365Z DEBUG amdfand::service: Speed should not change apr 21 22:13:57 x11sslf amdfand[1412949]: 2023-04-21T20:13:57.325730Z DEBUG amdfand::service: { gpu_temp: 33.00, gpu_usage: 0.00, temp_fan_speed: 6.00, usage_fan_speed: 0.00, value: 6.00 } apr 21 22:13:57 x11sslf amdfand[1412949]: 2023-04-21T20:13:57.325746Z DEBUG amdfand::service: Speed should not change apr 21 22:14:03 x11sslf amdfand[1412949]: 2023-04-21T20:14:03.325863Z DEBUG amdfand::service: { gpu_temp: 33.00, gpu_usage: 0.00, temp_fan_speed: 6.00, usage_fan_speed: 0.00, value: 6.00 } apr 21 22:14:03 x11sslf amdfand[1412949]: 2023-04-21T20:14:03.325891Z DEBUG amdfand::service: Speed should not change apr 21 22:14:09 x11sslf amdfand[1412949]: 2023-04-21T20:14:09.326248Z DEBUG amdfand::service: { gpu_temp: 33.00, gpu_usage: 0.00, temp_fan_speed: 6.00, usage_fan_speed: 0.00, value: 6.00 } apr 21 22:14:09 x11sslf amdfand[1412949]: 2023-04-21T20:14:09.326264Z DEBUG amdfand::service: Speed should not change apr 21 22:14:15 x11sslf amdfand[1412949]: 2023-04-21T20:14:15.326622Z DEBUG amdfand::service: { gpu_temp: 33.00, gpu_usage: 0.00, temp_fan_speed: 6.00, usage_fan_speed: 0.00, value: 6.00 } apr 21 22:14:15 x11sslf amdfand[1412949]: 2023-04-21T20:14:15.326638Z DEBUG amdfand::service: Speed should not change apr 21 22:14:21 x11sslf amdfand[1412949]: 2023-04-21T20:14:21.326919Z DEBUG amdfand::service: { gpu_temp: 33.00, gpu_usage: 0.00, temp_fan_speed: 6.00, usage_fan_speed: 0.00, value: 6.00 } apr 21 22:14:21 x11sslf amdfand[1412949]: 2023-04-21T20:14:21.326935Z DEBUG amdfand::service: Speed should not change apr 21 22:14:27 x11sslf amdfand[1412949]: 2023-04-21T20:14:27.327081Z DEBUG amdfand::service: { gpu_temp: 33.00, gpu_usage: 0.00, temp_fan_speed: 6.00, usage_fan_speed: 0.00, value: 6.00 } apr 21 22:14:27 x11sslf amdfand[1412949]: 2023-04-21T20:14:27.327098Z DEBUG amdfand::service: Speed should not change apr 21 22:14:33 x11sslf amdfand[1412949]: 2023-04-21T20:14:33.327240Z DEBUG amdfand::service: { gpu_temp: 34.00, gpu_usage: 0.00, temp_fan_speed: 8.00, usage_fan_speed: 0.00, value: 8.00 } apr 21 22:14:33 x11sslf amdfand[1412949]: 2023-04-21T20:14:33.327253Z DEBUG amdfand::service: Changing speed to 8.00 apr 21 22:14:39 x11sslf amdfand[1412949]: 2023-04-21T20:14:39.327449Z DEBUG amdfand::service: { gpu_temp: 36.00, gpu_usage: 16.00, temp_fan_speed: 13.00, usage_fan_speed: 5.33, value: 13.00 } apr 21 22:14:39 x11sslf amdfand[1412949]: 2023-04-21T20:14:39.327464Z DEBUG amdfand::service: Changing speed to 13.00 apr 21 22:14:45 x11sslf amdfand[1412949]: 2023-04-21T20:14:45.327638Z DEBUG amdfand::service: { gpu_temp: 36.00, gpu_usage: 12.00, temp_fan_speed: 13.00, usage_fan_speed: 4.00, value: 13.00 } apr 21 22:14:45 x11sslf amdfand[1412949]: 2023-04-21T20:14:45.327652Z DEBUG amdfand::service: Speed should not change apr 21 22:14:51 x11sslf amdfand[1412949]: 2023-04-21T20:14:51.327770Z DEBUG amdfand::service: { gpu_temp: 36.00, gpu_usage: 0.00, temp_fan_speed: 13.00, usage_fan_speed: 0.00, value: 13.00 } apr 21 22:14:51 x11sslf amdfand[1412949]: 2023-04-21T20:14:51.327782Z DEBUG amdfand::service: Speed should not change apr 21 22:14:57 x11sslf amdfand[1412949]: 2023-04-21T20:14:57.327942Z DEBUG amdfand::service: { gpu_temp: 36.00, gpu_usage: 0.00, temp_fan_speed: 13.00, usage_fan_speed: 0.00, value: 13.00 } apr 21 22:14:57 x11sslf amdfand[1412949]: 2023-04-21T20:14:57.327954Z DEBUG amdfand::service: Speed should not change apr 21 22:15:03 x11sslf amdfand[1412949]: 2023-04-21T20:15:03.328080Z DEBUG amdfand::service: { gpu_temp: 37.00, gpu_usage: 100.00, temp_fan_speed: 16.00, usage_fan_speed: 100.00, value: 100.00 } apr 21 22:15:03 x11sslf amdfand[1412949]: 2023-04-21T20:15:03.328095Z DEBUG amdfand::service: Changing speed to 100.00 apr 21 22:15:09 x11sslf amdfand[1412949]: 2023-04-21T20:15:09.328261Z DEBUG amdfand::service: { gpu_temp: 42.00, gpu_usage: 45.00, temp_fan_speed: 27.00, usage_fan_speed: 14.93, value: 27.00 } apr 21 22:15:09 x11sslf amdfand[1412949]: 2023-04-21T20:15:09.328274Z DEBUG amdfand::service: Changing speed to 27.00 apr 21 22:15:15 x11sslf amdfand[1412949]: 2023-04-21T20:15:15.328455Z DEBUG amdfand::service: { gpu_temp: 36.00, gpu_usage: 0.00, temp_fan_speed: 13.00, usage_fan_speed: 0.00, value: 13.00 } apr 21 22:15:15 x11sslf amdfand[1412949]: 2023-04-21T20:15:15.328469Z DEBUG amdfand::service: Changing speed to 13.00 apr 21 22:15:21 x11sslf amdfand[1412949]: 2023-04-21T20:15:21.328761Z DEBUG amdfand::service: { gpu_temp: 35.00, gpu_usage: 0.00, temp_fan_speed: 10.00, usage_fan_speed: 0.00, value: 10.00 } apr 21 22:15:21 x11sslf amdfand[1412949]: 2023-04-21T20:15:21.328777Z DEBUG amdfand::service: Changing speed to 10.00 ```
Mapping: `/etc/amdfand/mapping.toml` ```toml temp_input = "temp1_input" log_level = "Debug" update_rate = 6000 [[temp_matrix]] temp = 0.0 speed = 0.0 [[temp_matrix]] temp = 30.0 speed = 0.0 [[temp_matrix]] temp = 35.0 speed = 10.0 [[temp_matrix]] temp = 40.0 speed = 25.0 [[temp_matrix]] temp = 50.0 speed = 35.0 [[temp_matrix]] temp = 60.0 speed = 70.0 [[usage_matrix]] usage = 0.0 speed = 0.0 [[usage_matrix]] usage = 30.0 speed = 10.0 [[usage_matrix]] usage = 100.0 speed = 33.0 ```
emansom commented 1 year ago

With 2 additional points in the usage matrix:

Debug log: ``` apr 21 22:27:13 x11sslf systemd[1]: Started AMD GPU fan daemon. apr 21 22:27:13 x11sslf amdfand[1429977]: 2023-04-21T20:27:13.080993Z DEBUG amdgpu::lock_file: Creating pid lock for path "/var/lib/amdfand/amdfand.pid" apr 21 22:27:13 x11sslf amdfand[1429977]: 2023-04-21T20:27:13.081007Z DEBUG amdgpu::lock_file: PID LOCK acquiring /var/lib/amdfand/amdfand.pid apr 21 22:27:13 x11sslf amdfand[1429977]: 2023-04-21T20:27:13.081028Z DEBUG amdgpu::lock_file: No collision detected apr 21 22:27:13 x11sslf amdfand[1429977]: 2023-04-21T20:27:13.081131Z INFO amdgpu::utils: opening hw mon for Card(0) apr 21 22:27:13 x11sslf amdfand[1429977]: 2023-04-21T20:27:13.081190Z INFO amdgpu::utils: is vendor ok? true apr 21 22:27:13 x11sslf amdfand[1429977]: 2023-04-21T20:27:13.081211Z INFO amdgpu::utils: is hwmon name ok? true apr 21 22:27:13 x11sslf amdfand[1429977]: 2023-04-21T20:27:13.081296Z DEBUG amdfand::service: { gpu_temp: 35.00, gpu_usage: 0.00, temp_fan_speed: 10.00, usage_fan_speed: 0.00, value: 10.00 } apr 21 22:27:13 x11sslf amdfand[1429977]: 2023-04-21T20:27:13.081301Z DEBUG amdfand::service: Changing speed to 10.00 apr 21 22:27:19 x11sslf amdfand[1429977]: 2023-04-21T20:27:19.081604Z DEBUG amdfand::service: { gpu_temp: 35.00, gpu_usage: 0.00, temp_fan_speed: 10.00, usage_fan_speed: 0.00, value: 10.00 } apr 21 22:27:19 x11sslf amdfand[1429977]: 2023-04-21T20:27:19.081619Z DEBUG amdfand::service: Speed should not change apr 21 22:27:25 x11sslf amdfand[1429977]: 2023-04-21T20:27:25.081761Z DEBUG amdfand::service: { gpu_temp: 37.00, gpu_usage: 42.00, temp_fan_speed: 16.00, usage_fan_speed: 13.43, value: 16.00 } apr 21 22:27:25 x11sslf amdfand[1429977]: 2023-04-21T20:27:25.081774Z DEBUG amdfand::service: Changing speed to 16.00 apr 21 22:27:31 x11sslf amdfand[1429977]: 2023-04-21T20:27:31.081983Z DEBUG amdfand::service: { gpu_temp: 37.00, gpu_usage: 81.00, temp_fan_speed: 16.00, usage_fan_speed: 25.94, value: 25.94 } apr 21 22:27:31 x11sslf amdfand[1429977]: 2023-04-21T20:27:31.082011Z DEBUG amdfand::service: Changing speed to 25.94 apr 21 22:27:37 x11sslf amdfand[1429977]: 2023-04-21T20:27:37.082190Z DEBUG amdfand::service: { gpu_temp: 37.00, gpu_usage: 62.00, temp_fan_speed: 16.00, usage_fan_speed: 19.14, value: 19.14 } apr 21 22:27:37 x11sslf amdfand[1429977]: 2023-04-21T20:27:37.082235Z DEBUG amdfand::service: Changing speed to 19.14 apr 21 22:27:43 x11sslf amdfand[1429977]: 2023-04-21T20:27:43.082407Z DEBUG amdfand::service: { gpu_temp: 37.00, gpu_usage: 0.00, temp_fan_speed: 16.00, usage_fan_speed: 0.00, value: 16.00 } apr 21 22:27:43 x11sslf amdfand[1429977]: 2023-04-21T20:27:43.082419Z DEBUG amdfand::service: Changing speed to 16.00 apr 21 22:27:49 x11sslf amdfand[1429977]: 2023-04-21T20:27:49.082781Z DEBUG amdfand::service: { gpu_temp: 37.00, gpu_usage: 0.00, temp_fan_speed: 16.00, usage_fan_speed: 0.00, value: 16.00 } apr 21 22:27:49 x11sslf amdfand[1429977]: 2023-04-21T20:27:49.082793Z DEBUG amdfand::service: Speed should not change apr 21 22:27:55 x11sslf amdfand[1429977]: 2023-04-21T20:27:55.083023Z DEBUG amdfand::service: { gpu_temp: 39.00, gpu_usage: 100.00, temp_fan_speed: 22.00, usage_fan_speed: 100.00, value: 100.00 } apr 21 22:27:55 x11sslf amdfand[1429977]: 2023-04-21T20:27:55.083036Z DEBUG amdfand::service: Changing speed to 100.00 apr 21 22:28:01 x11sslf amdfand[1429977]: 2023-04-21T20:28:01.083224Z DEBUG amdfand::service: { gpu_temp: 42.00, gpu_usage: 5.00, temp_fan_speed: 27.00, usage_fan_speed: 1.67, value: 27.00 } apr 21 22:28:01 x11sslf amdfand[1429977]: 2023-04-21T20:28:01.083240Z DEBUG amdfand::service: Changing speed to 27.00 apr 21 22:28:07 x11sslf amdfand[1429977]: 2023-04-21T20:28:07.083537Z DEBUG amdfand::service: { gpu_temp: 35.00, gpu_usage: 0.00, temp_fan_speed: 10.00, usage_fan_speed: 0.00, value: 10.00 } apr 21 22:28:07 x11sslf amdfand[1429977]: 2023-04-21T20:28:07.083551Z DEBUG amdfand::service: Changing speed to 10.00 apr 21 22:28:13 x11sslf amdfand[1429977]: 2023-04-21T20:28:13.083988Z DEBUG amdfand::service: { gpu_temp: 35.00, gpu_usage: 0.00, temp_fan_speed: 10.00, usage_fan_speed: 0.00, value: 10.00 } apr 21 22:28:13 x11sslf amdfand[1429977]: 2023-04-21T20:28:13.084004Z DEBUG amdfand::service: Speed should not change ```
Mapping: `/etc/amdfand/mapping.toml` ```toml temp_input = "temp1_input" log_level = "Debug" update_rate = 6000 [[temp_matrix]] temp = 0.0 speed = 0.0 [[temp_matrix]] temp = 30.0 speed = 0.0 [[temp_matrix]] temp = 35.0 speed = 10.0 [[temp_matrix]] temp = 40.0 speed = 25.0 [[temp_matrix]] temp = 50.0 speed = 35.0 [[temp_matrix]] temp = 60.0 speed = 70.0 [[usage_matrix]] usage = 0.0 speed = 0.0 [[usage_matrix]] usage = 15.0 speed = 5.0 [[usage_matrix]] usage = 30.0 speed = 10.0 [[usage_matrix]] usage = 65.0 speed = 20.0 [[usage_matrix]] usage = 100.0 speed = 33.0 ```
emansom commented 1 year ago

Without any usage matrix defined (commented out), the speed sporadically goes up higher, too. This time to 94 instead of 100.

Debug log: ``` apr 22 09:45:15 x11sslf systemd[1]: Started AMD GPU fan daemon. apr 22 09:45:15 x11sslf amdfand[1516980]: 2023-04-22T07:45:15.651255Z DEBUG amdgpu::lock_file: Creating pid lock for path "/var/lib/amdfand/amdfand.pid" apr 22 09:45:15 x11sslf amdfand[1516980]: 2023-04-22T07:45:15.651272Z DEBUG amdgpu::lock_file: PID LOCK acquiring /var/lib/amdfand/amdfand.pid apr 22 09:45:15 x11sslf amdfand[1516980]: 2023-04-22T07:45:15.651279Z DEBUG amdgpu::lock_file: No collision detected apr 22 09:45:15 x11sslf amdfand[1516980]: 2023-04-22T07:45:15.651347Z INFO amdgpu::utils: opening hw mon for Card(0) apr 22 09:45:15 x11sslf amdfand[1516980]: 2023-04-22T07:45:15.651380Z INFO amdgpu::utils: is vendor ok? true apr 22 09:45:15 x11sslf amdfand[1516980]: 2023-04-22T07:45:15.651399Z INFO amdgpu::utils: is hwmon name ok? true apr 22 09:45:15 x11sslf amdfand[1516980]: 2023-04-22T07:45:15.651480Z DEBUG amdfand::service: { gpu_temp: 38.00, gpu_usage: 0.00, temp_fan_speed: 19.00, usage_fan_speed: 0.00, value: 19.00 } apr 22 09:45:15 x11sslf amdfand[1516980]: 2023-04-22T07:45:15.651485Z DEBUG amdfand::service: Changing speed to 19.00 apr 22 09:45:21 x11sslf amdfand[1516980]: 2023-04-22T07:45:21.651797Z DEBUG amdfand::service: { gpu_temp: 38.00, gpu_usage: 0.00, temp_fan_speed: 19.00, usage_fan_speed: 0.00, value: 19.00 } apr 22 09:45:21 x11sslf amdfand[1516980]: 2023-04-22T07:45:21.651812Z DEBUG amdfand::service: Speed should not change apr 22 09:45:27 x11sslf amdfand[1516980]: 2023-04-22T07:45:27.652124Z DEBUG amdfand::service: { gpu_temp: 38.00, gpu_usage: 0.00, temp_fan_speed: 19.00, usage_fan_speed: 0.00, value: 19.00 } apr 22 09:45:27 x11sslf amdfand[1516980]: 2023-04-22T07:45:27.652139Z DEBUG amdfand::service: Speed should not change apr 22 09:45:33 x11sslf amdfand[1516980]: 2023-04-22T07:45:33.652281Z DEBUG amdfand::service: { gpu_temp: 38.00, gpu_usage: 0.00, temp_fan_speed: 19.00, usage_fan_speed: 0.00, value: 19.00 } apr 22 09:45:33 x11sslf amdfand[1516980]: 2023-04-22T07:45:33.652295Z DEBUG amdfand::service: Speed should not change apr 22 09:45:39 x11sslf amdfand[1516980]: 2023-04-22T07:45:39.652421Z DEBUG amdfand::service: { gpu_temp: 37.00, gpu_usage: 0.00, temp_fan_speed: 16.00, usage_fan_speed: 0.00, value: 16.00 } apr 22 09:45:39 x11sslf amdfand[1516980]: 2023-04-22T07:45:39.652451Z DEBUG amdfand::service: Changing speed to 16.00 apr 22 09:45:45 x11sslf amdfand[1516980]: 2023-04-22T07:45:45.652703Z DEBUG amdfand::service: { gpu_temp: 37.00, gpu_usage: 0.00, temp_fan_speed: 16.00, usage_fan_speed: 0.00, value: 16.00 } apr 22 09:45:45 x11sslf amdfand[1516980]: 2023-04-22T07:45:45.652718Z DEBUG amdfand::service: Speed should not change apr 22 09:45:51 x11sslf amdfand[1516980]: 2023-04-22T07:45:51.652852Z DEBUG amdfand::service: { gpu_temp: 39.00, gpu_usage: 0.00, temp_fan_speed: 22.00, usage_fan_speed: 0.00, value: 22.00 } apr 22 09:45:51 x11sslf amdfand[1516980]: 2023-04-22T07:45:51.652867Z DEBUG amdfand::service: Changing speed to 22.00 apr 22 09:45:57 x11sslf amdfand[1516980]: 2023-04-22T07:45:57.653047Z DEBUG amdfand::service: { gpu_temp: 38.00, gpu_usage: 0.00, temp_fan_speed: 19.00, usage_fan_speed: 0.00, value: 19.00 } apr 22 09:45:57 x11sslf amdfand[1516980]: 2023-04-22T07:45:57.653061Z DEBUG amdfand::service: Changing speed to 19.00 apr 22 09:46:03 x11sslf amdfand[1516980]: 2023-04-22T07:46:03.653342Z DEBUG amdfand::service: { gpu_temp: 37.00, gpu_usage: 1.00, temp_fan_speed: 16.00, usage_fan_speed: 1.00, value: 16.00 } apr 22 09:46:03 x11sslf amdfand[1516980]: 2023-04-22T07:46:03.653355Z DEBUG amdfand::service: Changing speed to 16.00 apr 22 09:46:09 x11sslf amdfand[1516980]: 2023-04-22T07:46:09.653518Z DEBUG amdfand::service: { gpu_temp: 38.00, gpu_usage: 0.00, temp_fan_speed: 19.00, usage_fan_speed: 0.00, value: 19.00 } apr 22 09:46:09 x11sslf amdfand[1516980]: 2023-04-22T07:46:09.653531Z DEBUG amdfand::service: Changing speed to 19.00 apr 22 09:46:15 x11sslf amdfand[1516980]: 2023-04-22T07:46:15.653777Z DEBUG amdfand::service: { gpu_temp: 39.00, gpu_usage: 0.00, temp_fan_speed: 22.00, usage_fan_speed: 0.00, value: 22.00 } apr 22 09:46:15 x11sslf amdfand[1516980]: 2023-04-22T07:46:15.653789Z DEBUG amdfand::service: Changing speed to 22.00 apr 22 09:46:21 x11sslf amdfand[1516980]: 2023-04-22T07:46:21.654075Z DEBUG amdfand::service: { gpu_temp: 39.00, gpu_usage: 0.00, temp_fan_speed: 22.00, usage_fan_speed: 0.00, value: 22.00 } apr 22 09:46:21 x11sslf amdfand[1516980]: 2023-04-22T07:46:21.654087Z DEBUG amdfand::service: Speed should not change apr 22 09:46:27 x11sslf amdfand[1516980]: 2023-04-22T07:46:27.654211Z DEBUG amdfand::service: { gpu_temp: 39.00, gpu_usage: 1.00, temp_fan_speed: 22.00, usage_fan_speed: 1.00, value: 22.00 } apr 22 09:46:27 x11sslf amdfand[1516980]: 2023-04-22T07:46:27.654223Z DEBUG amdfand::service: Speed should not change apr 22 09:46:33 x11sslf amdfand[1516980]: 2023-04-22T07:46:33.654386Z DEBUG amdfand::service: { gpu_temp: 38.00, gpu_usage: 0.00, temp_fan_speed: 19.00, usage_fan_speed: 0.00, value: 19.00 } apr 22 09:46:33 x11sslf amdfand[1516980]: 2023-04-22T07:46:33.654402Z DEBUG amdfand::service: Changing speed to 19.00 apr 22 09:46:39 x11sslf amdfand[1516980]: 2023-04-22T07:46:39.654670Z DEBUG amdfand::service: { gpu_temp: 39.00, gpu_usage: 0.00, temp_fan_speed: 22.00, usage_fan_speed: 0.00, value: 22.00 } apr 22 09:46:39 x11sslf amdfand[1516980]: 2023-04-22T07:46:39.654683Z DEBUG amdfand::service: Changing speed to 22.00 apr 22 09:46:45 x11sslf amdfand[1516980]: 2023-04-22T07:46:45.654858Z DEBUG amdfand::service: { gpu_temp: 39.00, gpu_usage: 94.00, temp_fan_speed: 22.00, usage_fan_speed: 94.00, value: 94.00 } apr 22 09:46:45 x11sslf amdfand[1516980]: 2023-04-22T07:46:45.654873Z DEBUG amdfand::service: Changing speed to 94.00 apr 22 09:46:51 x11sslf amdfand[1516980]: 2023-04-22T07:46:51.655019Z DEBUG amdfand::service: { gpu_temp: 38.00, gpu_usage: 0.00, temp_fan_speed: 19.00, usage_fan_speed: 0.00, value: 19.00 } apr 22 09:46:51 x11sslf amdfand[1516980]: 2023-04-22T07:46:51.655035Z DEBUG amdfand::service: Changing speed to 19.00 apr 22 09:46:57 x11sslf amdfand[1516980]: 2023-04-22T07:46:57.655257Z DEBUG amdfand::service: { gpu_temp: 38.00, gpu_usage: 8.00, temp_fan_speed: 19.00, usage_fan_speed: 8.00, value: 19.00 } apr 22 09:46:57 x11sslf amdfand[1516980]: 2023-04-22T07:46:57.655271Z DEBUG amdfand::service: Speed should not change apr 22 09:47:03 x11sslf amdfand[1516980]: 2023-04-22T07:47:03.655514Z DEBUG amdfand::service: { gpu_temp: 38.00, gpu_usage: 0.00, temp_fan_speed: 19.00, usage_fan_speed: 0.00, value: 19.00 } apr 22 09:47:03 x11sslf amdfand[1516980]: 2023-04-22T07:47:03.655526Z DEBUG amdfand::service: Speed should not change apr 22 09:47:09 x11sslf amdfand[1516980]: 2023-04-22T07:47:09.655650Z DEBUG amdfand::service: { gpu_temp: 38.00, gpu_usage: 0.00, temp_fan_speed: 19.00, usage_fan_speed: 0.00, value: 19.00 } apr 22 09:47:09 x11sslf amdfand[1516980]: 2023-04-22T07:47:09.655663Z DEBUG amdfand::service: Speed should not change apr 22 09:47:15 x11sslf amdfand[1516980]: 2023-04-22T07:47:15.655911Z DEBUG amdfand::service: { gpu_temp: 38.00, gpu_usage: 0.00, temp_fan_speed: 19.00, usage_fan_speed: 0.00, value: 19.00 } apr 22 09:47:15 x11sslf amdfand[1516980]: 2023-04-22T07:47:15.655932Z DEBUG amdfand::service: Speed should not change apr 22 09:47:21 x11sslf amdfand[1516980]: 2023-04-22T07:47:21.656138Z DEBUG amdfand::service: { gpu_temp: 38.00, gpu_usage: 0.00, temp_fan_speed: 19.00, usage_fan_speed: 0.00, value: 19.00 } apr 22 09:47:21 x11sslf amdfand[1516980]: 2023-04-22T07:47:21.656153Z DEBUG amdfand::service: Speed should not change apr 22 09:47:27 x11sslf amdfand[1516980]: 2023-04-22T07:47:27.656321Z DEBUG amdfand::service: { gpu_temp: 38.00, gpu_usage: 0.00, temp_fan_speed: 19.00, usage_fan_speed: 0.00, value: 19.00 } apr 22 09:47:27 x11sslf amdfand[1516980]: 2023-04-22T07:47:27.656335Z DEBUG amdfand::service: Speed should not change apr 22 09:47:33 x11sslf amdfand[1516980]: 2023-04-22T07:47:33.656587Z DEBUG amdfand::service: { gpu_temp: 38.00, gpu_usage: 0.00, temp_fan_speed: 19.00, usage_fan_speed: 0.00, value: 19.00 } apr 22 09:47:33 x11sslf amdfand[1516980]: 2023-04-22T07:47:33.656601Z DEBUG amdfand::service: Speed should not change ```
Mapping: `/etc/amdfand/mapping.toml` ```toml temp_input = "temp1_input" log_level = "Debug" update_rate = 6000 [[temp_matrix]] temp = 0.0 speed = 0.0 [[temp_matrix]] temp = 30.0 speed = 0.0 [[temp_matrix]] temp = 35.0 speed = 10.0 [[temp_matrix]] temp = 40.0 speed = 25.0 [[temp_matrix]] temp = 50.0 speed = 35.0 [[temp_matrix]] temp = 60.0 speed = 70.0 #[[usage_matrix]] #usage = 0.0 #speed = 0.0 #[[usage_matrix]] #usage = 15.0 #speed = 5.0 #[[usage_matrix]] #usage = 30.0 #speed = 10.0 #[[usage_matrix]] #usage = 65.0 #speed = 20.0 #[[usage_matrix]] #usage = 100.0 #speed = 33.0 ```
emansom commented 1 year ago

Longer debug log. Tested with both matrixes enabled again with an additional point added to the usage matrix to equalise numbers between the matrixes to six. Same thing happens.

Debug log: ``` apr 22 11:19:38 x11sslf systemd[1]: Started AMD GPU fan daemon. apr 22 11:19:38 x11sslf amdfand[1527191]: 2023-04-22T09:19:38.673146Z DEBUG amdgpu::lock_file: Creating pid lock for path "/var/lib/amdfand/amdfand.pid" apr 22 11:19:38 x11sslf amdfand[1527191]: 2023-04-22T09:19:38.673165Z DEBUG amdgpu::lock_file: PID LOCK acquiring /var/lib/amdfand/amdfand.pid apr 22 11:19:38 x11sslf amdfand[1527191]: 2023-04-22T09:19:38.673172Z DEBUG amdgpu::lock_file: No collision detected apr 22 11:19:38 x11sslf amdfand[1527191]: 2023-04-22T09:19:38.673245Z INFO amdgpu::utils: opening hw mon for Card(0) apr 22 11:19:38 x11sslf amdfand[1527191]: 2023-04-22T09:19:38.673279Z INFO amdgpu::utils: is vendor ok? true apr 22 11:19:38 x11sslf amdfand[1527191]: 2023-04-22T09:19:38.673298Z INFO amdgpu::utils: is hwmon name ok? true apr 22 11:19:38 x11sslf amdfand[1527191]: 2023-04-22T09:19:38.673376Z DEBUG amdfand::service: { gpu_temp: 39.00, gpu_usage: 0.00, temp_fan_speed: 22.00, usage_fan_speed: 0.00, value: 22.00 } apr 22 11:19:38 x11sslf amdfand[1527191]: 2023-04-22T09:19:38.673382Z DEBUG amdfand::service: Changing speed to 22.00 apr 22 11:19:44 x11sslf amdfand[1527191]: 2023-04-22T09:19:44.673673Z DEBUG amdfand::service: { gpu_temp: 39.00, gpu_usage: 0.00, temp_fan_speed: 22.00, usage_fan_speed: 0.00, value: 22.00 } apr 22 11:19:44 x11sslf amdfand[1527191]: 2023-04-22T09:19:44.673686Z DEBUG amdfand::service: Speed should not change apr 22 11:19:50 x11sslf amdfand[1527191]: 2023-04-22T09:19:50.673825Z DEBUG amdfand::service: { gpu_temp: 39.00, gpu_usage: 0.00, temp_fan_speed: 22.00, usage_fan_speed: 0.00, value: 22.00 } apr 22 11:19:50 x11sslf amdfand[1527191]: 2023-04-22T09:19:50.673840Z DEBUG amdfand::service: Speed should not change apr 22 11:19:56 x11sslf amdfand[1527191]: 2023-04-22T09:19:56.674070Z DEBUG amdfand::service: { gpu_temp: 39.00, gpu_usage: 0.00, temp_fan_speed: 22.00, usage_fan_speed: 0.00, value: 22.00 } apr 22 11:19:56 x11sslf amdfand[1527191]: 2023-04-22T09:19:56.674082Z DEBUG amdfand::service: Speed should not change apr 22 11:20:02 x11sslf amdfand[1527191]: 2023-04-22T09:20:02.674202Z DEBUG amdfand::service: { gpu_temp: 39.00, gpu_usage: 0.00, temp_fan_speed: 22.00, usage_fan_speed: 0.00, value: 22.00 } apr 22 11:20:02 x11sslf amdfand[1527191]: 2023-04-22T09:20:02.674216Z DEBUG amdfand::service: Speed should not change apr 22 11:20:08 x11sslf amdfand[1527191]: 2023-04-22T09:20:08.674455Z DEBUG amdfand::service: { gpu_temp: 39.00, gpu_usage: 0.00, temp_fan_speed: 22.00, usage_fan_speed: 0.00, value: 22.00 } apr 22 11:20:08 x11sslf amdfand[1527191]: 2023-04-22T09:20:08.674467Z DEBUG amdfand::service: Speed should not change apr 22 11:20:14 x11sslf amdfand[1527191]: 2023-04-22T09:20:14.674617Z DEBUG amdfand::service: { gpu_temp: 39.00, gpu_usage: 0.00, temp_fan_speed: 22.00, usage_fan_speed: 0.00, value: 22.00 } apr 22 11:20:14 x11sslf amdfand[1527191]: 2023-04-22T09:20:14.674631Z DEBUG amdfand::service: Speed should not change apr 22 11:20:20 x11sslf amdfand[1527191]: 2023-04-22T09:20:20.674767Z DEBUG amdfand::service: { gpu_temp: 39.00, gpu_usage: 89.00, temp_fan_speed: 22.00, usage_fan_speed: 29.17, value: 29.17 } apr 22 11:20:20 x11sslf amdfand[1527191]: 2023-04-22T09:20:20.674780Z DEBUG amdfand::service: Changing speed to 29.17 apr 22 11:20:26 x11sslf amdfand[1527191]: 2023-04-22T09:20:26.675051Z DEBUG amdfand::service: { gpu_temp: 39.00, gpu_usage: 45.00, temp_fan_speed: 22.00, usage_fan_speed: 14.29, value: 22.00 } apr 22 11:20:26 x11sslf amdfand[1527191]: 2023-04-22T09:20:26.675064Z DEBUG amdfand::service: Changing speed to 22.00 apr 22 11:20:32 x11sslf amdfand[1527191]: 2023-04-22T09:20:32.675303Z DEBUG amdfand::service: { gpu_temp: 39.00, gpu_usage: 0.00, temp_fan_speed: 22.00, usage_fan_speed: 0.00, value: 22.00 } apr 22 11:20:32 x11sslf amdfand[1527191]: 2023-04-22T09:20:32.675315Z DEBUG amdfand::service: Speed should not change apr 22 11:20:38 x11sslf amdfand[1527191]: 2023-04-22T09:20:38.675446Z DEBUG amdfand::service: { gpu_temp: 40.00, gpu_usage: 0.00, temp_fan_speed: 25.00, usage_fan_speed: 0.00, value: 25.00 } apr 22 11:20:38 x11sslf amdfand[1527191]: 2023-04-22T09:20:38.675459Z DEBUG amdfand::service: Changing speed to 25.00 apr 22 11:20:44 x11sslf amdfand[1527191]: 2023-04-22T09:20:44.675689Z DEBUG amdfand::service: { gpu_temp: 40.00, gpu_usage: 100.00, temp_fan_speed: 25.00, usage_fan_speed: 100.00, value: 100.00 } apr 22 11:20:44 x11sslf amdfand[1527191]: 2023-04-22T09:20:44.675700Z DEBUG amdfand::service: Changing speed to 100.00 apr 22 11:20:50 x11sslf amdfand[1527191]: 2023-04-22T09:20:50.675863Z DEBUG amdfand::service: { gpu_temp: 40.00, gpu_usage: 87.00, temp_fan_speed: 25.00, usage_fan_speed: 28.48, value: 28.48 } apr 22 11:20:50 x11sslf amdfand[1527191]: 2023-04-22T09:20:50.675875Z DEBUG amdfand::service: Changing speed to 28.48 apr 22 11:20:56 x11sslf amdfand[1527191]: 2023-04-22T09:20:56.676079Z DEBUG amdfand::service: { gpu_temp: 44.00, gpu_usage: 100.00, temp_fan_speed: 29.00, usage_fan_speed: 100.00, value: 100.00 } apr 22 11:20:56 x11sslf amdfand[1527191]: 2023-04-22T09:20:56.676091Z DEBUG amdfand::service: Changing speed to 100.00 apr 22 11:21:02 x11sslf amdfand[1527191]: 2023-04-22T09:21:02.676254Z DEBUG amdfand::service: { gpu_temp: 45.00, gpu_usage: 100.00, temp_fan_speed: 30.00, usage_fan_speed: 100.00, value: 100.00 } apr 22 11:21:02 x11sslf amdfand[1527191]: 2023-04-22T09:21:02.676266Z DEBUG amdfand::service: Speed should not change apr 22 11:21:08 x11sslf amdfand[1527191]: 2023-04-22T09:21:08.676392Z DEBUG amdfand::service: { gpu_temp: 45.00, gpu_usage: 86.00, temp_fan_speed: 30.00, usage_fan_speed: 28.13, value: 30.00 } apr 22 11:21:08 x11sslf amdfand[1527191]: 2023-04-22T09:21:08.676406Z DEBUG amdfand::service: Changing speed to 30.00 apr 22 11:21:14 x11sslf amdfand[1527191]: 2023-04-22T09:21:14.676570Z DEBUG amdfand::service: { gpu_temp: 45.00, gpu_usage: 100.00, temp_fan_speed: 30.00, usage_fan_speed: 100.00, value: 100.00 } apr 22 11:21:14 x11sslf amdfand[1527191]: 2023-04-22T09:21:14.676582Z DEBUG amdfand::service: Changing speed to 100.00 apr 22 11:21:20 x11sslf amdfand[1527191]: 2023-04-22T09:21:20.676737Z DEBUG amdfand::service: { gpu_temp: 45.00, gpu_usage: 100.00, temp_fan_speed: 30.00, usage_fan_speed: 100.00, value: 100.00 } apr 22 11:21:20 x11sslf amdfand[1527191]: 2023-04-22T09:21:20.676750Z DEBUG amdfand::service: Speed should not change apr 22 11:21:26 x11sslf amdfand[1527191]: 2023-04-22T09:21:26.676876Z DEBUG amdfand::service: { gpu_temp: 45.00, gpu_usage: 100.00, temp_fan_speed: 30.00, usage_fan_speed: 100.00, value: 100.00 } apr 22 11:21:26 x11sslf amdfand[1527191]: 2023-04-22T09:21:26.676904Z DEBUG amdfand::service: Speed should not change apr 22 11:21:32 x11sslf amdfand[1527191]: 2023-04-22T09:21:32.677098Z DEBUG amdfand::service: { gpu_temp: 45.00, gpu_usage: 0.00, temp_fan_speed: 30.00, usage_fan_speed: 0.00, value: 30.00 } apr 22 11:21:32 x11sslf amdfand[1527191]: 2023-04-22T09:21:32.677112Z DEBUG amdfand::service: Changing speed to 30.00 apr 22 11:21:38 x11sslf amdfand[1527191]: 2023-04-22T09:21:38.677276Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 100.00, temp_fan_speed: 31.00, usage_fan_speed: 100.00, value: 100.00 } apr 22 11:21:38 x11sslf amdfand[1527191]: 2023-04-22T09:21:38.677287Z DEBUG amdfand::service: Changing speed to 100.00 apr 22 11:21:44 x11sslf amdfand[1527191]: 2023-04-22T09:21:44.677657Z DEBUG amdfand::service: { gpu_temp: 45.00, gpu_usage: 100.00, temp_fan_speed: 30.00, usage_fan_speed: 100.00, value: 100.00 } apr 22 11:21:44 x11sslf amdfand[1527191]: 2023-04-22T09:21:44.677670Z DEBUG amdfand::service: Speed should not change apr 22 11:21:50 x11sslf amdfand[1527191]: 2023-04-22T09:21:50.677796Z DEBUG amdfand::service: { gpu_temp: 45.00, gpu_usage: 99.00, temp_fan_speed: 30.00, usage_fan_speed: 32.65, value: 32.65 } apr 22 11:21:50 x11sslf amdfand[1527191]: 2023-04-22T09:21:50.677814Z DEBUG amdfand::service: Changing speed to 32.65 apr 22 11:21:56 x11sslf amdfand[1527191]: 2023-04-22T09:21:56.678312Z DEBUG amdfand::service: { gpu_temp: 45.00, gpu_usage: 97.00, temp_fan_speed: 30.00, usage_fan_speed: 31.96, value: 31.96 } apr 22 11:21:56 x11sslf amdfand[1527191]: 2023-04-22T09:21:56.678324Z DEBUG amdfand::service: Changing speed to 31.96 apr 22 11:22:02 x11sslf amdfand[1527191]: 2023-04-22T09:22:02.678479Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 100.00, temp_fan_speed: 31.00, usage_fan_speed: 100.00, value: 100.00 } apr 22 11:22:02 x11sslf amdfand[1527191]: 2023-04-22T09:22:02.678492Z DEBUG amdfand::service: Changing speed to 100.00 apr 22 11:22:08 x11sslf amdfand[1527191]: 2023-04-22T09:22:08.678661Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 100.00, temp_fan_speed: 31.00, usage_fan_speed: 100.00, value: 100.00 } apr 22 11:22:08 x11sslf amdfand[1527191]: 2023-04-22T09:22:08.678675Z DEBUG amdfand::service: Speed should not change apr 22 11:22:14 x11sslf amdfand[1527191]: 2023-04-22T09:22:14.678797Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 11.00, temp_fan_speed: 31.00, usage_fan_speed: 3.67, value: 31.00 } apr 22 11:22:14 x11sslf amdfand[1527191]: 2023-04-22T09:22:14.678813Z DEBUG amdfand::service: Changing speed to 31.00 apr 22 11:22:20 x11sslf amdfand[1527191]: 2023-04-22T09:22:20.678981Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 90.00, temp_fan_speed: 31.00, usage_fan_speed: 29.52, value: 31.00 } apr 22 11:22:20 x11sslf amdfand[1527191]: 2023-04-22T09:22:20.678994Z DEBUG amdfand::service: Speed should not change apr 22 11:22:26 x11sslf amdfand[1527191]: 2023-04-22T09:22:26.679124Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 100.00, temp_fan_speed: 31.00, usage_fan_speed: 100.00, value: 100.00 } apr 22 11:22:26 x11sslf amdfand[1527191]: 2023-04-22T09:22:26.679143Z DEBUG amdfand::service: Changing speed to 100.00 apr 22 11:22:32 x11sslf amdfand[1527191]: 2023-04-22T09:22:32.679312Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 100.00, temp_fan_speed: 31.00, usage_fan_speed: 100.00, value: 100.00 } apr 22 11:22:32 x11sslf amdfand[1527191]: 2023-04-22T09:22:32.679326Z DEBUG amdfand::service: Speed should not change apr 22 11:22:38 x11sslf amdfand[1527191]: 2023-04-22T09:22:38.679444Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 1.00, temp_fan_speed: 31.00, usage_fan_speed: 0.33, value: 31.00 } apr 22 11:22:38 x11sslf amdfand[1527191]: 2023-04-22T09:22:38.679456Z DEBUG amdfand::service: Changing speed to 31.00 apr 22 11:22:44 x11sslf amdfand[1527191]: 2023-04-22T09:22:44.679665Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 96.00, temp_fan_speed: 31.00, usage_fan_speed: 31.61, value: 31.61 } apr 22 11:22:44 x11sslf amdfand[1527191]: 2023-04-22T09:22:44.679678Z DEBUG amdfand::service: Changing speed to 31.61 apr 22 11:22:50 x11sslf amdfand[1527191]: 2023-04-22T09:22:50.679963Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 100.00, temp_fan_speed: 31.00, usage_fan_speed: 100.00, value: 100.00 } apr 22 11:22:50 x11sslf amdfand[1527191]: 2023-04-22T09:22:50.679991Z DEBUG amdfand::service: Changing speed to 100.00 apr 22 11:22:56 x11sslf amdfand[1527191]: 2023-04-22T09:22:56.680188Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 94.00, temp_fan_speed: 31.00, usage_fan_speed: 30.91, value: 31.00 } apr 22 11:22:56 x11sslf amdfand[1527191]: 2023-04-22T09:22:56.680201Z DEBUG amdfand::service: Changing speed to 31.00 apr 22 11:23:02 x11sslf amdfand[1527191]: 2023-04-22T09:23:02.680362Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 98.00, temp_fan_speed: 31.00, usage_fan_speed: 32.30, value: 32.30 } apr 22 11:23:02 x11sslf amdfand[1527191]: 2023-04-22T09:23:02.680373Z DEBUG amdfand::service: Changing speed to 32.30 apr 22 11:23:08 x11sslf amdfand[1527191]: 2023-04-22T09:23:08.680558Z DEBUG amdfand::service: { gpu_temp: 47.00, gpu_usage: 100.00, temp_fan_speed: 32.00, usage_fan_speed: 100.00, value: 100.00 } apr 22 11:23:08 x11sslf amdfand[1527191]: 2023-04-22T09:23:08.680574Z DEBUG amdfand::service: Changing speed to 100.00 apr 22 11:23:14 x11sslf amdfand[1527191]: 2023-04-22T09:23:14.680758Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 100.00, temp_fan_speed: 31.00, usage_fan_speed: 100.00, value: 100.00 } apr 22 11:23:14 x11sslf amdfand[1527191]: 2023-04-22T09:23:14.680771Z DEBUG amdfand::service: Speed should not change apr 22 11:23:20 x11sslf amdfand[1527191]: 2023-04-22T09:23:20.680901Z DEBUG amdfand::service: { gpu_temp: 47.00, gpu_usage: 22.00, temp_fan_speed: 32.00, usage_fan_speed: 7.33, value: 32.00 } apr 22 11:23:20 x11sslf amdfand[1527191]: 2023-04-22T09:23:20.680914Z DEBUG amdfand::service: Changing speed to 32.00 apr 22 11:23:26 x11sslf amdfand[1527191]: 2023-04-22T09:23:26.681118Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 100.00, temp_fan_speed: 31.00, usage_fan_speed: 100.00, value: 100.00 } apr 22 11:23:26 x11sslf amdfand[1527191]: 2023-04-22T09:23:26.681131Z DEBUG amdfand::service: Changing speed to 100.00 apr 22 11:23:32 x11sslf amdfand[1527191]: 2023-04-22T09:23:32.681312Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 100.00, temp_fan_speed: 31.00, usage_fan_speed: 100.00, value: 100.00 } apr 22 11:23:32 x11sslf amdfand[1527191]: 2023-04-22T09:23:32.681325Z DEBUG amdfand::service: Speed should not change apr 22 11:23:38 x11sslf amdfand[1527191]: 2023-04-22T09:23:38.681463Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 99.00, temp_fan_speed: 31.00, usage_fan_speed: 32.65, value: 32.65 } apr 22 11:23:38 x11sslf amdfand[1527191]: 2023-04-22T09:23:38.681479Z DEBUG amdfand::service: Changing speed to 32.65 apr 22 11:23:44 x11sslf amdfand[1527191]: 2023-04-22T09:23:44.681677Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 99.00, temp_fan_speed: 31.00, usage_fan_speed: 32.65, value: 32.65 } apr 22 11:23:44 x11sslf amdfand[1527191]: 2023-04-22T09:23:44.681690Z DEBUG amdfand::service: Speed should not change apr 22 11:23:50 x11sslf amdfand[1527191]: 2023-04-22T09:23:50.681850Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 1.00, temp_fan_speed: 31.00, usage_fan_speed: 0.33, value: 31.00 } apr 22 11:23:50 x11sslf amdfand[1527191]: 2023-04-22T09:23:50.681863Z DEBUG amdfand::service: Changing speed to 31.00 apr 22 11:23:56 x11sslf amdfand[1527191]: 2023-04-22T09:23:56.682068Z DEBUG amdfand::service: { gpu_temp: 41.00, gpu_usage: 90.00, temp_fan_speed: 26.00, usage_fan_speed: 29.52, value: 29.52 } apr 22 11:23:56 x11sslf amdfand[1527191]: 2023-04-22T09:23:56.682082Z DEBUG amdfand::service: Changing speed to 29.52 apr 22 11:24:02 x11sslf amdfand[1527191]: 2023-04-22T09:24:02.682487Z DEBUG amdfand::service: { gpu_temp: 40.00, gpu_usage: 0.00, temp_fan_speed: 25.00, usage_fan_speed: 0.00, value: 25.00 } apr 22 11:24:02 x11sslf amdfand[1527191]: 2023-04-22T09:24:02.682502Z DEBUG amdfand::service: Changing speed to 25.00 apr 22 11:24:08 x11sslf amdfand[1527191]: 2023-04-22T09:24:08.682705Z DEBUG amdfand::service: { gpu_temp: 40.00, gpu_usage: 0.00, temp_fan_speed: 25.00, usage_fan_speed: 0.00, value: 25.00 } apr 22 11:24:08 x11sslf amdfand[1527191]: 2023-04-22T09:24:08.682718Z DEBUG amdfand::service: Speed should not change ```
Mapping: `/etc/amdfand/mapping.toml` ```toml temp_input = "temp1_input" log_level = "Debug" update_rate = 6000 [[temp_matrix]] temp = 0.0 speed = 0.0 [[temp_matrix]] temp = 30.0 speed = 0.0 [[temp_matrix]] temp = 35.0 speed = 10.0 [[temp_matrix]] temp = 40.0 speed = 25.0 [[temp_matrix]] temp = 50.0 speed = 35.0 [[temp_matrix]] temp = 60.0 speed = 70.0 [[usage_matrix]] usage = 0.0 speed = 0.0 [[usage_matrix]] usage = 15.0 speed = 5.0 [[usage_matrix]] usage = 30.0 speed = 10.0 [[usage_matrix]] usage = 65.0 speed = 20.0 [[usage_matrix]] usage = 77.0 speed = 25.0 [[usage_matrix]] usage = 100.0 speed = 33.0 ```
Eraden commented 1 year ago

I'm currently stuck with my day-to-day job. I'll try to improve this implementation ASAP but I can't promise anything now

emansom commented 1 year ago

As git diff:

diff --git a/crates/amdgpu-config/src/fan.rs b/crates/amdgpu-config/src/fan.rs
index 41573c9..ed7c22d 100644
--- a/crates/amdgpu-config/src/fan.rs
+++ b/crates/amdgpu-config/src/fan.rs
@@ -108,11 +108,11 @@ impl Config {
     pub fn fan_speed_for_temp(&self, temp: f64) -> f64 {
         let idx = match self.temp_matrix.iter().rposition(|p| p.temp <= temp) {
             Some(idx) => idx,
-            _ => return self.min_speed(),
+            _ => return self.min_speed_for_temp(),
         };

         if idx == self.temp_matrix.len() - 1 {
-            return self.max_speed();
+            return self.max_speed_for_temp();
         }

         linear_map(
@@ -125,12 +125,13 @@ impl Config {
     }

     pub fn fan_speed_for_usage(&self, usage: f64) -> f64 {
-        let Some(idx) = self.usage_matrix.iter().rposition(|p| p.usage <= usage) else {
-            return 0.0;
+        let idx = match self.usage_matrix.iter().rposition(|p| p.usage <= usage) {
+            Some(idx) => idx,
+            _ => return self.min_speed_for_usage(),
         };

         if idx == self.usage_matrix.len() - 1 {
-            return 100.0;
+            return self.max_speed_for_usage();
         }

         linear_map(
@@ -158,14 +159,22 @@ impl Config {
         self.update_rate
     }

-    fn min_speed(&self) -> f64 {
+    fn min_speed_for_temp(&self) -> f64 {
         self.temp_matrix.first().map(|p| p.speed).unwrap_or(0f64)
     }

-    fn max_speed(&self) -> f64 {
+    fn max_speed_for_temp(&self) -> f64 {
         self.temp_matrix.last().map(|p| p.speed).unwrap_or(100f64)
     }

+    fn min_speed_for_usage(&self) -> f64 {
+        self.usage_matrix.first().map(|p| p.speed).unwrap_or(0f64)
+    }
+
+    fn max_speed_for_usage(&self) -> f64 {
+        self.usage_matrix.last().map(|p| p.speed).unwrap_or(100f64)
+    }
+
     fn default_refresh_delay() -> u64 {
         4000
     }
emansom commented 1 year ago

Debug log and mapping with the local changes suggested above. It now works as expected, ramping up as defined within the mapping:

Debug log: Debug log with the local code changes above applied: ```shell ➜ ~ journalctl -f -u amdfand.service apr 29 15:38:04 x11sslf amdfand[43962]: 2023-04-29T13:38:04.228569Z DEBUG amdgpu::lock_file: No collision detected apr 29 15:38:04 x11sslf amdfand[43962]: 2023-04-29T13:38:04.244436Z INFO amdgpu::utils: opening hw mon for Card(0) apr 29 15:38:04 x11sslf amdfand[43962]: 2023-04-29T13:38:04.244483Z INFO amdgpu::utils: is vendor ok? true apr 29 15:38:04 x11sslf amdfand[43962]: 2023-04-29T13:38:04.244503Z INFO amdgpu::utils: is hwmon name ok? true apr 29 15:38:04 x11sslf amdfand[43962]: 2023-04-29T13:38:04.244584Z DEBUG amdfand::service: { gpu_temp: 35.00, gpu_usage: 0.00, temp_fan_speed: 10.00, usage_fan_speed: 0.00, value: 10.00 } apr 29 15:38:04 x11sslf amdfand[43962]: 2023-04-29T13:38:04.244592Z DEBUG amdfand::service: Changing speed to 10.00 apr 29 15:38:10 x11sslf amdfand[43962]: 2023-04-29T13:38:10.245012Z DEBUG amdfand::service: { gpu_temp: 35.00, gpu_usage: 0.00, temp_fan_speed: 10.00, usage_fan_speed: 0.00, value: 10.00 } apr 29 15:38:10 x11sslf amdfand[43962]: 2023-04-29T13:38:10.245028Z DEBUG amdfand::service: Speed should not change apr 29 15:38:16 x11sslf amdfand[43962]: 2023-04-29T13:38:16.245459Z DEBUG amdfand::service: { gpu_temp: 36.00, gpu_usage: 0.00, temp_fan_speed: 13.00, usage_fan_speed: 0.00, value: 13.00 } apr 29 15:38:16 x11sslf amdfand[43962]: 2023-04-29T13:38:16.245475Z DEBUG amdfand::service: Changing speed to 13.00 apr 29 15:38:22 x11sslf amdfand[43962]: 2023-04-29T13:38:22.245934Z DEBUG amdfand::service: { gpu_temp: 35.00, gpu_usage: 0.00, temp_fan_speed: 10.00, usage_fan_speed: 0.00, value: 10.00 } apr 29 15:38:22 x11sslf amdfand[43962]: 2023-04-29T13:38:22.245949Z DEBUG amdfand::service: Changing speed to 10.00 apr 29 15:38:28 x11sslf amdfand[43962]: 2023-04-29T13:38:28.246263Z DEBUG amdfand::service: { gpu_temp: 37.00, gpu_usage: 0.00, temp_fan_speed: 16.00, usage_fan_speed: 0.00, value: 16.00 } apr 29 15:38:28 x11sslf amdfand[43962]: 2023-04-29T13:38:28.246278Z DEBUG amdfand::service: Changing speed to 16.00 apr 29 15:38:34 x11sslf amdfand[43962]: 2023-04-29T13:38:34.246452Z DEBUG amdfand::service: { gpu_temp: 37.00, gpu_usage: 1.00, temp_fan_speed: 16.00, usage_fan_speed: 0.33, value: 16.00 } apr 29 15:38:34 x11sslf amdfand[43962]: 2023-04-29T13:38:34.246496Z DEBUG amdfand::service: Speed should not change apr 29 15:38:40 x11sslf amdfand[43962]: 2023-04-29T13:38:40.246632Z DEBUG amdfand::service: { gpu_temp: 37.00, gpu_usage: 10.00, temp_fan_speed: 16.00, usage_fan_speed: 3.33, value: 16.00 } apr 29 15:38:40 x11sslf amdfand[43962]: 2023-04-29T13:38:40.246644Z DEBUG amdfand::service: Speed should not change apr 29 15:38:46 x11sslf amdfand[43962]: 2023-04-29T13:38:46.246786Z DEBUG amdfand::service: { gpu_temp: 37.00, gpu_usage: 83.00, temp_fan_speed: 16.00, usage_fan_speed: 27.09, value: 27.09 } apr 29 15:38:46 x11sslf amdfand[43962]: 2023-04-29T13:38:46.246814Z DEBUG amdfand::service: Changing speed to 27.09 apr 29 15:38:52 x11sslf amdfand[43962]: 2023-04-29T13:38:52.246990Z DEBUG amdfand::service: { gpu_temp: 37.00, gpu_usage: 38.00, temp_fan_speed: 16.00, usage_fan_speed: 12.29, value: 16.00 } apr 29 15:38:52 x11sslf amdfand[43962]: 2023-04-29T13:38:52.247002Z DEBUG amdfand::service: Changing speed to 16.00 apr 29 15:38:58 x11sslf amdfand[43962]: 2023-04-29T13:38:58.247245Z DEBUG amdfand::service: { gpu_temp: 37.00, gpu_usage: 0.00, temp_fan_speed: 16.00, usage_fan_speed: 0.00, value: 16.00 } apr 29 15:38:58 x11sslf amdfand[43962]: 2023-04-29T13:38:58.247258Z DEBUG amdfand::service: Speed should not change apr 29 15:39:04 x11sslf amdfand[43962]: 2023-04-29T13:39:04.247379Z DEBUG amdfand::service: { gpu_temp: 37.00, gpu_usage: 6.00, temp_fan_speed: 16.00, usage_fan_speed: 2.00, value: 16.00 } apr 29 15:39:04 x11sslf amdfand[43962]: 2023-04-29T13:39:04.247391Z DEBUG amdfand::service: Speed should not change apr 29 15:39:10 x11sslf amdfand[43962]: 2023-04-29T13:39:10.247627Z DEBUG amdfand::service: { gpu_temp: 37.00, gpu_usage: 0.00, temp_fan_speed: 16.00, usage_fan_speed: 0.00, value: 16.00 } apr 29 15:39:10 x11sslf amdfand[43962]: 2023-04-29T13:39:10.247640Z DEBUG amdfand::service: Speed should not change apr 29 15:39:16 x11sslf amdfand[43962]: 2023-04-29T13:39:16.247764Z DEBUG amdfand::service: { gpu_temp: 37.00, gpu_usage: 90.00, temp_fan_speed: 16.00, usage_fan_speed: 29.52, value: 29.52 } apr 29 15:39:16 x11sslf amdfand[43962]: 2023-04-29T13:39:16.247778Z DEBUG amdfand::service: Changing speed to 29.52 apr 29 15:39:22 x11sslf amdfand[43962]: 2023-04-29T13:39:22.247965Z DEBUG amdfand::service: { gpu_temp: 37.00, gpu_usage: 8.00, temp_fan_speed: 16.00, usage_fan_speed: 2.67, value: 16.00 } apr 29 15:39:22 x11sslf amdfand[43962]: 2023-04-29T13:39:22.247977Z DEBUG amdfand::service: Changing speed to 16.00 apr 29 15:39:28 x11sslf amdfand[43962]: 2023-04-29T13:39:28.248226Z DEBUG amdfand::service: { gpu_temp: 37.00, gpu_usage: 2.00, temp_fan_speed: 16.00, usage_fan_speed: 0.67, value: 16.00 } apr 29 15:39:28 x11sslf amdfand[43962]: 2023-04-29T13:39:28.248239Z DEBUG amdfand::service: Speed should not change apr 29 15:39:34 x11sslf amdfand[43962]: 2023-04-29T13:39:34.248420Z DEBUG amdfand::service: { gpu_temp: 42.00, gpu_usage: 100.00, temp_fan_speed: 27.00, usage_fan_speed: 33.00, value: 33.00 } apr 29 15:39:34 x11sslf amdfand[43962]: 2023-04-29T13:39:34.248432Z DEBUG amdfand::service: Changing speed to 33.00 apr 29 15:39:40 x11sslf amdfand[43962]: 2023-04-29T13:39:40.248607Z DEBUG amdfand::service: { gpu_temp: 43.00, gpu_usage: 82.00, temp_fan_speed: 28.00, usage_fan_speed: 26.74, value: 28.00 } apr 29 15:39:40 x11sslf amdfand[43962]: 2023-04-29T13:39:40.248624Z DEBUG amdfand::service: Changing speed to 28.00 apr 29 15:39:46 x11sslf amdfand[43962]: 2023-04-29T13:39:46.248833Z DEBUG amdfand::service: { gpu_temp: 44.00, gpu_usage: 100.00, temp_fan_speed: 29.00, usage_fan_speed: 33.00, value: 33.00 } apr 29 15:39:46 x11sslf amdfand[43962]: 2023-04-29T13:39:46.248848Z DEBUG amdfand::service: Changing speed to 33.00 apr 29 15:39:52 x11sslf amdfand[43962]: 2023-04-29T13:39:52.249026Z DEBUG amdfand::service: { gpu_temp: 44.00, gpu_usage: 100.00, temp_fan_speed: 29.00, usage_fan_speed: 33.00, value: 33.00 } apr 29 15:39:52 x11sslf amdfand[43962]: 2023-04-29T13:39:52.249038Z DEBUG amdfand::service: Speed should not change apr 29 15:39:58 x11sslf amdfand[43962]: 2023-04-29T13:39:58.249157Z DEBUG amdfand::service: { gpu_temp: 44.00, gpu_usage: 100.00, temp_fan_speed: 29.00, usage_fan_speed: 33.00, value: 33.00 } apr 29 15:39:58 x11sslf amdfand[43962]: 2023-04-29T13:39:58.249170Z DEBUG amdfand::service: Speed should not change apr 29 15:40:04 x11sslf amdfand[43962]: 2023-04-29T13:40:04.249293Z DEBUG amdfand::service: { gpu_temp: 44.00, gpu_usage: 88.00, temp_fan_speed: 29.00, usage_fan_speed: 28.83, value: 29.00 } apr 29 15:40:04 x11sslf amdfand[43962]: 2023-04-29T13:40:04.249305Z DEBUG amdfand::service: Changing speed to 29.00 apr 29 15:40:10 x11sslf amdfand[43962]: 2023-04-29T13:40:10.249502Z DEBUG amdfand::service: { gpu_temp: 45.00, gpu_usage: 100.00, temp_fan_speed: 30.00, usage_fan_speed: 33.00, value: 33.00 } apr 29 15:40:10 x11sslf amdfand[43962]: 2023-04-29T13:40:10.249514Z DEBUG amdfand::service: Changing speed to 33.00 apr 29 15:40:16 x11sslf amdfand[43962]: 2023-04-29T13:40:16.249867Z DEBUG amdfand::service: { gpu_temp: 45.00, gpu_usage: 27.00, temp_fan_speed: 30.00, usage_fan_speed: 9.00, value: 30.00 } apr 29 15:40:16 x11sslf amdfand[43962]: 2023-04-29T13:40:16.249879Z DEBUG amdfand::service: Changing speed to 30.00 apr 29 15:40:22 x11sslf amdfand[43962]: 2023-04-29T13:40:22.250031Z DEBUG amdfand::service: { gpu_temp: 45.00, gpu_usage: 100.00, temp_fan_speed: 30.00, usage_fan_speed: 33.00, value: 33.00 } apr 29 15:40:22 x11sslf amdfand[43962]: 2023-04-29T13:40:22.250043Z DEBUG amdfand::service: Changing speed to 33.00 apr 29 15:40:28 x11sslf amdfand[43962]: 2023-04-29T13:40:28.250212Z DEBUG amdfand::service: { gpu_temp: 45.00, gpu_usage: 66.00, temp_fan_speed: 30.00, usage_fan_speed: 20.42, value: 30.00 } apr 29 15:40:28 x11sslf amdfand[43962]: 2023-04-29T13:40:28.250237Z DEBUG amdfand::service: Changing speed to 30.00 apr 29 15:40:34 x11sslf amdfand[43962]: 2023-04-29T13:40:34.250467Z DEBUG amdfand::service: { gpu_temp: 45.00, gpu_usage: 96.00, temp_fan_speed: 30.00, usage_fan_speed: 31.61, value: 31.61 } apr 29 15:40:34 x11sslf amdfand[43962]: 2023-04-29T13:40:34.250492Z DEBUG amdfand::service: Changing speed to 31.61 apr 29 15:40:40 x11sslf amdfand[43962]: 2023-04-29T13:40:40.250642Z DEBUG amdfand::service: { gpu_temp: 45.00, gpu_usage: 100.00, temp_fan_speed: 30.00, usage_fan_speed: 33.00, value: 33.00 } apr 29 15:40:40 x11sslf amdfand[43962]: 2023-04-29T13:40:40.250654Z DEBUG amdfand::service: Changing speed to 33.00 apr 29 15:40:46 x11sslf amdfand[43962]: 2023-04-29T13:40:46.250793Z DEBUG amdfand::service: { gpu_temp: 45.00, gpu_usage: 100.00, temp_fan_speed: 30.00, usage_fan_speed: 33.00, value: 33.00 } apr 29 15:40:46 x11sslf amdfand[43962]: 2023-04-29T13:40:46.250805Z DEBUG amdfand::service: Speed should not change apr 29 15:40:52 x11sslf amdfand[43962]: 2023-04-29T13:40:52.250939Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 50.00, temp_fan_speed: 31.00, usage_fan_speed: 15.71, value: 31.00 } apr 29 15:40:52 x11sslf amdfand[43962]: 2023-04-29T13:40:52.250951Z DEBUG amdfand::service: Changing speed to 31.00 apr 29 15:40:58 x11sslf amdfand[43962]: 2023-04-29T13:40:58.251135Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 0.00, temp_fan_speed: 31.00, usage_fan_speed: 0.00, value: 31.00 } apr 29 15:40:58 x11sslf amdfand[43962]: 2023-04-29T13:40:58.251149Z DEBUG amdfand::service: Speed should not change apr 29 15:41:04 x11sslf amdfand[43962]: 2023-04-29T13:41:04.251278Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 100.00, temp_fan_speed: 31.00, usage_fan_speed: 33.00, value: 33.00 } apr 29 15:41:04 x11sslf amdfand[43962]: 2023-04-29T13:41:04.251295Z DEBUG amdfand::service: Changing speed to 33.00 apr 29 15:41:10 x11sslf amdfand[43962]: 2023-04-29T13:41:10.251484Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 100.00, temp_fan_speed: 31.00, usage_fan_speed: 33.00, value: 33.00 } apr 29 15:41:10 x11sslf amdfand[43962]: 2023-04-29T13:41:10.251499Z DEBUG amdfand::service: Speed should not change apr 29 15:41:16 x11sslf amdfand[43962]: 2023-04-29T13:41:16.251604Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 33.00, temp_fan_speed: 31.00, usage_fan_speed: 10.86, value: 31.00 } apr 29 15:41:16 x11sslf amdfand[43962]: 2023-04-29T13:41:16.251618Z DEBUG amdfand::service: Changing speed to 31.00 apr 29 15:41:22 x11sslf amdfand[43962]: 2023-04-29T13:41:22.251840Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 0.00, temp_fan_speed: 31.00, usage_fan_speed: 0.00, value: 31.00 } apr 29 15:41:22 x11sslf amdfand[43962]: 2023-04-29T13:41:22.251854Z DEBUG amdfand::service: Speed should not change apr 29 15:41:28 x11sslf amdfand[43962]: 2023-04-29T13:41:28.252048Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 42.00, temp_fan_speed: 31.00, usage_fan_speed: 13.43, value: 31.00 } apr 29 15:41:28 x11sslf amdfand[43962]: 2023-04-29T13:41:28.252060Z DEBUG amdfand::service: Speed should not change apr 29 15:41:34 x11sslf amdfand[43962]: 2023-04-29T13:41:34.252181Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 100.00, temp_fan_speed: 31.00, usage_fan_speed: 33.00, value: 33.00 } apr 29 15:41:34 x11sslf amdfand[43962]: 2023-04-29T13:41:34.252195Z DEBUG amdfand::service: Changing speed to 33.00 apr 29 15:41:40 x11sslf amdfand[43962]: 2023-04-29T13:41:40.252379Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 0.00, temp_fan_speed: 31.00, usage_fan_speed: 0.00, value: 31.00 } apr 29 15:41:40 x11sslf amdfand[43962]: 2023-04-29T13:41:40.252393Z DEBUG amdfand::service: Changing speed to 31.00 apr 29 15:41:46 x11sslf amdfand[43962]: 2023-04-29T13:41:46.252594Z DEBUG amdfand::service: { gpu_temp: 46.00, gpu_usage: 100.00, temp_fan_speed: 31.00, usage_fan_speed: 33.00, value: 33.00 } apr 29 15:41:46 x11sslf amdfand[43962]: 2023-04-29T13:41:46.252606Z DEBUG amdfand::service: Changing speed to 33.00 apr 29 15:41:52 x11sslf amdfand[43962]: 2023-04-29T13:41:52.252910Z DEBUG amdfand::service: { gpu_temp: 39.00, gpu_usage: 0.00, temp_fan_speed: 22.00, usage_fan_speed: 0.00, value: 22.00 } apr 29 15:41:52 x11sslf amdfand[43962]: 2023-04-29T13:41:52.252925Z DEBUG amdfand::service: Changing speed to 22.00 ```
Mapping: `/etc/amdfand/mapping.toml` ```toml temp_input = "temp1_input" log_level = "Debug" update_rate = 6000 [[temp_matrix]] temp = 0.0 speed = 0.0 [[temp_matrix]] temp = 30.0 speed = 0.0 [[temp_matrix]] temp = 35.0 speed = 10.0 [[temp_matrix]] temp = 40.0 speed = 25.0 [[temp_matrix]] temp = 50.0 speed = 35.0 [[temp_matrix]] temp = 60.0 speed = 70.0 [[usage_matrix]] usage = 0.0 speed = 0.0 [[usage_matrix]] usage = 15.0 speed = 5.0 [[usage_matrix]] usage = 30.0 speed = 10.0 [[usage_matrix]] usage = 65.0 speed = 20.0 [[usage_matrix]] usage = 77.0 speed = 25.0 [[usage_matrix]] usage = 100.0 speed = 33.0 ```
emansom commented 1 year ago

During gaming, the fans do still ramp up and down between the low and the high of the curve a little too much. As frame-to-frame the game GPU usage varies, one frame it could be 0, the next frame it could be 80.

To normalize the RPM speed adjustments more, amdfand could implement another polling thread for only the GPU usage calculation. Where it would poll more frequently (e.g. 100ms) independently of the defined update_rate.

Then during the regular tick cycle, the highest max encountered usage of that independent GPU usage poll thread would be picked.

That would lower the potential of a single frame 0% GPU usage affecting the card's RPM.