Function Overview
Install NNAL (ATB acceleration library) in the Ascend NPU environment.This skill assumes that Toolkit+Kernels have already been installed by the cann-operator-env-config skill.
When to Use
- The user has completed Toolkit+Kernels installation (via
cann-operator-env-config) and needs to install NNAL - The user needs to install NNAL in a Docker container
- The user needs to install or upgrade a specific version of NNAL
Prerequisites
The cann-operator-env-config skill must have been executed, ensuring:
- Toolkit is installed,
/usr/local/Ascend/ascend-toolkit/set_env.shexists - Kernels (ops) are installed
⚠️ Path Constraint (Must Be Enforced)
Before executing this skill,the following path must be obtained from the user:
<INSTALL_PATH>: NNAL installation target path (e.g./usr/local/Ascend)
If the user does not provide INSTALL_PATH, stop immediately and interrupt, requiring the user to provide the installation path.
Script validation example:
if [ -z "$INSTALL_PATH" ]; then
echo "ERROR: INSTALL_PATH 未设置,请提供 NNAL 安装路径。"
exit 1
fi
Detailed Content
Step 1: Check NPU Driver
npu-smi info
If npu-smi is unavailable or no NPU device is detected,stop the installation and report an error。
Step 2: Call cann-operator-env-config (if Toolkit+Kernels are not yet installed)
If Toolkit+Kernels are not yet installed, first call the cann-operator-env-config skill to install Toolkit and Kernels:
- This skill is located at
/home/s30073260/swiglu_quant/agent-skills-ivan-fork/skills/cann-operator-env-config/ - Provides 3 installation methods: offline run package, conda online, yum online
- After installation is complete, Toolkit and Kernels will be located at
/usr/local/Ascend/
Step 3: Source Toolkit Environment Variables
source /usr/local/Ascend/ascend-toolkit/set_env.sh
Key: The NNAL installation script depends on ASCEND_TOOLKIT_HOME and other environment variables, so it must be sourced first.
Verify environment variables:
echo $ASCEND_TOOLKIT_HOME
# 应输出: /usr/local/Ascend/ascend-toolkit/latest 或自定义路径
Step 4: Install NNAL
Note: The following commands use the user-provided
<INSTALL_PATH>; if not provided, the process has already been interrupted in the path constraint step.
Method 1: run package installation (recommended)
chmod +x Ascend-cann-nnal_*.run
./Ascend-cann-nnal_*.run --install --install-path="${INSTALL_PATH}"
Method 2: Extract from Docker image
CANN_IMAGE="quay.io/ascend/cann:<版本>-<芯片>-<OS>-py<Python版本>"
# 示例
# CANN_IMAGE="quay.io/ascend/cann:9.0.0-beta.2-910-openeuler24.03-py3.11"
docker create --name cann_nnal_temp "${CANN_IMAGE}"
docker cp cann_nnal_temp:/usr/local/Ascend/nnal "${INSTALL_PATH}/"
docker rm cann_nnal_temp
Step 5: Load Environment Variables
source "${INSTALL_PATH}/nnal/atb/set_env.sh"
Persist to ~/.bashrc:
cat >> ~/.bashrc << EOF
source ${INSTALL_PATH}/nnal/atb/set_env.sh
EOF
Step 6: Installation Verification
# 检查 NNAL 目录结构
ls -lh ${INSTALL_PATH}/nnal/atb/
# 验证 Toolkit 版本
cat /usr/local/Ascend/ascend-toolkit/latest/version.cfg 2>/dev/null || \
cat /usr/local/Ascend/ascend-toolkit/latest/arm64-linux/ascend_toolkit_install.info
# 验证 NNAL 版本
cat ${INSTALL_PATH}/nnal/atb/version 2>/dev/null || echo "检查 NNAL 安装目录"
# 验证关键命令
which bisheng && bisheng --version
which atc && atc --version
# 验证 NPU 状态
npu-smi info
Environment Variable Summary
After installation is complete, the following environment variables should be set correctly:
| Variable | Value | Source |
|---|---|---|
ASCEND_TOOLKIT_HOME |
/usr/local/Ascend/ascend-toolkit/latest |
set_env.sh (Toolkit) |
ATB_HOME_PATH |
${INSTALL_PATH}/nnal/atb |
set_env.sh (NNAL) |
LD_LIBRARY_PATH |
Contains ${INSTALL_PATH}/nnal/atb/lib |
set_env.sh (NNAL) |
Reference Information
| Item | Reference Value |
|---|---|
| NNAL run package size | ~500-600MB |
| Installation duration | About 5-10 minutes |
| Total (including Toolkit+Kernels) | About 15-20 minutes (3 packages ~3.6GB) |
Some run packages will ask for confirmation; use the yes | pipe to achieve non-interactive installation:
yes | ./Ascend-cann-nnal_*.run --install --install-path="${INSTALL_PATH}"
If during installation "driver package is not installed" warning appears, it is normal—Docker containers use the host driver and do not need to install the driver package.
Common Issues
Cause: NPU driver is not installed or the Docker container has not mounted the NPU device.
Solution:
- Confirm the host NPU driver is normal: on the host, run
npu-smi info - When starting the Docker container, add the
--device=/dev/davinciXparameter
Cause: The Toolkit is not installed or the set_env.sh path is incorrect.
Solution:
- Confirm that
/usr/local/Ascend/ascend-toolkit/latest/set_env.shexists - If it does not exist, go back and run
cann-operator-env-configto install Toolkit+Kernels
Cause: The installation path requires root privileges.
Solution:
# 使用 root 权限安装
sudo ./Ascend-cann-nnal_*.run --install --install-path=/usr/local/Ascend
Execution Result
⚠️ After execution, fill in: After the skill execution is complete, fill in the actual execution result according to the format below.
Checkpoint Checklist
| Step | Checkpoint Description | Status |
|---|---|---|
| 1 | NPU driver normal (npu-smi info) |
✅ PASS / ❌ FAIL / ⏭️ SKIP |
| 2 | Toolkit+Kernels installed (via cann-operator-env-config) | ✅ PASS / ❌ FAIL / ⏭️ SKIP |
| 3 | ASCEND_TOOLKIT_HOME is set |
✅ PASS / ❌ FAIL / ⏭️ SKIP |
| 4 | NNAL installed successfully | ✅ PASS / ❌ FAIL / ⏭️ SKIP |
| 5 | Environment variables loaded | ✅ PASS / ❌ FAIL / ⏭️ SKIP |
| 6 | NNAL version verification passed | ✅ PASS / ❌ FAIL / ⏭️ SKIP |
| 6 | bisheng / atc available |
✅ PASS / ❌ FAIL / ⏭️ SKIP |
| 6 | npu-smi info normal |
✅ PASS / ❌ FAIL / ⏭️ SKIP |
VERDICT: ✅ SUCCESS / ⚠️ PARTIAL / ❌ FAILED / ⏭️ SKIPPED
Issue List (if any)
| Severity | Checkpoint | Issue Description | Recommendation |
|---|---|---|---|
| 🔴 CRITICAL | - | - | - |
| 🟡 WARNING | - | - | - |
Execution Summary
- Execution Time:
- Execution Environment:
- NNAL Version:
- Duration:
- Pass Rate: