Environment Setup Guide
This section describes how to burn an image on OrangePi AIpro, customize the installation of CANN and MindSpore, and configure the runtime environment.
1. Image Burning (Taking Windows as an example)
Image burning can be performed in any operating system. Here we will take Windows as an example to demonstrate how to quickly burn an image to your Micro SD card using the appropriate version of the balenaEtcher tool.
1.1 Preparation
Step 1 Insert the Micro SD card into the card reader and the card reader into the PC.
1.2 Downloading the Ubuntu image
Step 1 Click here to go to the mirror download page.
This is only for illustration. Different power development board image download address is different, please check here.
Step 2 Click the arrow icon in the picture to jump to the Baidu Wangpan download page.
Step 3 Select the desktop version to download, it is recommended to download the 0318 version of the environment.
Step 4 Alternative download method.
If the download from Baidu Wangpan is too slow, you can use this link to download directly.
1.3 Downloading the Tools
There are two card-making tools balenaEtcher, Rufus, and you can choose any one of the tools to burn according to your computer.
balenaEtcher:
Step 1 Download balenaEtcher.
Click here to jump to the official website, and click the green download button to jump to where the software is downloaded.
Step 2 Select to download the Portable version.
The Portable version does not require installation, so double-click it to open it and use it.
Step 3 Alternative download method.
If it is too slow to download from the official website, you can use to this link to download directly the balenaEtcher-Setup-1.18.4 software.
Step 4 Open balenaEtcher.
Rufus:
Step 1 Download Rufus
Click this link to download and install.
1.4 Selecting and Burning Images
Here we introduce balenaEtcher, Rufus to burn the image, you can burn according to the corresponding tool.
balenaEtcher burns images:
Step 1 Select Mirror, TF card, and start burn.
Select the image file to be burned (the path where the Ubuntu image downloaded in 1.2 above is saved).
Select the disk letter of the TF card.
Click Start Burning, as shown below:
It takes about 20 minutes to burn and verify, so please be patient:
Step 2 Burning is complete.
After the completion of burning, balenaEtcher is shown in the following figure, if the green indicator icon shows that the image is burned successfully, at this time you can exit balenaEtcher, pull out the TF card and insert it into the TF card slot on the development board to use:
Rufus burns images:
Step 1 Select Mirror, TF card, and start burn.
Insert the sd card into the card reader, insert the card reader into the computer, select the image and sd card, click “Start”.
Step 2 Burning is complete.
Pull out the card reader directly after the wait is over.
2. CANN Upgrading
2.1 Toolkit Upgrading
Step 1 Open a terminal and switch the root user.
Use CTRL+ALT+T
or click on the icon with $_
at the bottom of the page to open the terminal.
Switch the root user, root user password: Mind@123.
# Open a terminal on the development board and run the following command
(base) HwHiAiUser@orangepiaipro:~$ su – root
Password:
(base) root@orangepiaipro: ~#
Step 2 Remove installed CANN packages from the image to free up disk space and prevent installing new CANN packages from reporting low disk space errors.
(base) root@orangepiaipro: ~# cd /usr/local/Ascend/ascend-toolkit
(base) root@orangepiaipro: /usr/local/Ascend/ascend-toolkit # rm -rf *
Step 3 Open the official website of Ascend CANN to access the community version of the resource download address, download the required version of the toolkit package. Taking 8.0.RC2.alpha003 version as an example, as shown below:
Execute the following commands to select the aarch64 or x86_64 package according to the actual output of the environment.
uname -a
Step 4 Go to the Toolkit package download directory.
(base) root@orangepiaipro: /usr/local/Ascend/ascend-toolkit# cd /home/HwHiAiUser/Downloads
Orange Pi AI Pro browser file default download directory: /home/HwHiAiUser/Downloads, users should synchronize to modify the path in the above command when changing the save path.
Step 5 Add execution permissions to the CANN package.
(base) root@orangepiaipro: /home/HwHiAiUser/Downloads# chmod +x ./Ascend-cann-toolkit_8.0.RC2.alpha003_linux-aarch64.run
Step 6 Execute the following command to upgrade the software.
(base) root@orangepiaipro: /home/HwHiAiUser/Downloads#./Ascend-cann-toolkit_8.0.RC2.alpha003_linux-aarch64.run --install
Type Y when this prompt pops up during installation, then press Enter to continue the installation.
After the upgrade is completed, if the following message is displayed, the software upgrade is successful:
xxx install success
xxx indicates the actual package name of the upgrade.
Path after installing the upgrade (default installation path for root user as an example): “/usr/local/Ascend/ ascend-toolkit/
Step 7 Configure and load environment variables.
(base) root@orangepiaipro: /home/HwHiAiUser/Downloads # echo “source /usr/local/Ascend/ascend-toolkit/set_env.sh” >> ~/.bashrc
(base) root@orangepiaipro: /home/HwHiAiUser/Downloads # source ~/.bashrc
2.2 Kernels Upgrading
The binary arithmetic package Kernels relies on the CANN package Toolkit. To perform the upgrade, the current environment needs to have the matching version of Toolkit installed and installed by the same user.
Step 1 Open a terminal and switch the root user.
Password for root user: Mind@123.
# Open a terminal on the development board and run the following command
(base) HwHiAiUser@orangepiaipro:~$ su – root
Password:
(base) root@orangepiaipro: ~#
Step 2 Execute the following command to get the development board NPU model number.
npu-smi info
Step 3 Open the official website of Ascend CANN to access the community edition resources download address, and download the kernel package that is consistent with the CANN package version and matches the NPU model. As shown in the figure below:
Step 4 Go to the Kernels package download directory.
(base) root@orangepiaipro: /usr/local/Ascend/ascend-toolkit# cd /home/HwHiAiUser/Downloads
Default download directory of Orange Pi AI Pro browser file: /home/HwHiAiUser/Downloads
Step 5 Add execution permissions to the kernels package.
(base) root@orangepiaipro: /home/HwHiAiUser/Downloads# chmod +x ./Ascend-cann-kernels-310b_8.0.RC2.alpha003_linux.run
Step 6 Execute the following command to upgrade the software.
(base) root@orangepiaipro: /home/HwHiAiUser/Downloads#./Ascend-cann-kernels-310b_8.0.RC2.alpha003_linux.run --install
After the upgrade is completed, if the following message is displayed, the software upgrade is successful:
xxx install success
xxx indicates the actual package name of the upgrade.
Path after installing the upgrade (default installation path for root user as an example): "/usr/local/Ascend/ ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe/kernel".
3. MindSpore Upgrading
3.1 Installing the Official Version of the Website (Taking MindSpore 2.3.1 as an example)
Method 1: Open the terminal as HwHiAiUser user and run the pip install command directly in the terminal.
pip install mindspore==2.3.1
Method 2: Refer to MindSpore official website installation tutorial to install.
pip install https://ms-release.obs.cn-north-4.myhuaweicloud.com/2.3.1/MindSpore/unified/aarch64/mindspore-2.3.1-cp39-cp39-linux_aarch64.whl --trusted-host ms-release.obs.cn-north-4.myhuaweicloud.com -i https://pypi.tuna.tsinghua.edu.cn/simple
# Confirm the operating system and programming language, and the default environment of the Orange Pi development board is linux-aarch64 and python3.9
3.2 Installing the MindSpore daily Package (Using the September 11 daily Package as an Example)
The Orange Pi development board supports custom installation of MindSpore daily packages, which can be obtained from this link for the corresponding date.
Specific lookup procedure of target daily whl package is as follows:
Enter the directory prefixed with master. If there are multiple directories prefixed with master, it is recommended that you enter a directory with a later date.
Enter the unified directory.
According to the actual operating system information, enter the corresponding directory. Since the default operating system of Orange Pi board is linux-aarch64, enter the aarch64 directory. 4.
According to the actual python version information, find the corresponding daily whl package. Since the default Orange Pi board is python 3.9, the target daily package is mindspore-2.4.0-cp39-cp39-linux_aarch64.whl.
This tutorial aims to let developers experience the latest version-specific, but because the daily package is not the official release version, there may be some problems during operation. Developers can submit issues through the community, or can be modified and submit their own PR.
Download the whl package for installation and run the following command in the terminal.
# wget download whl package
wget https://repo.mindspore.cn/mindspore/mindspore/version/202409/20240911/master_20240911160029_917adc670d5f93049d35d6c3ab4ac6aa2339a74b_newest/unified/aarch64/mindspore-2.4.0-cp39-cp39-linux_aarch64.whl
# Go to the path of the whl package in the terminal and run the pip install command to install it.
pip install mindspore-2.4.0-cp39-cp39-linux_aarch64.whl