skills/triton-operator-env-config/SKILL.md
在 Ascend 昇腾平台上校验并构建triton算子开发所需环境,包括CANN、Python/torch/torch_npu/triton-ascend依赖和PATH环境变量等设置。当用户需要配置triton算子开发环境、检查CANN/torch/triton-ascend安装、验证环境是否可用时使用。
npx skillsauth add Ascend/agent-skills triton-operator-env-configInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
必须按顺序执行环境检查,每个步骤依赖前一步的成功。
配套版本可能更新,必须先获取官方最新文档。
MANDATORY - READ ENTIRE PAGE:访问并完整阅读官方在线文档 https://triton-ascend.readthedocs.io/zh-cn/latest/quick_start.html 和 https://triton-ascend.readthedocs.io/zh-cn/latest/installation_guide.html,获取最新的:
以文档中的版本要求为准,更新后续步骤中的版本号。
以下版本对应关系仅供参考(截止 2026-03-26),以在线文档为准:
| Triton-Ascend 版本 | CANN 版本 | 发布日期 | |-------------------|----------|---------| | 3.2.0 | 8.5.0(推荐) | 2026/01/16 | | 3.2.0rc4 | 8.3.RC2 | 2025/11/20 |
torch_npu 版本(仅供参考):2.7.1
⚠️ 如果在线文档中的版本与上表不一致,必须以在线文档为准。
必须最先检查 CANN 环境
npu-smi info,检查是否成功加载驱动which bisheng,检查是否成功加载CANN环境获取到npuir编译器,应该输出路径source /usr/local/Ascend/cann/set_env.shsource /usr/local/Ascend/ascend-toolkit/set_env.sh如果遇到python问题,最优先使用miniconda创建环境解决
which python3export PATH="/usr/bin:$PATH"python3 --version,以官方 quick_start.md 文档中的要求为准conda init bash检查是否有conda环境,有则跳转第5步,如果没有则执行第2步安装uname -m确认当前系统架构
如果系统架构为aarch64,执行:wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh
如果系统架构为x86_64,执行:wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.shbash Miniconda3-latest-Linux-x86_64.sh或bash Miniconda3-latest-Linux-aarch64.sh,按照提示安装后激活miniconda环境conda init bashconda create -n triton python=<官方要求版本>conda activate triton必须保证前面的步骤都成功
pip list | grep "torch"pip install torch==<官方要求版本>ERROR: No matching distribution found for torch==2.7.1+cpu,尝试:
pip install torch==2.7.1+cpu --index-url https://download.pytorch.org/whl/cpu
pip install torch_npu==<官方要求版本>python3 -c "import torch; print(torch.__version__)"python3 -c "import torch; a = torch.randn(2, 3); print(a)",应该输出类似结果:tensor([[2.86, 1.0406, 1.5811], [0.8329, 1.0024, 1.3639]])pip list | grep "triton"pip uninstall tritonpip install triton-ascend用于确认当前终端环境可以正常执行triton算子。
MANDATORY - READ ENTIRE FILE:在执行验证前,必须完整阅读 scripts/01-vector-add.py。
执行验证:
python3 <skill-dir>/scripts/01-vector-add.py
执行该算子样例后,如出现类似结果则表明其计算符合预期,difference为0.0则视为验证通过:
tensor([0.8329, 1.0024, 1.3639, ..., 1.0796, 1.0406, 1.5811], device='npu:0')
tensor([0.8329, 1.0024, 1.3639, ..., 1.0796, 1.0406, 1.5811], device='npu:0')
The maximum difference between torch and triton is 0.0
| 现象 | 动作 |
|------|------|
| torch 安装失败:No matching distribution found for torch==2.7.1+cpu | 尝试从 PyTorch 官方源安装:pip install torch==2.7.1+cpu --index-url https://download.pytorch.org/whl/cpu |
| 同时安装了原生 triton 和 triton-ascend | 先卸载原生 triton:pip uninstall triton,再重新安装 triton-ascend |
| 找不到 C++ compiler | 安装编译器:apt-get install g++ |
| 需要从源码编译时缺少依赖 | 安装系统库:sudo apt install zlib1g-dev clang-15 lld-15(推荐 clang >= 15, lld >= 15) |
| 已按上表重试仍失败 | 保留完整终端报错与已执行的命令序列,便于本地或后续排查 |
testing
Kubernetes 集群健康检查与安全修复 — 诊断问题,用户确认后执行修复
tools
昇腾NPU CANN Toolkit+Kernels+NNAL安装部署技能。支持从官网下载run包安装和从Docker镜像提取两种方式,覆盖驱动检查、包下载、安装、环境变量配置与验证全流程。当用户需要安装CANN全套组件或指定版本CANN到自定义路径时调用。
development
编译 ATB (Ascend Transformer Boost) 测试框架。当用户需要编译 ATB 测试框架、 运行 CSV 测试、或构建 atb_test_framework 时调用。支持全量编译(含第三方依赖克隆与源替换) 和增量编译两种模式。需在 Docker 容器内配合 CANN 环境执行。
databases
ATB OPS→ACLNN 迁移标准化工作流主模板。整合前置学习、设计文档生成、CSV用例设计、 实际迁移、编译验证、测试验证全流程,提供明确的阶段 Gates 和用户确认机制。