[doc] chore: Add CANN install commands in ascend quick_start docs.#4488
[doc] chore: Add CANN install commands in ascend quick_start docs.#4488orangeH25 wants to merge 1 commit intoverl-project:mainfrom
Conversation
|
|
There was a problem hiding this comment.
Code Review
This pull request adds CANN installation commands to the Ascend quick start documentation, which is a helpful addition for users. My review focuses on improving the provided shell script for better maintainability, clarity, and robustness. I've suggested refactoring the script to use variables for versions and filenames, explicitly highlighting the device-specific part for the user to configure, and adding cleanup steps for downloaded files. These changes will make the guide easier to follow and maintain.
| # 安装所需的 Python 包 | ||
| pip install -i https://pypi.tuna.tsinghua.edu.cn/simple attrs 'numpy<2.0.0' decorator sympy cffi pyyaml pathlib2 psutil protobuf scipy requests absl-py wheel typing_extensions | ||
|
|
||
| # 下载并安装 CANN 工具包 | ||
| wget --header="Referer: https://www.hiascend.com/" https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN%208.3.RC1/Ascend-cann-toolkit_8.3.RC1_linux-"$(uname -i)".run | ||
| chmod +x ./Ascend-cann-toolkit_8.3.RC1_linux-"$(uname -i)".run | ||
| ./Ascend-cann-toolkit_8.3.RC1_linux-"$(uname -i)".run --full | ||
|
|
||
| # 配置 CANN 环境变量 | ||
| source /usr/local/Ascend/ascend-toolkit/set_env.sh | ||
|
|
||
| # 下载并安装对应设备型号的 CANN 内核包(kernels),例如:910B | ||
| wget --header="Referer: https://www.hiascend.com/" https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN%208.3.RC1/Ascend-cann-kernels-910b_8.3.RC1_linux-"$(uname -i)".run | ||
| chmod +x ./Ascend-cann-kernels-910b_8.3.RC1_linux-"$(uname -i)".run | ||
| ./Ascend-cann-kernels-910b_8.3.RC1_linux-"$(uname -i)".run --install | ||
|
|
||
| # 下载并安装 NNAL(ATB)组件 | ||
| wget --header="Referer: https://www.hiascend.com/" https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN%208.3.RC1/Ascend-cann-nnal_8.3.RC1_linux-"$(uname -i)".run | ||
| chmod +x ./Ascend-cann-nnal_8.3.RC1_linux-"$(uname -i)".run | ||
| ./Ascend-cann-nnal_8.3.RC1_linux-"$(uname -i)".run --install | ||
|
|
||
| # 配置 NNAL (ATB) 环境变量 | ||
| source /usr/local/Ascend/nnal/atb/set_env.sh |
There was a problem hiding this comment.
The installation script can be improved for better maintainability and user experience.
- Maintainability: The script repeats long filenames and version strings multiple times. Using variables for these would make it much easier to update in the future.
- User Experience: The script hardcodes the
910bdevice for the CANN kernels package. While there's a comment, a user might miss it and run into issues if they have different hardware. It's better to make this a clearly defined variable that the user is instructed to change. - Cleanliness: The script downloads several large installer files but doesn't clean them up after installation. It's good practice to remove them to save disk space.
Here is a suggested refactoring of the script that addresses these points:
# 安装所需的 Python 包
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple attrs 'numpy<2.0.0' decorator sympy cffi pyyaml pathlib2 psutil protobuf scipy requests absl-py wheel typing_extensions
# 定义版本和架构变量,方便后续更新
CANN_VERSION="8.3.RC1"
ARCH="$(uname -i)"
BASE_URL="https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN%20${CANN_VERSION}"
WGET_CMD="wget --header='Referer: https://www.hiascend.com/'"
# 下载、安装并清理 CANN 工具包
TOOLKIT_FILE="Ascend-cann-toolkit_${CANN_VERSION}_linux-${ARCH}.run"
${WGET_CMD} "${BASE_URL}/${TOOLKIT_FILE}"
chmod +x ./${TOOLKIT_FILE}
./${TOOLKIT_FILE} --full
rm ./${TOOLKIT_FILE}
# 配置 CANN 环境变量
source /usr/local/Ascend/ascend-toolkit/set_env.sh
# 下载、安装并清理 CANN 内核包(kernels)
# 注意:请根据您的设备型号修改 KERNELS_DEVICE,例如:910b, 910c, a3
KERNELS_DEVICE="910b"
KERNELS_FILE="Ascend-cann-kernels-${KERNELS_DEVICE}_${CANN_VERSION}_linux-${ARCH}.run"
${WGET_CMD} "${BASE_URL}/${KERNELS_FILE}"
chmod +x ./${KERNELS_FILE}
./${KERNELS_FILE} --install
rm ./${KERNELS_FILE}
# 下载、安装并清理 NNAL(ATB)组件
NNAL_FILE="Ascend-cann-nnal_${CANN_VERSION}_linux-${ARCH}.run"
${WGET_CMD} "${BASE_URL}/${NNAL_FILE}"
chmod +x ./${NNAL_FILE}
./${NNAL_FILE} --install
rm ./${NNAL_FILE}
# 配置 NNAL (ATB) 环境变量
source /usr/local/Ascend/nnal/atb/set_env.sh
|
Hi @FightingZhen, please take a look, thanks! |
What does this PR do?
This PR added the direct installation commands for CANN to ascend quick_start docs.
Previously, the guide only linked to the
torch-npurepository, where users still had to follow additional links and navigate through multiple pages to locate the actual CANN installation instructions.By including the CANN commands here, users can install CANN directly.
Checklist Before Starting
[{modules}] {type}: {description}(This will be checked by the CI){modules}includefsdp,megatron,sglang,vllm,rollout,trainer,ci,training_utils,recipe,hardware,deployment,ray,worker,single_controller,misc,perf,model,algo,env,tool,ckpt,doc,data,like[megatron, fsdp, doc]{type}is infeat,fix,refactor,chore,test[BREAKING]to the beginning of the title.[BREAKING][fsdp, megatron] feat: dynamic batchingTest
API and Usage Example
# Add code snippet or script demonstrating how to use thisDesign & Code Changes
Checklist Before Submitting
Important
Please check all the following items before requesting a review, otherwise the reviewer might deprioritize this PR for review.
pre-commit install && pre-commit run --all-files --show-diff-on-failure --color=alwaysci-requestchannel in theverlSlack workspace. (If not accessible, please try the Feishu group (飞书群).)