Skip to content

[doc] chore: Add CANN install commands in ascend quick_start docs.#4488

Open
orangeH25 wants to merge 1 commit intoverl-project:mainfrom
orangeH25:docs/0
Open

[doc] chore: Add CANN install commands in ascend quick_start docs.#4488
orangeH25 wants to merge 1 commit intoverl-project:mainfrom
orangeH25:docs/0

Conversation

@orangeH25
Copy link

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-npu repository, 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

  • Search for similar PRs. Paste at least one query link here: ...
  • Format the PR title as [{modules}] {type}: {description} (This will be checked by the CI)
    • {modules} include fsdp, megatron, sglang, vllm, rollout, trainer, ci, training_utils, recipe, hardware, deployment, ray, worker, single_controller, misc, perf, model, algo, env, tool, ckpt, doc, data
    • If this PR involves multiple modules, separate them with , like [megatron, fsdp, doc]
    • {type} is in feat, fix, refactor, chore, test
    • If this PR breaks any API (CLI arguments, config, function signature, etc.), add [BREAKING] to the beginning of the title.
    • Example: [BREAKING][fsdp, megatron] feat: dynamic batching

Test

For changes that can not be tested by CI (e.g., algorithm implementation, new model support), validate by experiment(s) and show results like training curve plots, evaluation results, etc.

API and Usage Example

Demonstrate how the API changes if any, and provide usage example(s) if possible.

# Add code snippet or script demonstrating how to use this

Design & Code Changes

Demonstrate the high-level design if this PR is complex, and list the specific changes.

Checklist Before Submitting

Important

Please check all the following items before requesting a review, otherwise the reviewer might deprioritize this PR for review.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +55 to +77
# 安装所需的 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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 910b device 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

@orangeH25
Copy link
Author

Hi @FightingZhen, please take a look, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants