|
5 | 5 | # Configure the GPU bus address and desired fan speed below. |
6 | 6 | # |
7 | 7 |
|
| 8 | +# [nix-shell:~/nixos/desktop/l]$ rocm-smi |
| 9 | + |
| 10 | + |
| 11 | +# =========================================== ROCm System Management Interface =========================================== |
| 12 | +# ===================================================== Concise Info ===================================================== |
| 13 | +# Device Node IDs Temp Power Partitions SCLK MCLK Fan Perf PwrCap VRAM% GPU% |
| 14 | +# (DID, GUID) (Edge) (Socket) (Mem, Compute, ID) |
| 15 | +# ======================================================================================================================== |
| 16 | +# 0 2 0x66a1, 33678 35.0°C 19.0W N/A, N/A, 0 938Mhz 350Mhz 100.0% auto 225.0W 0% 0% |
| 17 | +# 1 1 0x7312, 11012 45.0°C 33.0W N/A, N/A, 0 800Mhz 900Mhz 49.41% auto 140.0W 22% 2% |
| 18 | +# ======================================================================================================================== |
| 19 | +# ================================================= End of ROCm SMI Log ================================================== |
| 20 | + |
8 | 21 | { config, lib, pkgs, ... }: |
9 | 22 |
|
10 | 23 | let |
|
15 | 28 | #44:00.0 Display controller: Advanced Micro Devices, Inc. [AMD/ATI] Vega 20 [Radeon Pro VII/Radeon Instinct MI50 32GB] |
16 | 29 | #63:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 [Radeon Pro W5700] |
17 | 30 |
|
18 | | - fanSpeedPercent = 50; # Change this to desired fan speed (0-100) |
| 31 | + fanSpeedPercent = 40; # Change this to desired fan speed (0-100) |
19 | 32 |
|
20 | 33 | # Calculate the actual PWM value based on percentage |
21 | 34 | fanSpeedPWM = builtins.toString (fanSpeedPercent * 255 / 100); |
|
50 | 63 | echo "Max PWM: $max_pwm" |
51 | 64 |
|
52 | 65 | # Calculate actual PWM value based on percentage |
53 | | - # Note: fanSpeedPercent is interpolated by Nix as a literal number, so we use it directly in Bash arithmetic |
54 | | - actual_pwm=$(( max_pwm * ${fanSpeedPercent} / 100 )) |
| 66 | + # Note: fanSpeedPercent is interpolated by Nix, so we use toString to convert the integer to string |
| 67 | + actual_pwm=$(( max_pwm * ${toString fanSpeedPercent} / 100 )) |
55 | 68 | echo "Setting PWM to $actual_pwm" |
56 | 69 | echo "$actual_pwm" > "$hwmon/pwm1" |
57 | 70 |
|
|
0 commit comments