Before You Start
Environment Setup
- Prepare software packages based on the Table 1.
Table 1 Software package list Component
Description
Toolkit
Toolkit package for development, debugging, and tuning, which contains operator tools, model tools, and application tools.
Firmware
Firmware package, in which basic firmware, such as UEFI, is usually burnt into the package during device production. Firmware can also be upgraded by installing this package in a later stage.
Driver
Driver package, which is used for interaction, scheduling, and transfer between the host and device. This package contains the device manager, query driver, graph execution task scheduling driver, training data transfer preprocessing driver, and AI CPU operator loading and execution driver.
- Install the software package. Install the Driver, Firmware, Ascend-CANN-Toolkit, by referring to CANN Software Installation Guide.
- Configure the environment variable. The current operator compiler depends on the AOE tool. Therefore, you need to set basic CANN environment variables and environment variables required by the AOE tool.
- Basic environment variables of the CANN software
The CANN portfolio provides a process-level environment variable setting script to automatically set environment variables. The following commands are used as examples, in which the default installation paths are under the root or non-root user. Replace them with actual installation paths.
# Install Toolkit as the root user. . /usr/local/Ascend/ascend-toolkit/set_env.sh # Install Toolkit as a non-root user. . ${HOME}/Ascend/ascend-toolkit/set_env.sh - AOE depends on Python. Take Python 3.7.5 as an example. Run the following commands as the running user to configure the environment variables related to Python 3.7.5:
# Set the Python 3.7.5 library path. export LD_LIBRARY_PATH=/usr/local/python3.7.5/lib:$LD_LIBRARY_PATH # If multiple Python 3 versions exist in the user environment, use Python 3.7.5. export PATH=/usr/local/python3.7.5/bin:$PATH
Replace the Python 3.7.5 installation path based on the actual requirements. You can also write the preceding commands to the ~/.bashrc file and run the source ~/.bashrc command to make the modification take effect immediately.
- Before tuning, you can configure other optional environment variables by referring to the following example. For details, see Table 2.
export ASCEND_DEVICE_ID=0 export TUNE_BANK_PATH=/home/HwHiAiUser/custom_tune_bank export TE_PARALLEL_COMPILER=8 export REPEAT_TUNE=False
You can write the commands for configuring environment variables to the custom script for future use.
- Basic environment variables of the CANN software
- In the debug build compilation scenario, you need to install the binary packages installed in the actual scenario in advance, including static and dynamic binary packages.
Tool Acquisition
The tool is stored in the ${install_path}/compiler/bin/op_compiler directory.
Replace ${install_path} with the path for storing files after the CANN package is installed. For example, if the Ascend-CANN-Toolkit package is installed, the file path is $HOME/Ascend/ascend-toolkit/latest.