# CANN Practices for 310B **Repository Path**: wjc885/cann-practices-for-310-b ## Basic Information - **Project Name**: CANN Practices for 310B - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-11-17 - **Last Updated**: 2025-11-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # CANN Practices for 310B (Orange Pi) ------------------------------------------------------------------------ ## Introduction This document records the **CANN-based operator development workflow** on the **Orange Pi 310B**. Currently supported: - ✔ Ascend C operator development\ - ✔ TBE & AI CPU operator development\ - ✘ BiSheng compiler (not supported on 310B) Official documentation reference:\ [CANN Community Documentation](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/83RC1/index/index.html) ------------------------------------------------------------------------ ## Ascend C Operator Development ### What is Ascend C? **Ascend C** is a programming language launched by CANN for operator development: - Compatible with C/C++ - High development efficiency - Can run directly on Ascend AI processors - Achieves high performance through compiler and runtime scheduling ### Environment Preparation Development methods: - Development directly on the **Orange Pi device** - Or development on an **x86/aarch64 server** - ⚠ For **x86 architecture**, a cross-compilation toolchain must be installed 1. Download Toolkit and Kernels CANN download link:\ https://www.hiascend.com/developer/download/community/result?module=cann&cann=8.3.RC1 MEGA download link:\ https://mega.nz/folder/gY0WBIjB#oZ_ur_kplKUk3CDQb6GR7A Example installation packages:\ Toolkit: Ascend-cann-toolkit_8.1.RC1_linux-aarch64.run\ Kernels: Ascend-cann-kernels-310b_8.1.RC1_linux-aarch64.run 2. Install Dependencies ``` bash // CANN supports Python 3.7.x to 3.11.4. Orange Pi uses dnf as the package manager // you may need to update system time. sudo yum install -y python3 python3-pip sudo yum install -y gcc gcc-c++ pip3 install attrs cython 'numpy>=1.19.2,<=1.24.0' decorator sympy cffi pyyaml pathlib2 psutil 'protobuf==3.20.0' 'scipy<=1.15' requests absl-py ``` 3. Install Toolkit ``` bash // Add permission chmod +x Ascend-cann-toolkit_8.1.RC1_linux-aarch64.run // Install (may take 10–20 minutes) ./Ascend-cann-toolkit_8.1.RC1_linux-aarch64.run --install // Configure environment variables // Default installation path for root: /usr/local/Ascend source ${HOME}/Ascend/ascend-toolkit/set_env.sh ``` 4. Install Kernels ``` bash // Add permission chmod +x Ascend-cann-kernels-310b_8.1.RC1_linux-aarch64.run // Install ./Ascend-cann-kernels-310b_8.1.RC1_linux-aarch64.run --install ``` 5. Install cmake ``` bash // Orange Pi can install it directly using dnf dnf install cmake ``` ### Hello World! 1. Get the sample repository [Sample code!](https://gitee.com/ascend/samples/tree/master/operator/ascendc/0_introduction/0_helloworld) The repo contains many example projects, but some are not compatible with the 310B device. 2. Install dependencies ``` bash dnf install binutils gcc gcc-c++ make cmake -y ``` 3. Compile with cmake ``` bash // Enter the sample directory cd samples/operator/ascendc/0_introduction/0_helloworld/ // Configure environment variables source ${HOME}/Ascend/ascend-toolkit/set_env.sh // Build and run bash run.sh -v 310B1 ```