gpuctl

command module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 2 Imported by: 0

README

gpuctl

Go Version Latest Release

gpuctl image

GPU 状态管理和监控工具.

🛠 功能

  • 查看功耗, 温度, 风扇, 频率, 内存状态
  • 调整功耗, 频率
  • 调整风扇
  • 配置文件, 支持登录时自动应用

支持的 GPU:

  • NVIDIA (NVML)
  • Intel (Level Zero).
  • 不会有 AMD, 直到有跨平台的 API (to AMD: Intel 比你们起步晚, 但 API 仍然跨平台)

📦 快速安装

  • Linux

    curl -sSL https://raw.githubusercontent.com/zhhc99/gpuctl/main/install.sh | sudo bash
    
  • Windows

    powershell -ExecutionPolicy ByPass -Command "iwr -useb https://raw.githubusercontent.com/zhhc99/gpuctl/main/install.ps1 | iex"
    
  • 也可以用 go install:

    # 💡 gpuctl service install 在 Linux 下会自动向 /usr/local/bin/ 拷贝自身, 以避免服务权限问题.
    go install github.com/zhhc99/gpuctl@latest
    

卸载:

  • Linux

    curl -sSL https://raw.githubusercontent.com/zhhc99/gpuctl/main/uninstall.sh | sudo bash
    
  • Windows

    • 删除文件.
    • 执行 taskschd.msc (任务计划程序), 删除所有前缀为 "gpuctl@" 的任务 (如果有).

📖 基础用法

查看所有 GPU 状态:

gpuctl get

# on UNIX: watch -n 1 gpuctl get

设置 100w 功耗墙, 只应用到编号为 0 的 NVIDIA GPU:

gpuctl tune set pl=100 -d n:0

核心超频 +210MHz, 降压使得核心频率不超过 2520MHz:

gpuctl tune set cogpu=210 clgpu=2520

⚠️ 一般不认为超频损伤硬件, 但激进参数可能导致花屏冻结.

编辑配置文件:

gpuctl config edit

更多用法见 gpuctl --help.

🤔 常见问题

Q: 提示 Permission DeniedInsufficient Permissions 等怎么办?

A: tuneservice 的一些命令需要提权:

  • Linux: 使用 sudo 执行即可.
  • Windows: 不太容易在同一个终端提权, 用 sudo 的话当前终端可能看不到输出. 考虑给 Windows Terminal 添加一个新配置文件, 并启用 "以管理员身份运行此配置文件", 之后可以在这个提权终端执行 gpuctl.

Q: Windows 下 gpuctl service status 显示乱码怎么办?

A: 这是 Windows 地区编码的遗留问题. 如果能看到乱码, 一般说明服务正常运行.

🔨 编译源代码

这是一个纯 go 项目, 编译非常简单.

go build -o gpuctl .

如果希望带有版本号:

go build -ldflags "-X 'gpuctl/cmd.Version=v1.0.0'"

🚀 发布

提交代码后, 推送 tag 触发 goreleaser:

git tag vX.Y.Z
git push origin vX.Y.Z

GitHub Actions 会自动编译打包二进制然后发布. 可以手动填写该发布的 Release Notes.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
gpu

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL