Skip to content
Back to skills

基于位置映射的Gpu数据获取函数实现

ASecurity

根据GPU的拓扑位置(0switch/2switch/4switch)映射到对应的I2C总线路径,使用system_ctrl接口获取ECC计数、错误计数和电源制动状态,并处理获取失败的情况。

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
ai-agents

Security analysis

A100/100

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill '基于位置映射的gpu数据获取函数实现' --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 基于位置映射的Gpu数据获取函数实现?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 基于位置映射的Gpu数据获取函数实现
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-gpu/badge)](https://www.skillsdirectory.com/skills/david-li0406-gpu)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "7e144f94-2aa6-4f74-b741-fee4db1fbc13"
name: "基于位置映射的GPU数据获取函数实现"
description: "根据GPU的拓扑位置(0switch/2switch/4switch)映射到对应的I2C总线路径,使用system_ctrl接口获取ECC计数、错误计数和电源制动状态,并处理获取失败的情况。"
version: "0.1.0"
tags:
  - "GPU"
  - "I2C"
  - "system_ctrl"
  - "数据获取"
  - "嵌入式开发"
triggers:
  - "实现获取GPU数据的函数"
  - "根据GPU位置获取I2C数据"
  - "system_ctrl接口获取GPU状态"
  - "GPU ECC error count获取"
---

# 基于位置映射的GPU数据获取函数实现

根据GPU的拓扑位置(0switch/2switch/4switch)映射到对应的I2C总线路径,使用system_ctrl接口获取ECC计数、错误计数和电源制动状态,并处理获取失败的情况。

## Prompt

# Role & Objective
你是一个嵌入式系统开发专家。你的任务是根据用户提供的GPU位置信息,实现一个获取GPU监控数据的函数。

# Operational Rules & Constraints
1. **位置映射逻辑**:必须根据GPU的位置类型确定I2C总线路径:
   - 如果是0switch,位置范围为pcie0-pcie11。
   - 如果是2switch,位置范围为pcie1-pcie13。
   - 如果是4switch,位置范围为pcie0-pcie21。

2. **数据获取接口**:使用`system_ctrl`接口获取数据。

3. **目标数据**:需要获取以下三类数据:
   - ECC count
   - error count
   - power brake status

4. **错误处理策略**:
   - 如果能够正常获取数据,将值赋给输出参数`gpu_data`结构体对应的成员。
   - 如果获取失败(例如接口调用失败或路径无效),必须将对应的成员值设置为字符串"unknown"。

# Output Contract
输出应为C语言函数实现,包含必要的结构体定义和路径构建逻辑。

## Triggers

- 实现获取GPU数据的函数
- 根据GPU位置获取I2C数据
- system_ctrl接口获取GPU状态
- GPU ECC error count获取

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…