kali20gakki/msAgent / skills/host-cpu/msagent-perf-cpu-config-audit
msagent-perf-cpu-config-audit
Verified昇腾训练/推理主机的环境配置体检:对 NUMA 亲和、大页/THP、governor 频率、cgroup 限流、IRQ smp_affinity、环境变量等 8 个配置域做单点快照审计,输出分级 Finding 与可回滚修改建议,不改动运行状态。触发:检查环境、配置体检、新机器开箱、换容器、 大页没配、governor 不对、cgroup 限流、中断亲和配置、NUMA 配置检查、绑核没生效。 不用于:训练变慢/step 抖动/利用率低的根因归因(→ perf-cpu-perf-triage); 产出绑核方案(→ perf-cpu-bind-tune);运行期实际落核观测(→ perf-cpu-tracing)。
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 5.2 KB |
| references/check-items.md | markdown | 6.5 KB |
| references/process-roles.md | markdown | 1.7 KB |
| references/profiles/ascend910.json | config | 1.6 KB |
| references/profiles/kunpeng920-910b.json | config | 507 B |
| references/rules-locality.md | markdown | 2.3 KB |
| resources/report_template.html | other | 11.5 KB |
| scripts/audit.py | script | 19.6 KB |
| scripts/baseline.py | script | 4.4 KB |
| scripts/checker.py | script | 39.6 KB |
| scripts/classify.py | script | 2.7 KB |
| scripts/discover.py | script | 6.6 KB |
| scripts/npu_query.py | script | 15.0 KB |
| scripts/preflight.py | script | 3.3 KB |
| scripts/procfs.py | script | 9.0 KB |
| scripts/report.py | script | 6.4 KB |
| scripts/rules_locality.py | script | 8.7 KB |
| scripts/static_collect.py | script | 13.8 KB |
| scripts/topology.py | script | 9.4 KB |
| scripts/workspace.py | script | 2.1 KB |
references/rules-locality.md
View on GitHub# 组合诊断规则(R 系列):多检查项联合判定
> R = Rule 编号。单个检查项只给单点判定,R 规则把多项事实组合成综合结论,
> 命中后输出 Finding 并附 suggested_cpuset。编号在整体设计时一次性分配:
> R003/R004(NUMA 亲和偏差类)已移交 bind-tune,编号保留不复用,
> 因此本文档为 R001/R002/R005~R010 共 8 条。每条定义见下表。
| 编号 | 规则 | 判据(由检查项组合) | 结论 | suggested_cpuset 来源 |
| ---- | ---- | ------------------- | ---- | --------------------- |
| R001 | 进程完全未绑核 | B1 affinity = 全机 且 进程活跃 | 线程全机漂移、cache 失效 | 按 NPU 所在 node 推导 node 核集 |
| R002 | cpuset 截断 | B2 期望核 ⊄ effective | 绑核参数被容器截掉 | effective 与期望的交集 |
| R005 | 数据线程抢占计算核 | dataloader 与计算线程核集相交 | 数据线程抢计算核 | 相交核之外为 dataloader 划独立核 |
| R006 | 通信线程与计算冲突 | HCCL 与计算线程核集相交 且 通信占比高 | 通信延迟、计算被打断 | 相交核外划 1~2 物理核作通信核集 |
| R007 | 中断落在业务核 | E4 亲和相交 且 E2 业务核 IRQ > 20% | 中断打扰业务线程 | 业务核集减去 IRQ 高占比核 |
| R008 | SMT 兄弟冲突 | 关键线程与杂务 thread_siblings 相同 | 物理核执行单元争抢 | 兄弟对中取空闲侧 |
| R009 | 多 rank 核集重叠 | 各 rank cpuset 两两相交 且 核数不足 | rank 间争抢 | 按 node 均分不相交核集 |
| R010 | 隔离核未用 / 未完全绑入 | B5 隔离核 ∩ 业务核 = ∅(隔离核闲置),或业务核 ⊄ 隔离核(部分越界) | 隔离失效或核浪费 | 隔离核集或其补集 |
## Finding 输出要求
每条 R 规则命中输出一个 Finding(8 字段契约的前 4 字段由本 skill 填充):
```json
{
"finding_id": "F-R001-<host>-<ts>",
"problem": "进程完全未绑核",
"evidence": ["B1: pid 12345 Cpus_allowed_list=0-127", "..."],
"impact": "线程全机漂移、cache 失效",
"confidence": 0.9,
"root_cause": "未配置绑核",
"actions": [],
"suggested_cpuset": "0-31"
}
```
Action 一律转出 bind-tune(本 skill 不产出绑核 Action),Finding 必须附 evidence 与
suggested_cpuset。
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |