witty-compat

openEuler 南向硬件兼容性分析与 AI 推理栈部署诊断 Agent。

是什么

帮助开发者在鲲鹏、昇腾等硬件 + openEuler 上部署和诊断 AI 推理栈。内置参数化多分支安装引擎、故障案例知识库(安装时从 witty-ops-cases 拉取)、推理性能压测工具、以及 OS 级调优模块。

快速开始

git clone https://atomgit.com/openeuler/witty-compat.git ~/.config/opencode/witty-compat
cd ~/.config/opencode/witty-compat && bash install.sh

安装脚本会自动拉取案例库并构建搜索索引。

重启 OpenCode,输入 /agents 选择 compat-Agent

卸载:

bash uninstall.sh           # 移除插件/技能/Agent 注册,保留已生成数据
bash uninstall.sh --purge   # 连同 index/records/results/logs 一起删除
"检查当前环境"          → K+O+X 采集 + 兼容性匹配
"帮我部署 7B 模型"      → 多分支贪心安装 → 冒烟压测
"为什么报错了"          → 环境 diff → 知识库检索 → 修复建议

Agent 体系

Agent 职责
compat-Agent 总控,意图识别 + 路由
DeployAgent 多分支贪心部署
ValidateAgent 全量兼容性验证
DiagnoseAgent 故障诊断 + RAG 检索 + MCP 网络搜索

工具

工具 命令
env-detect python3 tools/env_detect.py --json [--remote host] [--timeout 10]
kb-match python3 tools/kb_match.py --json
kb-search python3 tools/kb_search.py --search "关键词" --json
branch-try python3 tools/branch_try.py --step torch --branch pip_nvidia_index
benchmark python3 tools/benchmark.py --json --model <M> --stream
run-ops python3 tools/run_ops.py --mode diagnose
fleet python3 tools/run_ops.py --mode fleet --hosts h1,h2
inference-cfg python3 tools/inference_config.py --model <M>

参数化安装分支

knowledge/branches/ 中的 YAML 使用模板自动匹配当前环境:

  • pip_nvidia_index--index-url cu{cuda_ver_short}(CUDA 版本自动检测)
  • source_buildTORCH_CUDA_ARCH_LIST={gpu_cc}(GPU 架构自动检测)
  • 覆盖 4 条硬件链:NVIDIA CUDA / Ascend CANN / AMD ROCm / Intel XPU

动态推理配置

提交模型路径,自动读取 config.json + GPU 信息,输出最优 vLLM 参数:

python3 tools/inference_config.py --model /home/models/DeepSeek-R1-Distill-Qwen-7B
# → tensor_parallel_size=1, max_model_len=4096, gpu_memory_utilization=0.9...

知识库

目录 内容
knowledge/branches/ 12 个 step:NVIDIA CUDA / Ascend CANN / AMD ROCm / Intel XPU / 容器 / 模型 / 推理配置
knowledge/environments/ 4 个环境矩阵(A100 / Ascend 910B / AMD ROCm / 混合环境)
knowledge/cases/ openEuler 真实故障案例(安装时克隆自 witty-ops-cases)
knowledge/community/ openEuler + MindSpore 社区文档(预爬取 400 页,安装时自动索引)

搜索基于 SQLite FTS5 + jieba 中文分词:python3 tools/kb_search.py --search "GPU驱动安装失败" --json

路径

  • 只读(代码):site-packages 或 editable 安装目录
  • 可写(数据)~/.local/share/witty-compat/(XDG 标准)
  • 环境变量覆盖:WITTY_DATA_DIR / WITTY_RESULTS_DIR / WITTY_CASES_DIR

许可证

MulanPSL-2.0