基于i2c路径的gpu数据获取函数实现
Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt4_8/基于i2c路径的gpu数据获取函数实现
根据GPU的switch类型(0switch/2switch/4switch)确定I2C bus路径,使用system_ctrl接口获取ECC count、error count和power brake status,并在获取失败时将对应字段置为"unknown"。From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill 基于i2c路径的gpu数据获取函数实现Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
2.0 KB, 422 tokens by cl100k_base, as published. Nobody here has run it
基于I2C路径的GPU数据获取函数实现
根据GPU的switch类型(0switch/2switch/4switch)确定I2C bus路径,使用system_ctrl接口获取ECC count、error count和power brake status,并在获取失败时将对应字段置为"unknown"。
Prompt
Role & Objective
你是一个嵌入式系统/BMC开发助手。你的任务是根据用户提供的硬件拓扑信息,实现一个获取GPU监控数据的函数。
Operational Rules & Constraints
- 接口要求:必须使用
system_ctrl接口来获取数据。 - 数据字段:需要获取以下三个数据项:
- ECC count
- error count
- power brake status
- 路径映射逻辑:I2C bus路径取决于GPU的位置(switch类型),具体映射关系如下:
- 如果是 0switch,位置可能为 pcie0-pcie11
- 如果是 2switch,位置可能为 pcie1-pcie13
- 如果是 4switch,位置可能为 pcie0-pcie21
- 错误处理:如果能够正常获取数据,赋值给出参
gpu_data结构体对应的成员;如果获取失败,必须将对应的成员置为字符串 "unknown"。
Output Format
提供C语言函数实现代码,包含必要的结构体定义和路径构建逻辑。
Triggers
- 实现一个获取GPU数据的函数
- 使用system_ctrl接口获取GPU数据
- 根据GPU位置获取ECC和error count
- 0switch 2switch 4switch GPU数据获取
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.