Giter VIP home page Giter VIP logo

amdgpu-fan's People

Contributors

chestm007 avatar cz-themax avatar gijack avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

amdgpu-fan's Issues

amdgpu-fan service wont start? on Debian 11

The Issue

I recently installed Debian Bullseye on my system, following this guide I found out about amdgpu-fan: https://wiki.debian.org/AtiHowTo. Once installed it began to run smoothly but today it has stopped and I dont know why. I'm not a Python savvy developer, Im still learning the language... so Im not sure how to fix this without making a mess. Hopefully someone will; here are the files I've created:
/etc/amdgpu-fan.yml

speed_matrix: # -[temp(*C), speed(0-100%)]
- [0, 0]
- [30, 15]
- [50, 30]
- [70, 70]
- [90, 100]

# Optional
# cards: # Any card returned from: `ls /sys/class/drm | gep "^card[[:digit:]]$"`
# - card0

/etc/systemd/system/amdgpu-fan.service

[Unit]
Description=Service for controlling amdgpu fan.
After=syslog.service

[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/amdgpu-fan
Restart=always

[Install]
WantedBy=multi-user.target

When I run either of these commands: amdgpu-fan / sudo amdgpu-fan I get this output:

Traceback (most recent call last):
  File "/usr/local/bin/amdgpu-fan", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/dist-packages/amdgpu_fan/controller.py", line 67, in main
    config = load_config(location)
  File "/usr/local/lib/python3.9/dist-packages/amdgpu_fan/controller.py", line 44, in load_config
    return yaml.load(f)
TypeError: load() missing 1 required positional argument: 'Loader'

And this is the output of: sudo systemctl status amdgpu-fan.service

● amdgpu-fan.service - Service for controlling amdgpu fan.
     Loaded: loaded (/etc/systemd/system/amdgpu-fan.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2022-02-15 19:40:26 -03; 16min ago
    Process: 699182 ExecStart=/usr/local/bin/amdgpu-fan (code=exited, status=1/FAILURE)
   Main PID: 699182 (code=exited, status=1/FAILURE)
        CPU: 652ms

What I've tried

Uninstalling amdgpu-fan and deleting the 2 files I've created.
Then I reinstalled amdgpu-fan and made again the 2 files mentioned above.

I'd appreciate if anyone could point me in the right direction. Thanks in advance.

Explain The Following 'This environment is externally managed'?

# pip3 install amdgpu-fan
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.

    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.

    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.

    See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

KeyError: 'pwm1_min'

Installed the lasted version from GitHub, but got this:

starting amdgpu-fan
Traceback (most recent call last):
  File "/usr/local/bin/amdgpu-fan", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/amdgpu_fan/controller.py", line 78, in main
    FanController(config).main()
  File "/usr/local/lib/python3.11/dist-packages/amdgpu_fan/controller.py", line 35, in main
    logger.debug(f'{name}: Temp {temp}, Setting fan speed to: {speed}, fan speed{card.fan_speed}, min:{card.fan_min}, max:{card.fan_max}')
                                                                                                       ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/amdgpu_fan/lib/amdgpu.py", line 64, in fan_min
    return int(self.read_endpoint('pwm1_min'))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/amdgpu_fan/lib/amdgpu.py", line 36, in read_endpoint
    with open(self._endpoints[endpoint], 'r') as e:
              ~~~~~~~~~~~~~~~^^^^^^^^^^
KeyError: 'pwm1_min'

Also tried all the pull request versions and got the same error.🌚

IndexError: too many indices for array

OS: Arch Linux
GPU: MSI Radeon R9 390 Gaming (card0)

After the program creates a default config file and me uncommenting the card0 line, the program puts this out:

/usr/lib/python3.7/site-packages/amdgpu_fan/controller.py:44: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  return yaml.load(f)
Traceback (most recent call last):
  File "/usr/bin/amdgpu-fan", line 11, in <module>
    load_entry_point('amdgpu-fan==0.0.6', 'console_scripts', 'amdgpu-fan')()
  File "/usr/lib/python3.7/site-packages/amdgpu_fan/controller.py", line 78, in main
    FanController(config).main()
  File "/usr/lib/python3.7/site-packages/amdgpu_fan/controller.py", line 23, in __init__
    self.curve = Curve(config.get('speed_matrix'))
  File "/usr/lib/python3.7/site-packages/amdgpu_fan/lib/curve.py", line 10, in __init__
    self.temps = self.points[:, 0]
IndexError: too many indices for array

Config:

#Fan Control Matrix. [<Temp in C>,<Fanspeed in %>]
speed_matrix:
- [0, 0]
- [30, 33]
- [45, 50]
- [60, 66]
- [65, 69]
- [70, 75]
- [75, 89]
- [80, 100]

# optional
# cards:  # can be any card returned from `ls /sys/class/drm | grep "^card[[:digit:]]$"`
- card0

Any ideas what could be wrong?

AttributeError: 'list' object has no attribute 'get'

Unable to run (installed from AUR).

$ sudo amdgpu-fan Traceback (most recent call last): File "/usr/bin/amdgpu-fan", line 11, in <module> load_entry_point('amdgpu-fan===0.0.1.r1.g6d29514', 'console_scripts', 'amdgpu-fan')() File "/usr/lib/python3.7/site-packages/amdgpu_fan/controller.py", line 58, in main FanController(config).main() File "/usr/lib/python3.7/site-packages/amdgpu_fan/controller.py", line 19, in __init__ self.curve = Curve(config.get('speed_matrix')) AttributeError: 'list' object has no attribute 'get'

Config file is at /etc/amdgpu-fan.yml and is 777. Contents exactly same as in readme.

[ERROR] no compatible cards found

Hi! I have ArchLinux with latest version of the kernel and the amdgpu-fan package, I started having this issue a few days ago I can't make it work again, here some details.

Package:

yay -Qs amd                                                                                                                                               
local/amdgpu-fan 0.1.0-4
    Python daemon for controlling the fans on AMDGPU cards

Kernel:

 uname -ar                                                                                                                                                  
Linux Tesla 6.5.4-arch2-1 #1 SMP PREEMPT_DYNAMIC Thu, 21 Sep 2023 11:06:39 +0000 x86_64 GNU/Linux

Modules loaded:

[root@Tesla ~]# lsmod | grep -i amd
amdgpu              12312576  88
i2c_algo_bit           20480  1 amdgpu
drm_ttm_helper         12288  1 amdgpu
ttm                   110592  2 amdgpu,drm_ttm_helper
drm_suballoc_helper    12288  1 amdgpu
amdxcp                 12288  1 amdgpu
drm_buddy              20480  1 amdgpu
gpu_sched              57344  1 amdgpu
drm_display_helper    229376  1 amdgpu
video                  77824  2 asus_wmi,amdgp

Card:

03:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 [Radeon RX 5600 OEM/5600 XT / 5700/5700 XT] (rev c1)

Executing the binary:

❯ amdgpu-fan                                                                                                                                   
no compatible cards found, exiting

Using systemd:

[root@Tesla ~]# systemctl status amdgpu-fan.service
× amdgpu-fan.service - amdgpu fan controller
     Loaded: loaded (/usr/lib/systemd/system/amdgpu-fan.service; enabled; preset: disabled)
     Active: failed (Result: exit-code) since Wed 2023-09-27 09:20:19 -03; 20min ago
   Duration: 133ms
    Process: 720 ExecStart=/usr/bin/amdgpu-fan (code=exited, status=1/FAILURE)
   Main PID: 720 (code=exited, status=1/FAILURE)
        CPU: 130ms

Sep 27 09:20:19 Tesla systemd[1]: amdgpu-fan.service: Scheduled restart job, restart counter is at 5.
Sep 27 09:20:19 Tesla systemd[1]: amdgpu-fan.service: Start request repeated too quickly.
Sep 27 09:20:19 Tesla systemd[1]: amdgpu-fan.service: Failed with result 'exit-code'.
Sep 27 09:20:19 Tesla systemd[1]: Failed to start amdgpu fan controller.

What can be happening ?

Thanks a lot!.

ERROR: missing 1 required positional argument: 'Loader'

unfortunately not running here an debian bullseye and AMD Navi (5700 XT):

Traceback (most recent call last):
File "/usr/local/bin/amdgpu-fan", line 8, in sys.exit(main())
File "/usr/local/lib/python3.9/dist-packages/amdgpu_fan/controller.py", line 76, in main config = ad_config(CONFIG_LOCATIONS[-1])
File "/usr/local/lib/python3.9/dist-packages/amdgpu_fan/controller.py", line 44, in load_config return yaml.load(f)
TypeError: load() missing 1 required positional argument: 'Loader'

Crash on amdgpu read timer expiration

Jun 09 17:19:35 - amdgpu-fan[851]: Traceback (most recent call last):
Jun 09 17:19:35 - amdgpu-fan[851]:   File "/usr/bin/amdgpu-fan", line 33, in <module>
Jun 09 17:19:35 - kernel: amdgpu: [powerplay] failed send message: TransferTableSmu2Dram (18)         param: 0x00000006 response 0xffffffc2
Jun 09 17:19:35 - kernel: amdgpu: [powerplay] Failed to export SMU metrics table!
Jun 09 17:19:35 - amdgpu-fan[851]:     sys.exit(load_entry_point('amdgpu-fan==0.1.0', 'console_scripts', 'amdgpu-fan')())
Jun 09 17:19:35 - amdgpu-fan[851]:   File "/usr/lib/python3.9/site-packages/amdgpu_fan/controller.py", line 95, in main
Jun 09 17:19:35 - amdgpu-fan[851]:     FanController(config).main()
Jun 09 17:19:35 - amdgpu-fan[851]:   File "/usr/lib/python3.9/site-packages/amdgpu_fan/controller.py", line 36, in main
Jun 09 17:19:35 - amdgpu-fan[851]:     if current_speed is not None and abs(current_speed - card.fan_speed) > 10:
Jun 09 17:19:35 - amdgpu-fan[851]:   File "/usr/lib/python3.9/site-packages/amdgpu_fan/lib/amdgpu.py", line 50, in fan_speed
Jun 09 17:19:35 - amdgpu-fan[851]:     return int(int(self.read_endpoint('pwm1')) * 100 / self.fan_max)
Jun 09 17:19:35 - amdgpu-fan[851]:   File "/usr/lib/python3.9/site-packages/amdgpu_fan/lib/amdgpu.py", line 37, in read_endpoint
Jun 09 17:19:35 - amdgpu-fan[851]:     return e.read()
Jun 09 17:19:35 - amdgpu-fan[851]: OSError: [Errno 62] Timer expired
Jun 09 17:19:35 - systemd[1]: amdgpu-fan.service: Main process exited, code=exited, status=1/FAILURE
Jun 09 17:19:35 - audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=amdgpu-fan comm="systemd" exe="/usr/lib/systemd/systemd" h>
Jun 09 17:19:35 - kernel: audit: type=1131 audit(1623251975.286:69): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=amdgpu-fan comm="systemd" exe=>
Jun 09 17:19:35 - systemd[1]: amdgpu-fan.service: Failed with result 'exit-code'.
Jun 09 17:19:35 - systemd[1]: amdgpu-fan.service: Scheduled restart job, restart counter is at 3

Sometimes my graphics card can hang up, the fan service will crash then and this is not very safe. If possible, the error should be caught and preemptive measures should be taken, such as spin up of the fans. Yeah it's not ideal, but it's safer than idling.

sudo pip install amdgpu-fan old code

The pip package/library when installed uses old code that has not changed the yaml.load(f) part to yaml.safe_load(f), thus all installs using new libraries will get error when trying to run sudo amdgpu-fan after sudo pip3 install amdgpu-fan.

yaml.load(f) expects another argument in newer version, and thus throws error.

Traceback (most recent call last):
  File "/usr/bin/amdgpu-fan", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.10/site-packages/amdgpu_fan/controller.py", line 67, in main
    config = load_config(location)
  File "/usr/lib/python3.10/site-packages/amdgpu_fan/controller.py", line 44, in load_config
    return yaml.load(f)
TypeError: load() missing 1 required positional argument: 'Loader'

Changing that line to yaml.safe_load(f) made it work for me

undeclared dependencies

As far as I can see setup.py does not declare any dependencies. However the scripts needs at least PyYAML, numpy, matplotlib and scipy. (Also I'd appreciate if it could run without the later three.)

Doesn't appear to do anything

So I tried to get the advertised functionality out of the card, which is the fans not running under 60 degrees.

Config file:

#Fan Control Matrix. [<Temp in C>,<Fanspeed in %>]
speed_matrix:
- [0, 0]
- [30, 0]
- [45, 0]
- [60, 0]
- [61, 30]
- [65, 50]
- [70, 70]
- [75, 89]
- [80, 100]

# optional
cards:  # can be any card returned from `ls /sys/class/drm | grep "^card[[:digit:]]$"`
- card0

running amdgpu-fan as sudo results in:

/usr/lib/python3.8/site-packages/amdgpu_fan/controller.py:44: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  return yaml.load(f)
starting amdgpu-fan

watch sensors reports fan speed steady at 1200 RPM at 41 degrees. Visually the fans are still clearly running. Running amdgpu-fan as a service doesn't result in different behavior either. card0 exists in /sys/class/drm

GPU: AsRock RX 570 8GB
Distro: Manjaro

This doesn't work at all on Ubuntu 19.10 and this project appears dead.

When trying to run amdgpu-fan after installing it via sudo pip3 install amdgpu-fan, and then trying to run it, it throws a million errors:

sudo amdgpu-fan
/usr/local/lib/python3.7/dist-packages/amdgpu_fan/controller.py:44: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  return yaml.load(f)
Traceback (most recent call last):
  File "/usr/local/bin/amdgpu-fan", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/amdgpu_fan/controller.py", line 67, in main
    config = load_config(location)
  File "/usr/local/lib/python3.7/dist-packages/amdgpu_fan/controller.py", line 44, in load_config
    return yaml.load(f)
  File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 114, in load
    return loader.get_single_data()
  File "/usr/lib/python3/dist-packages/yaml/constructor.py", line 41, in get_single_data
    node = self.get_single_node()
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 127, in compose_mapping_node
    while not self.check_event(MappingEndEvent):
  File "/usr/lib/python3/dist-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/usr/lib/python3/dist-packages/yaml/parser.py", line 439, in parse_block_mapping_key
    "expected <block end>, but found %r" % token.id, token.start_mark)
yaml.parser.ParserError: while parsing a block mapping
  in "/etc/amdgpu-fan.yml", line 2, column 1
expected <block end>, but found '<block mapping start>'
  in "/etc/amdgpu-fan.yml", line 19, column 2

I know the first error, the /usr/local/lib/python3.7/dist-packages/amdgpu_fan/controller.py:44: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. is not a big deal, as I have always gotten that error and it has worked on other systems (namely Arch Linux systems), but it's completely broken on Ubuntu. But then when I actually looked, I saw that this project is incredibly dead. It would be nice, if you had no intention of fixing issues with your project, if you would at least say that the project is dead in the README, instead of people getting screwed over by installing a package that is listed in multiple places as being functional but is not, and if you have an issue there's no way to get it resolved.

Service Error - OSError: [Errno 95] Operation not supported

Hi, I am trying to get amdgpu-fan working on Debian 12 due to high GPU temps, I followed the steps outlined on the Debian Wiki.

When checking the status of the service after restarting the daemon and system entirely I find this:

× amdgpu-fan.service - Service for controling amdgpu fan.
     Loaded: loaded (/etc/systemd/system/amdgpu-fan.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Tue 2024-01-23 19:04:12 GMT; 2s ago
   Duration: 107ms
    Process: 6776 ExecStart=/usr/local/bin/amdgpu-fan (code=exited, status=1/FAILURE)
   Main PID: 6776 (code=exited, status=1/FAILURE)
        CPU: 811ms

Jan 23 19:04:12 Computer amdgpu-fan[6776]:                                                                             >
Jan 23 19:04:12 Computer amdgpu-fan[6776]:   File "/usr/local/lib/python3.11/dist-packages/amdgpu_fan/lib/amdgpu.py", l>
Jan 23 19:04:12 Computer amdgpu-fan[6776]:     return int(self.read_endpoint('fan1_input'))
Jan 23 19:04:12 Computer amdgpu-fan[6776]:                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jan 23 19:04:12 Computer amdgpu-fan[6776]:   File "/usr/local/lib/python3.11/dist-packages/amdgpu_fan/lib/amdgpu.py", l>
Jan 23 19:04:12 Computer amdgpu-fan[6776]:     return e.read()
Jan 23 19:04:12 Computer amdgpu-fan[6776]:            ^^^^^^^^
Jan 23 19:04:12 Computer amdgpu-fan[6776]: OSError: [Errno 95] Operation not supported
Jan 23 19:04:12 Computer systemd[1]: amdgpu-fan.service: Main process exited, code=exited, status=1/FAILURE
Jan 23 19:04:12 Computer systemd[1]: amdgpu-fan.service: Failed with result 'exit-code'.

Which is odd because I actually have managed to get the service to run, maybe this was with the config file not requiring modifications to the pwm1 file?

● amdgpu-fan.service - Service for controling amdgpu fan.
     Loaded: loaded (/etc/systemd/system/amdgpu-fan.service; enabled; preset: enabled)
     Active: active (running) since Tue 2024-01-23 18:45:51 GMT; 8ms ago
   Main PID: 4461 (amdgpu-fan)
      Tasks: 1 (limit: 18997)
     Memory: 2.5M
        CPU: 3ms
     CGroup: /system.slice/amdgpu-fan.service
             └─4461 /usr/bin/python3 /usr/local/bin/amdgpu-fan

I have inspected the /usr/local/lib/python3.11/dist-packages/amdgpu_fan/lib/amdgpu.py file myself but cannot seem to find any issues with it, other than the fact that these variables aren't pointing to the correct locations?

ROOT_DIR = '/sys/class/drm'
HWMON_DIR = 'device/hwmon'

My systemd service looks like this:

[Unit]
Description=Service for controling amdgpu fan.
After=syslog.service

[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/amdgpu-fan
Restart=always

[Install]
WantedBy=multi-user.target

As mentioned I have been able to get the service to start but it has not modified the fan speeds for whatever reason (possibly due to the config file and current temps) but I have been able to use a different tool to control the fan speed so I know that it definitely can be done, I would just rather rely on this tool rather than that one.

The GPU in question

08:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Pitcairn XT [Radeon HD 7870 GHz Edition]
	Subsystem: Micro-Star International Co., Ltd. [MSI] Pitcairn XT [Radeon HD 7870 GHz Edition]
	Kernel driver in use: amdgpu
	Kernel modules: radeon, amdgpu

image

As far as I know, the card (although old) should be supported by both amdgpu and amdgpu-fan.

I don't know if this helps/mean anything but after a system reboot, checking the status returns this:

× amdgpu-fan.service - Service for controling amdgpu fan.
     Loaded: loaded (/etc/systemd/system/amdgpu-fan.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Tue 2024-01-23 19:42:35 GMT; 16min ago
   Duration: 116ms
    Process: 1177 ExecStart=/usr/local/bin/amdgpu-fan (code=exited, status=1/FAILURE)
   Main PID: 1177 (code=exited, status=1/FAILURE)
        CPU: 839ms

Jan 23 19:42:35 Computer systemd[1]: amdgpu-fan.service: Scheduled restart job, restart counter is at 5.
Jan 23 19:42:35 Computer systemd[1]: Stopped amdgpu-fan.service - Service for controling amdgpu fan..
Jan 23 19:42:35 Computer systemd[1]: amdgpu-fan.service: Start request repeated too quickly.
Jan 23 19:42:35 Computer systemd[1]: amdgpu-fan.service: Failed with result 'exit-code'.
Jan 23 19:42:35 Computer systemd[1]: Failed to start amdgpu-fan.service - Service for controling amdgpu fan..

Any help is much appreciated to save my GPU from frying.

Thanks in advance!

amdgpu-fan status

You should be able to get the status of the fans: rotational speed + temperature by running sudo amdgpu-fan --status.

Tidy up upon quitting controller

I've been testing this manually when gaming. Good to keep temperature lower as my default settings prioritize silent run.

However, when the controller quits, eg upon Ctrl-C, the fan is left at the last set speed.

Suggest to tidy up the initial state upon interrupt or any error. For my case, I've added a try .. except KeyboardInterrupt to the controller loop to set pwm1_enable back to 2 (original value in my system).

Had to make an edit to get the service to run properly

So I noticed today that my amdgpu-fan service wasn't running (found out due to an overheating issue in a game). I had installed it using the pip3 installer and then to try and get the service running I downloaded the zip and moved the service file to /etc/systemd/system. After enabling I hadn't taken the time to check but apparently it was actually failing to start. Perhaps I am doing things wrong by combining installs but I had to edit the service file to point to /usr/local/bin instead of /usr/bin. Not a huge thing but it did take a little tweaking. Perhaps I am messing things up by downloading a separate service file but it is now working. Just for reference I am basically using ubuntu 18.04. With my tweak it seems to be working perfectly now. Thanks btw way for such a nice tool for keeping things working.

R9 390: fan1_input - No such device

Using an R9 390, reading the current fan speed results in a program crash:

  File "/usr/lib/python3.8/site-packages/amdgpu_fan/controller.py", line 35, in main
    logger.debug(f'{name}: Temp {temp}, Setting fan speed to: {speed}, fan speed{card.fan_speed}, min:{card.fan_min}, max:{card.fan_max}')
  File "/usr/lib/python3.8/site-packages/amdgpu_fan/lib/amdgpu.py", line 50, in fan_speed
    return int(self.read_endpoint('fan1_input'))
  File "/usr/lib/python3.8/site-packages/amdgpu_fan/lib/amdgpu.py", line 37, in read_endpoint
    return e.read()
OSError: [Errno 19] No such device

This is due to cat /sys/class/drm/card0/device/hwmon/hwmon1/fan1_input: No such device

System information:

1d:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Hawaii PRO [Radeon R9 290/390] [1002:67b1] (rev 80)
Linux 5.5.5-arch1-1 #1 SMP PREEMPT Thu, 20 Feb 2020 18:23:09 +0000 x86_64 GNU/Linux

YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated

As per title, starting amdgpu-fan results in the warning YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default loader is unsafe. Please read https://msg.pyyaml.org/load for full details.. This error is happening on Python 3.10 on Arch. amdgpu-fan is pulled in via pip.

amdgpu-fan does not appear to be running

Running sudo amdgpu-fan from terminal results in this error:
starting amdgpu-fan
Traceback (most recent call last):
File "/usr/bin/amdgpu-fan", line 11, in
load_entry_point('amdgpu-fan==0.0.5', 'console_scripts', 'amdgpu-fan')()
File "/usr/lib/python3.7/site-packages/amdgpu_fan/controller.py", line 78, in main
FanController(config).main()
File "/usr/lib/python3.7/site-packages/amdgpu_fan/controller.py", line 35, in main
logger.debug(f'{name}: Temp {temp}, Setting fan speed to: {speed}, fan speed{card.fan_speed}, min:{card.fan_min}, max:{card.fan_max}')
File "/usr/lib/python3.7/site-packages/amdgpu_fan/lib/amdgpu.py", line 50, in fan_speed
return int(self.read_endpoint('fan1_input'))
File "/usr/lib/python3.7/site-packages/amdgpu_fan/lib/amdgpu.py", line 37, in read_endpoint
return e.read()
OSError: [Errno 19] No such device

Checking systemctl --failed shows that the service is loaded but failed.

Am I doing something wrong?

amdgpu-fan crashing

Traceback (most recent call last):
  File "/usr/bin/amdgpu-fan", line 11, in <module>
    load_entry_point('amdgpu-fan==0.0.2', 'console_scripts', 'amdgpu-fan')()
  File "/usr/lib/python3.7/site-packages/amdgpu_fan/controller.py", line 70, in main
    FanController(config).main()
  File "/usr/lib/python3.7/site-packages/amdgpu_fan/controller.py", line 31, in main
    logger.debug(f'{name}: Temp {temp}, Setting fan speed to: {speed}, fan speed{card.fan_speed}, min:{card.fan_min}, max:{card.fan_max}')
  File "/usr/lib/python3.7/site-packages/amdgpu_fan/lib/amdgpu.py", line 38, in fan_speed
    return int(self.read_endpoint('fan1_input'))
  File "/usr/lib/python3.7/site-packages/amdgpu_fan/lib/amdgpu.py", line 29, in read_endpoint
    with open(self._endpoints[endpoint], 'r') as e:
KeyError: 'fan1_input'

https://github.com/chestm007/amdgpu-fan/blob/master/amdgpu_fan/lib/amdgpu.py#L38 tries to open /sys/class/drm/card0/device/hwmon/hwmon0/fan1_input, but no such file exists.

ls -Fh /sys/class/drm/card0/device/hwmon/hwmon0/:
device@  name  power/  pwm1  pwm1_enable  pwm1_max  pwm1_min  subsystem@  temp1_crit  temp1_crit_hyst  temp1_input  uevent

Applied temporary workaround, but not sure if it is right:

diff --git a/amdgpu_fan/lib/amdgpu.py b/amdgpu_fan/lib/amdgpu.py
--- a/amdgpu_fan/lib/amdgpu.py
+++ b/amdgpu_fan/lib/amdgpu.py
@@ -35,7 +35,7 @@ class Card:
 
     @property
     def fan_speed(self):
-        return int(self.read_endpoint('fan1_input'))
+        return int(self.read_endpoint('pwm1'))
 
     @property
     def gpu_temp(self): 

Up to date Arch Linux, 4.19.20-1-lts kernel, Radeon R7 370 + Intel GPU

Options for selecting GPU(s) in /etc/amdgpu-fan.yml

Is there a means for running amdgpu-fan only with (a) selected GPU(s)? I have my Intel iGPU enabled and it's /sys/class/drm/card0 whereas my AMD GPU is /sys/class/drm/card1. It seems amdgpu.py looks for card0 by default. It looks like I could use amdgpu.py --get card1 fan_speed from the help flag, but It only looks for card0 even when I try to explicitly run it with card1 as part of the command. My Intel iGPU does not seem to have a /device/hwmon directory, so amdgpu.py fails with the following traceback:

Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/amdgpu_fan/lib/amdgpu.py", line 113, in <module> scanner = Scanner() File "/usr/lib/python3.7/site-packages/amdgpu_fan/lib/amdgpu.py", line 69, in __init__ self.cards = self._get_cards() File "/usr/lib/python3.7/site-packages/amdgpu_fan/lib/amdgpu.py", line 76, in _get_cards return {node: Card(node) for node in os.listdir(ROOT_DIR) if re.match(self.CARD_REGEX, node)} File "/usr/lib/python3.7/site-packages/amdgpu_fan/lib/amdgpu.py", line 76, in <dictcomp> return {node: Card(node) for node in os.listdir(ROOT_DIR) if re.match(self.CARD_REGEX, node)} File "/usr/lib/python3.7/site-packages/amdgpu_fan/lib/amdgpu.py", line 15, in __init__ for node in os.listdir(os.path.join(ROOT_DIR, self._identifier, HWMON_DIR)): FileNotFoundError: [Errno 2] No such file or directory: '/sys/class/drm/card0/device/hwmon'

OSError: [Errno 22] Invalid argument

/usr/local/lib/python3.8/dist-packages/amdgpu_fan/controller.py:44: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  return yaml.load(f)
starting amdgpu-fan
OSError: [Errno 22] Invalid argument

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/amdgpu-fan", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/amdgpu_fan/controller.py", line 78, in main
    FanController(config).main()
  File "/usr/local/lib/python3.8/dist-packages/amdgpu_fan/controller.py", line 37, in main
    card.set_fan_speed(speed)
  File "/usr/local/lib/python3.8/dist-packages/amdgpu_fan/lib/amdgpu.py", line 77, in set_fan_speed
    return self.write_endpoint('pwm1', int(speed))
  File "/usr/local/lib/python3.8/dist-packages/amdgpu_fan/lib/amdgpu.py", line 42, in write_endpoint
    return e.write(str(data))
OSError: [Errno 22] Invalid argument

OSError: [Errno 22] Invalid argument

lsb_release -a
#Description: Ubuntu 18.04.4 LTS

lspci | grep VGA
#1:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X] (rev ef)

python3 --version
#Python 3.6.9

sudo apt install python3-pip

pip3 --version
#pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)

sudo amdgpu-fan

starting amdgpu-fan
Traceback (most recent call last):
File "/usr/local/bin/amdgpu-fan", line 11, in
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/amdgpu_fan/controller.py", line 7 8, in main
FanController(config).main()
File "/usr/local/lib/python3.6/dist-packages/amdgpu_fan/controller.py", line 3 5, in main
logger.debug(f'{name}: Temp {temp}, Setting fan speed to: {speed}, fan speed {card.fan_speed}, min:{card.fan_min}, max:{card.fan_max}')
File "/usr/local/lib/python3.6/dist-packages/amdgpu_fan/lib/amdgpu.py", line 5 0, in fan_speed
return int(self.read_endpoint('fan1_input'))
File "/usr/local/lib/python3.6/dist-packages/amdgpu_fan/lib/amdgpu.py", line 3 7, in read_endpoint
return e.read()
OSError: [Errno 22] Invalid argument

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.