Arkapravo-Ghosh / asus-fan-mode

Fan Mode Control for Asus Laptops in Linux
MIT License
18 stars 2 forks source link

Is there a way to adjust fan curves? and GPU Fan #2

Open SaiKamalP opened 1 year ago

SaiKamalP commented 1 year ago

I am using ASUS Vivobook pro 15 i5 laptop.

using this repo i was able to to get the cpu fan full or auto, and i also noticed that we could only write 0 or 2 to pwm1_enable(cpu fan under /sys/devices/platform/asus-nb-wmi/hwmon/hwmon5/)

if in cases we would like to control the fan speed based on the current temperature of the cpu(just like windows does), can you provide some insites on how we could proceed.

Regarding GPU fan:- It looks like pwm2 is related to GPU fan, but writing anything to it, it says invalid (bash: echo: write error: Input/output error ). So my doubt is what could be the origin of this problem. like kernal level or os level. it looks like the device is recognized.

Arkapravo-Ghosh commented 1 year ago

I'm still finding a way to control GPU Fan.

screenshot

As you can see, I have my cpu fan under hwmon6 and I also thought pwm2_enable would be for GPU Fan, but nothing happens when I edit the value for pwm2_enable. Your Input/Output error might be due to some other reason, not related to GPU Fan.

GPU Fan can be controlled through NVIDIA Drivers in some laptops. In Windows, both my CPU and GPU Fan is controllable using MyASUS as well as ProArt Creator Hub. I don't think you can exactly control the curves in your Laptop but for sure you can change modes somehow. I'm working on it actually but I haven't got much ideas where to start with.

I'm still trying to figure out if this path (/sys/devices/platform/NVDA0820:00/) has something to do with my GPU Fan (NVIDIA Studio RTX 3050 Ti Mobile)

screenshot

Can you try to check if you have similar files in your Laptop too and also tell me what GPU you exactly have? It might help me make some progress on GPU Fan Control Feature which I am still working on right now.

SaiKamalP commented 1 year ago

Yes, I do have similar folders and files.

image

I am using NVIDIA RTX 3050 4GB GPU.

Arkapravo-Ghosh commented 1 year ago

Seems like you have the exact same files in exact location. I guess that's the case with most NVIDIA GPUs on Asus Laptops.

IuriiNikitin commented 4 months ago

Hello! I found a repository in which a person achieved certain results. Perhaps this will help implement gpu fan control into your script. https://github.com/HackTestes/NVML-GPU-Control

Arkapravo-Ghosh commented 4 months ago

Hello! I found a repository in which a person achieved certain results. Perhaps this will help implement gpu fan control into your script. https://github.com/HackTestes/NVML-GPU-Control

Seems like it is using pynvml module to automatically detect the number of controllers and set speed of fan for all of them. Will try integrating this to this repo.

SaiKamalP commented 4 months ago

Just tied that repo on my device, but it does't seem to work for me.

root@fedora:/home/saikamal/Downloads/gitclones/NVML-GPU-Control/src$ python3 ./nvml_gpu_control.py fan-control -n 'NVIDIA GeForce RTX 3050 Laptop GPU'
LOG[2024-05-26 09:25:26]: Driver Version: 550.78
LOG[2024-05-26 09:25:26]: Device name : NVIDIA GeForce RTX 3050 Laptop GPU
LOG[2024-05-26 09:25:26]: Device UUID : GPU-6169be12-ffa9-aa09-3c54-9991491beea1
Calling nvml shutdown and terminating the program
Traceback (most recent call last):
  File "/home/saikamal/Downloads/gitclones/NVML-GPU-Control/src/./nvml_gpu_control.py", line 67, in <module>
    main()
  File "/home/saikamal/Downloads/gitclones/NVML-GPU-Control/src/./nvml_gpu_control.py", line 40, in main
    main_funcs.fan_control(config)
  File "/home/saikamal/Downloads/gitclones/NVML-GPU-Control/src/helper_functions.py", line 211, in fan_control
    print_GPU_info(gpu_handle)
  File "/home/saikamal/Downloads/gitclones/NVML-GPU-Control/src/helper_functions.py", line 126, in print_GPU_info
    log_helper(f'Device fan speed : {pynvml.nvmlDeviceGetFanSpeed(gpu_handle)}%')
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pynvml/nvml.py", line 2275, in nvmlDeviceGetFanSpeed
    _nvmlCheckReturn(ret)
  File "/usr/local/lib/python3.12/site-packages/pynvml/nvml.py", line 833, in _nvmlCheckReturn
    raise NVMLError(ret)
pynvml.nvml.NVMLError_NotSupported: Not Supported
Arkapravo-Ghosh commented 4 months ago

Just tied that repo on my device, but it does't seem to work for me.


root@fedora:/home/saikamal/Downloads/gitclones/NVML-GPU-Control/src$ python3 ./nvml_gpu_control.py fan-control -n 'NVIDIA GeForce RTX 3050 Laptop GPU'

LOG[2024-05-26 09:25:26]: Driver Version: 550.78

LOG[2024-05-26 09:25:26]: Device name : NVIDIA GeForce RTX 3050 Laptop GPU

LOG[2024-05-26 09:25:26]: Device UUID : GPU-6169be12-ffa9-aa09-3c54-9991491beea1

Calling nvml shutdown and terminating the program

Traceback (most recent call last):

  File "/home/saikamal/Downloads/gitclones/NVML-GPU-Control/src/./nvml_gpu_control.py", line 67, in <module>

    main()

  File "/home/saikamal/Downloads/gitclones/NVML-GPU-Control/src/./nvml_gpu_control.py", line 40, in main

    main_funcs.fan_control(config)

  File "/home/saikamal/Downloads/gitclones/NVML-GPU-Control/src/helper_functions.py", line 211, in fan_control

    print_GPU_info(gpu_handle)

  File "/home/saikamal/Downloads/gitclones/NVML-GPU-Control/src/helper_functions.py", line 126, in print_GPU_info

    log_helper(f'Device fan speed : {pynvml.nvmlDeviceGetFanSpeed(gpu_handle)}%')

                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/pynvml/nvml.py", line 2275, in nvmlDeviceGetFanSpeed

    _nvmlCheckReturn(ret)

  File "/usr/local/lib/python3.12/site-packages/pynvml/nvml.py", line 833, in _nvmlCheckReturn

    raise NVMLError(ret)

pynvml.nvml.NVMLError_NotSupported: Not Supported

Your GPU Fan is controllable from Windows right?

SaiKamalP commented 4 months ago

Also want to point out the following from ArchWiki image

at https://wiki.archlinux.org/title/fan_speed_control

SaiKamalP commented 4 months ago

Just tied that repo on my device, but it does't seem to work for me.


root@fedora:/home/saikamal/Downloads/gitclones/NVML-GPU-Control/src$ python3 ./nvml_gpu_control.py fan-control -n 'NVIDIA GeForce RTX 3050 Laptop GPU'

LOG[2024-05-26 09:25:26]: Driver Version: 550.78

LOG[2024-05-26 09:25:26]: Device name : NVIDIA GeForce RTX 3050 Laptop GPU

LOG[2024-05-26 09:25:26]: Device UUID : GPU-6169be12-ffa9-aa09-3c54-9991491beea1

Calling nvml shutdown and terminating the program

Traceback (most recent call last):

  File "/home/saikamal/Downloads/gitclones/NVML-GPU-Control/src/./nvml_gpu_control.py", line 67, in <module>

    main()

  File "/home/saikamal/Downloads/gitclones/NVML-GPU-Control/src/./nvml_gpu_control.py", line 40, in main

    main_funcs.fan_control(config)

  File "/home/saikamal/Downloads/gitclones/NVML-GPU-Control/src/helper_functions.py", line 211, in fan_control

    print_GPU_info(gpu_handle)

  File "/home/saikamal/Downloads/gitclones/NVML-GPU-Control/src/helper_functions.py", line 126, in print_GPU_info

    log_helper(f'Device fan speed : {pynvml.nvmlDeviceGetFanSpeed(gpu_handle)}%')

                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/pynvml/nvml.py", line 2275, in nvmlDeviceGetFanSpeed

    _nvmlCheckReturn(ret)

  File "/usr/local/lib/python3.12/site-packages/pynvml/nvml.py", line 833, in _nvmlCheckReturn

    raise NVMLError(ret)

pynvml.nvml.NVMLError_NotSupported: Not Supported

Your GPU Fan is controllable from Windows right?

Yes I am able to control fan speeds from windows (through myASUS).

Arkapravo-Ghosh commented 4 months ago

Just tied that repo on my device, but it does't seem to work for me.


root@fedora:/home/saikamal/Downloads/gitclones/NVML-GPU-Control/src$ python3 ./nvml_gpu_control.py fan-control -n 'NVIDIA GeForce RTX 3050 Laptop GPU'

LOG[2024-05-26 09:25:26]: Driver Version: 550.78

LOG[2024-05-26 09:25:26]: Device name : NVIDIA GeForce RTX 3050 Laptop GPU

LOG[2024-05-26 09:25:26]: Device UUID : GPU-6169be12-ffa9-aa09-3c54-9991491beea1

Calling nvml shutdown and terminating the program

Traceback (most recent call last):

  File "/home/saikamal/Downloads/gitclones/NVML-GPU-Control/src/./nvml_gpu_control.py", line 67, in <module>

    main()

  File "/home/saikamal/Downloads/gitclones/NVML-GPU-Control/src/./nvml_gpu_control.py", line 40, in main

    main_funcs.fan_control(config)

  File "/home/saikamal/Downloads/gitclones/NVML-GPU-Control/src/helper_functions.py", line 211, in fan_control

    print_GPU_info(gpu_handle)

  File "/home/saikamal/Downloads/gitclones/NVML-GPU-Control/src/helper_functions.py", line 126, in print_GPU_info

    log_helper(f'Device fan speed : {pynvml.nvmlDeviceGetFanSpeed(gpu_handle)}%')

                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/pynvml/nvml.py", line 2275, in nvmlDeviceGetFanSpeed

    _nvmlCheckReturn(ret)

  File "/usr/local/lib/python3.12/site-packages/pynvml/nvml.py", line 833, in _nvmlCheckReturn

    raise NVMLError(ret)

pynvml.nvml.NVMLError_NotSupported: Not Supported

Your GPU Fan is controllable from Windows right?

Yes I am able to control fan speeds from windows (through myASUS).

Guessing that it would not work in mine too then. I'll still give it a shot once, but I think this one is for Desktops.

SaiKamalP commented 4 months ago

If we want to get this working, I guess we should just go and modify the kernel driver and test out, the relevant part of code is most probably at https://github.com/torvalds/linux/blob/master/drivers/platform/x86/asus-wmi.c

Arkapravo-Ghosh commented 4 months ago

Or just make one ourselves but I wonder how difficult that would be.