kali20gakki/msAgent / skills/host-cpu/msagent-perf-cpu-bind-tune
msagent-perf-cpu-bind-tune
Flagged昇腾 NPU 多卡任务的 Host CPU 绑核方案求解器:覆盖 PyTorch 训练/离线推理与 vLLM-Ascend、SGLang 推理服务的 rank/worker/engine 分核,基于 NUMA 拓扑与 卡↔进程映射输出可执行、可回滚、可验证的绑核计划(taskset 前缀 / cpuset / OMP 环境变量),自动判定事前(env 片段)与事中(在线 sched_setaffinity)双形态。 触发:绑核方案、核怎么分、per-rank 绑核、NUMA 绑定方案、cpuset 划分、多卡分核、 CPU range 冲突、TTFT 或吞吐受 CPU 影响。 不用于:绑核没生效/绑核异常诊断(→ perf-cpu-config-audit);运行期是否落核 (→ perf-cpu-tracing);变慢根因归因(→ perf-cpu-perf-triage)。
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 10.1 KB |
| references/checks.md | markdown | 1.4 KB |
| references/framework-profiles.md | markdown | 5.1 KB |
| references/mechanisms.md | markdown | 2.8 KB |
| references/permissions.md | markdown | 5.4 KB |
| references/process-roles.md | markdown | 2.8 KB |
| resources/plan_template.json | config | 4.7 KB |
| resources/report.css | other | 7.6 KB |
| resources/report_template.html | other | 3.9 KB |
| scripts/apply_plan.py | script | 11.8 KB |
| scripts/cpu_list.py | script | 1.4 KB |
| scripts/discover.py | script | 16.8 KB |
| scripts/emit_plan.py | script | 19.8 KB |
| scripts/feasibility.py | script | 4.7 KB |
| scripts/model.py | script | 9.5 KB |
| scripts/npu_query.py | script | 16.2 KB |
| scripts/plan.py | script | 10.7 KB |
| scripts/preflight.py | script | 5.0 KB |
| scripts/procfs.py | script | 9.0 KB |
| scripts/report.py | script | 31.0 KB |
| scripts/roles.py | script | 1.5 KB |
| scripts/topology.py | script | 16.8 KB |
| scripts/unit_alloc.py | script | 8.2 KB |
| scripts/verify_config.py | script | 5.7 KB |
| scripts/workspace.py | script | 2.5 KB |
| scripts/zone_alloc.py | script | 3.7 KB |
resources/plan_template.json
View on GitHub{
"schema_version": "hostcpu-plan/1",
"plan_id": "hostcpu-plan-<host>-<ts>",
"host": "<host>",
"ts_ns": 0,
"mode": "host|container|cluster",
"form": "in_run|pre_run",
"fabric": "ub|hccs_supernode|pcie|unknown",
"locality_mode": "topo_affinity|global_slice|unknown",
"privilege": {
"current_user": "<user>",
"current_uid": 1000,
"is_root": false,
"target_uids": [0],
"own_processes": false,
"can_read_numa_maps": false,
"can_taskset": false,
"requires_privilege": true,
"execution_mode": "delegated|self|plan_only",
"notes": []
},
"topology_ref": {
"source": "self.topology",
"schema": "static-snapshot/topology",
"hash": "<hash>"
},
"executable": true,
"plan_file": "hostcpu_plan_<host>_<ts>.json",
"apply": {
"script": "<skill>/scripts/apply_plan.py",
"command": "python3 <skill>/scripts/apply_plan.py <plan.json> --roles comm,io",
"rollback": "python3 <skill>/scripts/apply_plan.py <plan.json> --rollback",
"roles": "comm,io",
"bind_compute": false,
"dynamic_task_scan": true,
"cgroup_clip": true
},
"before": {
"container_cpuset": "<cpuset>",
"source": "/proc/<pid>/cgroup"
},
"policy": {
"smt": "exclusive",
"irq_reserve_per_node": 2,
"interference_reserve_per_node": 1
},
"zones": {
"<node>": {
"node": 0,
"cpulist": "<cpus>",
"system_irq": "<cpus>",
"interference": "<cpus>",
"business": "<cpus>",
"unit_ids": []
}
},
"units": [
{
"unit_id": 0,
"unit_type": "rank|instance",
"framework": "vllm|sglang|verl|megatron|mindspeed|unknown",
"pid": 0,
"pids": [],
"primary_npu": 0,
"npus": [],
"npus_significant": [],
"numa_node": 0,
"target_node_source": "topo_affinity|global_slice|none",
"npu_affinity": "<cpus>",
"current_node": 0,
"current_affinity": "<cpus>",
"target_uid": 0,
"is_own_process": false,
"requires_privilege": true,
"evidence_level": "full|affinity+last_cpu|affinity_only|npu_smi_only",
"last_cpu": 0,
"last_cpu_node": 0,
"mems_allowed": "0-7",
"cgroup_mems": "0-7",
"cpuset": "<cpus>",
"main_cpuset": "<cpus>",
"compute_cpuset": "<cpus>",
"work_cpuset": "<cpus>",
"thread_binding": [
{"role": "main", "match_comm": [], "cpuset": "<cpus>", "apply": "exec", "note": "主线程(tid == pid)"},
{"role": "comm", "match_comm": ["hccl", "aoe_rtkb"], "cpuset": "<cpus>", "apply": "exec|skip", "note": ""},
{"role": "io", "match_comm": ["zmq", "tokenizer", "detokenizer", "dataloader", "network"], "cpuset": "<cpus>", "apply": "exec|skip", "note": ""},
{"role": "compute", "match_comm": ["vllm", "caffe", "python", "pt_autograd", "acl_thread", "compl", "omp"], "cpuset": "<cpus>", "apply": "exec", "note": "绑定到 compute 核集,与 OMP_NUM_THREADS 核数一致"}
],
"roles": {
"compute": {"cpus": "<cpus>", "cores": 0, "threads": 0},
"comm": {"cpus": "<cpus>", "cores": 0, "threads": 0},
"io": {"cpus": "<cpus>", "cores": 0, "threads": 0},
"main": {"cpus": "<cpus>", "cores": 0, "threads": 0}
},
"env": {
"OMP_NUM_THREADS": "0",
"OMP_PROC_BIND": "close",
"OMP_PLACES": "cores"
},
"mechanism": "sched_setaffinity|launch_wrapper|cpuset",
"command_source": "runtime_task_scan|user|env_only",
"commands": [],
"before": {
"Cpus_allowed_list": "<cpus>",
"cgroup_cpuset": "<cpus>",
"source": "/proc/<pid>/status"
},
"rollback": [],
"deviations": [],
"capacity_gap": 0
}
],
"baseline": {
"metrics": {
"sched_delay_p99_us": null,
"migration_per_s": null,
"remote_page_ratio": null,
"step_time_ms": null
},
"source": "none",
"window": null
},
"verify": {
"config_effective": {
"commands": [
"grep -m1 '^Cpus_allowed_list:' /proc/<pid>/status"
]
},
"runtime": {
"consumer": "tracing --plan <plan.json>",
"check": "units[].roles[].cpus 落核/迁移/越界"
},
"effect": {
"metrics": ["sched_delay_p99_us", "remote_page_ratio", "migration_per_s"],
"threshold": "改善 ≥ 收益上限的 30%",
"window": "同参数复采"
}
},
"expected_effect": {
"level": "high|medium|low",
"basis": [],
"upper_bound": ""
},
"verify_script": "hostcpu_verify_<host>_<ts>.sh",
"report": "hostcpu_report_<host>_<ts>.html",
"unresolved": [],
"warnings": [],
"findings": [],
"flags": {
"smt_shared": false,
"oversubscribed": false,
"cross_numa": false,
"l3_split": false,
"view_limited": false
},
"notes": []
}
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: 471k | 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: 471k | 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: 471k | 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 |