Environment Setup
Software Package Installation
- Prepare software packages based on Table 1.
Table 1 Software package list Component
Description
Toolkit
Toolkit package for development, debugging, and tuning, which contains operator tools, model tools, and app tools.
Firmware
Firmware package, which basic firmware, such as UEFI, is usually burnt into 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.
PyTorch (optional)
When using the Python APIs of PyTorch for programming, you need to install PyTorch-related software.
- Install the software package.
- Set the environment variables. The operator compilation tool depends on the AOE. Therefore, you need to configure the basic environment variables of the CANN software and the 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
Tool Acquisition
The tool is stored in the ${INSTALL_DIR} /compiler/bin/op_compiler directory.
Replace ${INSTALL_DIR} with the actual CANN component directory. If the Ascend-CANN-Toolkit package is installed as the root user, the CANN component directory is /usr/local/Ascend/ascend-toolkit/latest.