amdgpu_fan 0.9.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c56a24ac7feceacab33c70e7a59e6126653f9a8507f468a3ea948e2372b24ec1
4
- data.tar.gz: 4c5b6634b9d805d0bcf5de22346b6865aae9d54aea515f75c25ff5476916de6b
3
+ metadata.gz: e573c19faf31038fcd246334308fe836db2156849da03c35292d967013037804
4
+ data.tar.gz: e5ddef669be7d78936d5c83543ae3b9d1bec49cfd5f0120577e848d6eadae25c
5
5
  SHA512:
6
- metadata.gz: 5fb3898d03b55097970f1cbffb1a9fe813e463564e905fa23025161aa783e73dfd9b03e0cd6842c2b69fc1552fbbd11cebcc8318a139e33d5868cc41a30023a8
7
- data.tar.gz: 6b8417efa976498f35d2fdc5eb4c8360f38a8a645c0b5b1586a5b6f190cacbb07360c2da76be56123cf49838ae483e760eeebaefe84e38d9d44eda1ba03de5ac
6
+ metadata.gz: 19cd5d20a96935b260bef4c1b22b8624675d7b9c4aeeb07a4b56efa236a6a2dfa1ccc8cc8e0413fa78e6c2e8a18b0f74e30b53f0c1494f952fabc6d1f699bb27
7
+ data.tar.gz: 490d669b59cda1f9658a635e3bcb032dc83bc76deaeec6cb9d27382d853d5826bc78213e860e9fd459e116886f36d81e60e9ca60a2ca8b4e69cf0a1b4eef4215
data/README.md CHANGED
@@ -9,28 +9,36 @@ A Ruby CLI to read and set fan speed, power profiles, and more for AMD Radeon gr
9
9
  **amdgpu_fan** aims to provide a more user friendly interface on top of [sysfs](https://en.wikipedia.org/wiki/Sysfs) for displaying statistics and interacting with AMD Radeon graphics hardware running on the [AMDgpu](https://dri.freedesktop.org/docs/drm/gpu/amdgpu.html) driver.
10
10
 
11
11
  #### Further reading
12
-
12
+ e
13
13
  - https://wiki.archlinux.org/index.php/AMDGPU#Overclocking
14
14
  - https://wiki.archlinux.org/index.php/Fan_speed_control#AMDGPU_sysfs_fan_control
15
15
  - https://phoronix.com/scan.php?page=news_item&px=AMDGPU-Quick-WattMan-Cap-Test
16
16
 
17
17
  ## Installation
18
18
 
19
- The `amdgpu_fan` CLI command can be installed from [RubyGems](https://rubygems.org/gems/amdgpu_fan) or easily run from the source code.
19
+ The `amdgpu_fan` CLI command can be installed in [Arch Linux from the AUR](https://aur.archlinux.org/packages/ruby-amdgpu_fan), from [RubyGems](https://rubygems.org/gems/amdgpu_fan), or run from the source code.
20
20
 
21
- ### From RubyGems
21
+ ### Arch User Repository
22
+
23
+ Use your favorite tool such as [`paru`](https://aur.archlinux.org/packages/paru) to install [`ruby-amdgrpu_fan`](https://aur.archlinux.org/packages/ruby-amdgpu_fan) from the AUR.
22
24
 
25
+ ```sh
26
+ paru -S ruby-amdgpu_fan
23
27
  ```
28
+
29
+ ### From RubyGems
30
+
31
+ ```sh
24
32
  gem install amdgpu_fan
25
33
  ```
26
34
 
27
35
  ### From Source
28
36
 
29
- ```
30
- git clone https://github.com/HarlemSquirrel/amdgpu-fan-rb.git
31
- cd amdgpu-fan-rb
32
- bundle install
33
- bin/amdgpu_fan
37
+ ```sh
38
+ git clone https://github.com/HarlemSquirrel/amdgpu-fan-rb.git
39
+ cd amdgpu-fan-rb
40
+ bundle install
41
+ bin/amdgpu_fan
34
42
  ```
35
43
 
36
44
  ## Usage
@@ -42,52 +50,64 @@ Commands:
42
50
  amdgpu_fan fan # View fan details.
43
51
  amdgpu_fan fan_set PERCENTAGE/AUTO # Set fan speed to percentage or automatic mode. (requires sudo)
44
52
  amdgpu_fan help [COMMAND] # Describe available commands or one specific command
53
+ amdgpu_fan power_mode_auto # Set the power profile to automatic mode.
54
+ amdgpu_fan power_mode_high # Set the performance level to low to force the clocks to the highest power state.
55
+ amdgpu_fan power_mode_low # Set the performance level to low to force the clocks to the lowest power state.
45
56
  amdgpu_fan profile # View power profile details.
46
- amdgpu_fan profile_auto # Set the power profile to automatic mode.
47
- amdgpu_fan profile_force PROFILE_NUM # Manually set a power profile. (requires sudo)
57
+ amdgpu_fan profile_force PROFILE_NUM # Set performance mode to manual and set a power profile. (requires sudo)
48
58
  amdgpu_fan status [--logo] # View device info, current fan speed, and temperature.
59
+ amdgpu_fan version # Print the application version.
49
60
  amdgpu_fan watch [SECONDS] # Watch fan speed, load, power, and temperature refreshed every n seconds.
61
+ amdgpu_fan watch_avg # Watch min, max, average, and current stats.
50
62
  amdgpu_fan watch_csv [SECONDS] # Watch stats in CSV format refreshed every n seconds defaulting to 1 second.
51
63
 
52
64
  ➤ bin/amdgpu_fan status
53
- 📺 GPU: Advanced Micro Devices, Inc. [AMD/ATI] Radeon R9 FURY X / NANO
54
- 📄 vBIOS: 113-C8800100-102
55
- Clocks: 724Mhz Core, 500Mhz Memory
56
- 💾 Memory: 4096 MiB
57
- 🌀 Fan: auto mode running at 1809 rpm (48%)
58
- 🌞 Temp: 21.0°C
59
- Power: 3D_FULL_SCREEN profile in performance mode using 16.2 / 300.0 Watts (5%)
60
- ⚖ Load: [ ]0%
65
+ 👾 GPU: Advanced Micro Devices, Inc. [AMD/ATI] NITRO+ RX 7900 XTX Vapor-X
66
+ 📄 vBIOS: 113-4E4710U-T4Y
67
+ 📺 Displays: G321CQP E2
68
+ Clocks: 67 Core, 456 Memory
69
+ 💾 Memory: 24560 MiB
70
+ 🌀 Fan: auto mode running at 0 rpm (0%)
71
+ 🧯 Temp: 46.0°C
72
+ ⚡ Power: 3D_FULL_SCREEN profile in auto mode using 35.0 / 339.0 Watts (10%)
73
+ 🚚 Load: 00% [ ]
61
74
 
62
75
  ➤ bin/amdgpu_fan watch 3
63
- Watching Advanced Micro Devices, Inc. [AMD/ATI] Radeon R9 FURY X / NANO every 3 second(s)...
76
+ Watching Advanced Micro Devices, Inc. [AMD/ATI] NITRO+ RX 7900 XTX Vapor-X every 3 second(s)...
64
77
  <Press Ctrl-C to exit>
65
- 2019-05-28 20:57:41 | Core: 724Mhz | Memory: 500Mhz | Fan: 948 rpm [* ]14% | Load: [** ]24% | Power: 16.07 W [* ]6% | Temp: 34.0°C
66
- 2019-05-28 20:57:45 | Core: 512Mhz | Memory: 500Mhz | Fan: 948 rpm [* ]14% | Load: [ ]0% | Power: 16.13 W [* ]7% | Temp: 34.0°C
67
- 2019-05-28 20:57:49 | Core: 892Mhz | Memory: 500Mhz | Fan: 948 rpm [* ]14% | Load: [ ]0% | Power: 25.22 W [* ]5% | Temp: 33.0°C
68
- 2019-05-28 20:57:53 | Core: 300Mhz | Memory: 500Mhz | Fan: 948 rpm [* ]14% | Load: [ ]0% | Power: 19.1 W [* ]6% | Temp: 33.0°C
69
- 2019-05-28 20:57:57 | Core: 1050Mhz | Memory: 500Mhz | Fan: 948 rpm [* ]14% | Load: [********* ]94% | Power: 103.04 W [*** ]31% | Temp: 36.0°C
70
- 2019-05-28 20:58:01 | Core: 1050Mhz | Memory: 500Mhz | Fan: 954 rpm [** ]15% | Load: [********* ]91% | Power: 158.07 W [***** ]53% | Temp: 38.0°C
71
- 2019-05-28 20:58:05 | Core: 1050Mhz | Memory: 500Mhz | Fan: 977 rpm [** ]16% | Load: [**********]100% | Power: 218.01 W [******* ]73% | Temp: 40.0°C
72
- 2019-05-28 20:58:09 | Core: 1050Mhz | Memory: 500Mhz | Fan: 1005 rpm [** ]16% | Load: [**********]100% | Power: 216.24 W [******* ]71% | Temp: 40.0°C
73
- 2019-05-28 20:58:13 | Core: 1050Mhz | Memory: 500Mhz | Fan: 1033 rpm [** ]17% | Load: [**********]97% | Power: 109.25 W [**** ]39% | Temp: 38.0°C
74
- 2019-05-28 20:58:17 | Core: 724Mhz | Memory: 500Mhz | Fan: 1058 rpm [** ]17% | Load: [ ]0% | Power: 17.17 W [* ]6% | Temp: 35.0°C
78
+ 2025-05-31 15:02:48 | Core: 41 | Memory: 456 | Fan: 0 rpm 00% [ ] | Load: 00% [ ] | Power: 34.00 W 10% [▎ ] | Temp: 45.0°C
79
+ 2025-05-31 15:02:51 | Core: 3 | Memory: 96 | Fan: 0 rpm 00% [ ] | Load: 00% [ ] | Power: 22.00 W 06% [▏ ] | Temp: 45.0°C
80
+ 2025-05-31 15:02:54 | Core: 2 | Memory: 96 | Fan: 0 rpm 00% [ ] | Load: 00% [ ] | Power: 11.00 W 03% [▏ ] | Temp: 45.0°C
81
+ 2025-05-31 15:02:57 | Core: 55 | Memory: 456 | Fan: 0 rpm 00% [ ] | Load: 04% [] | Power: 38.00 W 11% [] | Temp: 45.0°C
82
+ 2025-05-31 15:03:00 | Core: 63 | Memory: 456 | Fan: 0 rpm 00% [ ] | Load: 04% [▏ ] | Power: 33.00 W 10% [] | Temp: 45.0°C
83
+ 2025-05-31 15:03:03 | Core: 51 | Memory: 96 | Fan: 0 rpm 00% [ ] | Load: 03% [▏ ] | Power: 32.00 W 09% [] | Temp: 45.0°C
84
+ 2025-05-31 15:03:06 | Core: 63 | Memory: 456 | Fan: 0 rpm 00% [ ] | Load: 04% [] | Power: 33.00 W 10% [] | Temp: 45.0°C
85
+ 2025-05-31 15:03:09 | Core: 79 | Memory: 456 | Fan: 0 rpm 00% [ ] | Load: 05% [] | Power: 34.00 W 10% [] | Temp: 45.0°C
86
+ 2025-05-31 15:03:12 | Core: 96 | Memory: 456 | Fan: 0 rpm 00% [ ] | Load: 06% [] | Power: 35.00 W 10% [] | Temp: 45.0°C
87
+ 2025-05-31 15:03:15 | Core: 94 | Memory: 456 | Fan: 0 rpm 00% [ ] | Load: 05% [] | Power: 34.00 W 10% [▎ ] | Temp: 46.0°C
88
+ 2025-05-31 15:03:18 | Core: 95 | Memory: 456 | Fan: 0 rpm 00% [ ] | Load: 05% [▏ ] | Power: 34.00 W 10% [▎ ] | Temp: 46.0°C
89
+ 2025-05-31 15:03:21 | Core: 60 | Memory: 456 | Fan: 0 rpm 00% [ ] | Load: 03% [▏ ] | Power: 33.00 W 10% [▎ ] | Temp: 45.0°C
90
+ 2025-05-31 15:03:24 | Core: 71 | Memory: 96 | Fan: 0 rpm 00% [ ] | Load: 04% [▏ ] | Power: 31.00 W 09% [▎ ] | Temp: 45.0°C
91
+ 2025-05-31 15:03:27 | Core: 68 | Memory: 456 | Fan: 0 rpm 00% [ ] | Load: 03% [▏ ] | Power: 33.00 W 10% [▎ ] | Temp: 46.0°C
92
+ 2025-05-31 15:03:30 | Core: 219 | Memory: 456 | Fan: 0 rpm 00% [ ] | Load: 15% [▌ ] | Power: 36.00 W 11% [▍ ] | Temp: 46.0°C
93
+ 2025-05-31 15:03:33 | Core: 1328 | Memory: 772 | Fan: 0 rpm 00% [ ] | Load: 21% [▋ ] | Power: 43.00 W 12% [▍ ] | Temp: 46.0°C
94
+ 2025-05-31 15:03:36 | Core: 1241 | Memory: 772 | Fan: 0 rpm 00% [ ] | Load: 32% [█ ] | Power: 55.00 W 16% [▌ ] | Temp: 46.0°C
95
+ 2025-05-31 15:03:39 | Core: 216 | Memory: 456 | Fan: 0 rpm 00% [ ] | Load: 15% [▌ ] | Power: 38.00 W 11% [▍ ] | Temp: 46.0°C
75
96
  ^C
76
97
  And now the watch is ended.
77
98
  ```
78
99
 
79
100
  ```
80
101
  ➤ bin/amdgpu_fan watch_avg
81
- Watching Sapphire Technology Limited Vega 10 XL/XT [Radeon RX Vega 56/64] min, max and averges since
82
- 2020-06-02 23:05:20 -0400...
83
- <Press Ctrl-C to exit>
84
- Core clock min: 852 MHz avg: 887.0 MHz max: 1200 MHz now: 852 MHz
85
- 💾 Memory clk min: 167 MHz avg: 227.1 MHz max: 945 MHz now: 167 MHz
86
- 🌀 Fan speed min: 1231 RPM avg: 1231.0 RPM max: 1231 RPM now: 1231 RPM
87
- Power usage min: 6.0 W avg: 21.8 W max: 141.0 W now: 6.0 W
88
- 🌡 Temperature min: 30 °C avg: 31.3 °C max: 35 °C now: 32 °C
102
+ Watching Advanced Micro Devices, Inc. [AMD/ATI] NITRO+ RX 7900 XTX Vapor-X min, max and averges since 2025-05-31 15:04:22 -0400...
103
+ 🚚 Load min: 0 % avg: 5.9 % max: 27 % now: 3 %
104
+ ⏰ Core clock min: 2 MHz avg: 202.4 MHz max: 1337 MHz now: 51 MHz
105
+ 💾 Memory clk min: 456 MHz avg: 501.2 MHz max: 772 MHz now: 456 MHz
106
+ 🌀 Fan speed min: 0 RPM avg: 0.0 RPM max: 0 RPM now: 0 RPM
107
+ Power usage min: 30.0 W avg: 35.4 W max: 51.0 W now: 33.0 W
108
+ 🧯 Temperature min: 46.0 °C avg: 46.0 °C max: 47.0 °C now: 46.0 °C
89
109
  ^C
90
- And now the watch is ended.
110
+ And now the watch is ended
91
111
  ```
92
112
 
93
113
  ## Dependencies
@@ -25,18 +25,33 @@ module AmdgpuFan
25
25
  end
26
26
  end
27
27
 
28
- desc 'profile', 'View power profile details.'
29
- def profile
30
- puts amdgpu_service.profile_summary
28
+ desc 'power_mode_auto', 'Set the power profile to automatic mode.'
29
+ def power_mode_auto
30
+ amdgpu_service.set_performance_level('auto')
31
+ puts oneline_power_mode
31
32
  end
32
33
 
33
- desc 'profile_auto', 'Set the power profile to automatic mode.'
34
- def profile_auto
35
- amdgpu_service.profile_auto
34
+ desc 'power_mode_low',
35
+ 'Set the performance level to low to force the clocks to the lowest power state.'
36
+ def power_mode_low
37
+ amdgpu_service.set_performance_level('low')
38
+ puts oneline_power_mode
39
+ end
40
+
41
+ desc 'power_mode_high',
42
+ 'Set the performance level to low to force the clocks to the highest power state.'
43
+ def power_mode_high
44
+ amdgpu_service.set_performance_level('high')
45
+ puts oneline_power_mode
46
+ end
47
+
48
+ desc 'profile', 'View power profile details.'
49
+ def profile
36
50
  puts amdgpu_service.profile_summary
37
51
  end
38
52
 
39
- desc 'profile_force PROFILE_NUM', 'Manually set a power profile. (requires sudo)'
53
+ desc 'profile_force PROFILE_NUM',
54
+ 'Set performance mode to manual and set a power profile. (requires sudo)'
40
55
  def profile_force(state)
41
56
  amdgpu_service.profile_force = state
42
57
  puts amdgpu_service.profile_summary
@@ -71,7 +86,7 @@ module AmdgpuFan
71
86
  puts ICONS[:temp] + ' Temp:'.ljust(11) + "#{amdgpu_service.temperature}°C"
72
87
  puts ICONS[:power] + ' Power:'.ljust(11) +
73
88
  "#{amdgpu_service.profile_mode} profile in " \
74
- "#{amdgpu_service.power_dpm_state} mode using " \
89
+ "#{amdgpu_service.performance_level} mode using " \
75
90
  "#{amdgpu_service.power_draw} / #{amdgpu_service.power_max} Watts " \
76
91
  "(#{amdgpu_service.power_draw_percent}%)"
77
92
  puts ICONS[:load] + ' Load:'.ljust(11) + percent_meter(amdgpu_service.busy_percent, 12)
@@ -191,6 +206,12 @@ module AmdgpuFan
191
206
  format('%<num>0.2f', num: amdgpu_service.power_max)
192
207
  end
193
208
 
209
+ def oneline_power_mode
210
+ "--> #{ICONS[:power]} #{amdgpu_service.performance_level} mode using " \
211
+ "#{amdgpu_service.power_draw} / #{amdgpu_service.power_max} Watts " \
212
+ "(#{amdgpu_service.power_draw_percent}%)"
213
+ end
214
+
194
215
  def summary_clock
195
216
  "Core: #{amdgpu_service.core_clock.to_s.rjust(7)}#{WATCH_FIELD_SEPARATOR}" \
196
217
  "Memory: #{amdgpu_service.memory_clock.to_s.rjust(7)}"
@@ -22,7 +22,7 @@ module AmdgpuFan
22
22
  Connector.new card_num:,
23
23
  dir_path:,
24
24
  index: dir_path[-1],
25
- type: dir_path.slice(/(?<=card#{card_num}-)[A-z]+/)
25
+ type: dir_path.slice(/(?<=card#{card_num}-)[A-Za-z]+/)
26
26
  end
27
27
  end
28
28
  end
@@ -36,7 +36,7 @@ module AmdgpuFan
36
36
  end
37
37
 
38
38
  def valid_fan_percent_speed?(percent)
39
- (1..(100.to_i)).cover?(percent.to_i)
39
+ (1..(100)).cover?(percent.to_i)
40
40
  end
41
41
  end
42
42
  end
@@ -54,7 +54,7 @@ module AmdgpuFan
54
54
  # Set the fan mode to auto or manual.
55
55
  #
56
56
  def fan_mode=(mode)
57
- sudo_write fan_mode_file, FAN_MODES.key(mode.to_s)
57
+ sudo_write fan_mode_file, FAN_MODES.invert[mode.to_s]
58
58
  end
59
59
 
60
60
  ##
@@ -83,6 +83,8 @@ module AmdgpuFan
83
83
  #
84
84
  def fan_speed_rpm
85
85
  File.read(fan_file(:input)).strip.to_i
86
+ rescue Errno::EINVAL
87
+ 0 # no tach reading — fan off or sensor absent
86
88
  end
87
89
 
88
90
  ##
@@ -111,6 +113,9 @@ module AmdgpuFan
111
113
  .join(' ')
112
114
  end
113
115
 
116
+ ##
117
+ # For older GPUs
118
+ # https://dri.freedesktop.org/docs/drm/gpu/amdgpu.html#power-dpm-state
114
119
  def power_dpm_state
115
120
  File.read("#{base_card_dir}/power_dpm_state").strip
116
121
  end
@@ -127,8 +132,13 @@ module AmdgpuFan
127
132
  @power_max ||= power_raw_to_watts File.read("#{base_hwmon_dir}/power1_cap")
128
133
  end
129
134
 
130
- def profile_auto
131
- sudo_write "#{base_card_dir}/power_dpm_force_performance_level", 'auto'
135
+ # https://dri.freedesktop.org/docs/drm/gpu/amdgpu.html#power-dpm-force-performance-level
136
+ def performance_level
137
+ File.read("#{base_card_dir}/power_dpm_force_performance_level").strip
138
+ end
139
+
140
+ def set_performance_level(profile_name = 'auto')
141
+ sudo_write "#{base_card_dir}/power_dpm_force_performance_level", profile_name
132
142
  end
133
143
 
134
144
  def profile_force=(state)
@@ -2,5 +2,5 @@
2
2
 
3
3
  module AmdgpuFan
4
4
  # Current version of RSpec Core, in semantic versioning format.
5
- VERSION = '0.9.0'
5
+ VERSION = '1.1.0'
6
6
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amdgpu_fan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin McCormack
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-11-17 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: async
@@ -24,6 +23,20 @@ dependencies:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
25
  version: '2.0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: openssl
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '4.0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '4.0'
27
40
  - !ruby/object:Gem::Dependency
28
41
  name: thor
29
42
  requirement: !ruby/object:Gem::Requirement
@@ -64,8 +77,9 @@ homepage: https://github.com/HarlemSquirrel/amdgpu-fan-rb
64
77
  licenses:
65
78
  - MIT
66
79
  metadata:
80
+ changelog_uri: https://github.com/HarlemSquirrel/amdgpu-fan-rb/releases
81
+ source_code_uri: https://github.com/HarlemSquirrel/amdgpu-fan-rb
67
82
  rubygems_mfa_required: 'true'
68
- post_install_message:
69
83
  rdoc_options: []
70
84
  require_paths:
71
85
  - lib
@@ -73,15 +87,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
73
87
  requirements:
74
88
  - - ">="
75
89
  - !ruby/object:Gem::Version
76
- version: 3.1.0
90
+ version: 3.2.0
77
91
  required_rubygems_version: !ruby/object:Gem::Requirement
78
92
  requirements:
79
93
  - - ">="
80
94
  - !ruby/object:Gem::Version
81
95
  version: '0'
82
96
  requirements: []
83
- rubygems_version: 3.4.10
84
- signing_key:
97
+ rubygems_version: 4.0.16
85
98
  specification_version: 4
86
99
  summary: A CLI to view and set fan speeds for AMD graphics cards running on the open
87
100
  source amdgpu Linux driver