coolgpus配置风扇转速服务
本文最后更新于 668 天前,其中的信息可能已经有所发展或是发生改变。

coolgpus介绍

coolgpus为github上一个项目,python编写,可以配置NVIDIA显卡风扇转速。

项目地址https://github.com/andyljones/coolgpus

还可以pip方式安装

pip install coolgpus

该代码可以直接指定风扇转速区间

sudo $(which coolgpus) --speed 99 99

默认值运行

sudo $(which coolgpus)

也可以指定风扇转速与温度关联的曲线,例如使风扇速度从17C=15% 转速线性增长到 84C=99%转速

sudo $(which coolgpus) --temp 17 84 --speed 15 99

更可以列出任何温度和速度(增加)序列,它们将被线性插值,例如20% 30% 99%转速分别对应20C55C80C。

sudo $(which coolgpus) --temp 20 55 80 --speed 5 30 99

也可以直接创建service文件,以服务模式运行,参考以下模板

[Unit]
Description=Headless GPU Fan Control
After=syslog.target

[Service]
ExecStart=/home/ajones/conda/bin/coolgpus --kill
Restart=on-failure
RestartSec=5s
ExecStop=/bin/kill -2 $MAINPID
KillMode=none

[Install]
WantedBy=multi-user.target

其中ExecStart为启动时默认参数,可以根据实际情况修改,且要配置实际的可执行文件所在的路径,例如配置为20度50度70度分别对应20%50%99%转速。可用如下参数配置,且可以加上--kill选项,杀死任何现有的Xserver进程,以避免进程冲突,启动失败。

ExecStart=/usr/local/bin/coolgpus --kill --temp 20 50 70 --speed 20 50 99

而后可以启动服务(启动服务前应关闭图形化服务)

ubuntu16版本关闭图形化

systemctl stop lightdm.service

ubuntu18版本关闭图形化

init 3

而后启动coolgpus服务

systemctl start coolgpus.service

若要实现开机启动

systemctl enable coolgpus.service

详细使用可参考coolgpus --help 如下

usage: coolgpus [-h] [--temp TEMP [TEMP ...]] [--speed SPEED [SPEED ...]]
[--hyst [HYST]] [--kill] [--verbose] [--debug]

GPU fan control for Linux. By default, this uses a clamped linear fan curve,
going from 30% below 55C to 99% above 80C. There s also a small hysteresis
gap, because _changes_ in fan noise are a lot more distracting than steady fan
noise. I can't claim it's optimal, but it Works For My Machine (TM). Full load
is about 75C and 80%.

optional arguments:
-h, --help show this help message and exit
--temp TEMP [TEMP ...]
The temperature ranges where the fan speed will
increase linearly
--speed SPEED [SPEED ...]
The fan speed ranges
--hyst [HYST] The hysteresis gap. Large gaps will reduce how often
the fan speed is changed, but might mean the fan runs
faster than necessary
--kill Whether to kill existing Xorg sessions
--verbose Whether to print extra debugging information
--debug Whether to only start the Xorg subprocesses, and not
actually alter the fan speed. This can be useful for
debugging.

以下脚本可以简单实现快速部署coolgpus

ubuntu16.04部署脚本

sudo sh -c "cat >>/etc/apt/sources.list.d/163.list<<EOF
deb http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
EOF"
sudo apt-get update
apt-get install -y python3-pip
pip3 install coolgpus

sudo sh -c "cat >>/lib/systemd/system/coolgpus.service<<EOF
[Unit]
Description=Headless GPU Fan Control
After=syslog.target

[Service]
ExecStart=/usr/local/bin/coolgpus --kill --speed 99 99
Restart=on-failure
RestartSec=5s
ExecStop=/bin/kill -2 $MAINPID
KillMode=none

[Install]
WantedBy=multi-user.target
EOF"

systemctl stop lightdm.service
systemctl start coolgpus.service
systemctl status coolgpus.service
systemctl disable lightdm.service
systemctl enable coolgpus.service

ubuntu18.04部署脚本

sudo sh -c "cat >>/etc/apt/sources.list.d/aliyun.list<<EOF
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
EOF"

sudo apt-get update
apt-get install -y python3-pip xorg
pip3 install coolgpus

sudo sh -c "cat >>/lib/systemd/system/coolgpus.service<<EOF
[Unit]
Description=Headless GPU Fan Control
After=syslog.target

[Service]
ExecStart=/usr/local/bin/coolgpus --kill --temp 20 50 70 --speed 20 50 99
Restart=on-failure
RestartSec=5s
ExecStop=/bin/kill -2 $MAINPID
KillMode=none

[Install]
WantedBy=multi-user.target
EOF"

#systemctl stop lightdm.service
init 3
systemctl start coolgpus.service
systemctl status coolgpus.service
systemctl set-default multi-user.target
systemctl enable coolgpus.service
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇