Environment Setup
Before developing in graph mode, set up the environment by installing the required software packages and configuring environment variables. This section details the setup procedure.
Installing the Driver, Firmware, and CANN Package
Set up the hardware environment with Ascend AI Processor by referring to CANN Software Installation Guide. Ensure that the CANN Toolkit and ops operator package have been installed. (For 8.5.0 and later versions, when building a graph into an offline model, you must install the ops operator package that matches the target Ascend AI Processor. Otherwise, the build will fail.) After the installation, you can find:
- ${INSTALL_DIR}/opp/built-in/op_graph/inc provides the CANN operator prototype definitions, which are used for building a graph from operator prototypes.
- ${INSTALL_DIR}/include/graph provides an API for building graphs.
- ${INSTALL_DIR}/include/ge provides an API for running graphs.
- ${INSTALL_DIR}/<arch>-linux/devlib provides related dependency libraries. <arch> indicates the OS architecture.
Replace ${INSTALL_DIR} with the CANN component directory. For example, if the installation is performed by the root user, the default file storage path is /usr/local/Ascend/cann.
Set Environment Variables
- Required environment variables
After the CANN package is installed, log in to the environment as the CANN operating user and execute the following environment variables:
source /usr/local/Ascend/cann/set_env.sh/usr/local/Ascend/ is the default installation path for the root user. Replace it with the actual one.
- Optional environment variables
If you want the files generated during program compilation and running to be stored in a unified directory, you can set the environment variables ASCEND_CACHE_PATH and ASCEND_WORK_PATH to storage paths of shared files and process-exclusive files, respectively.
export ASCEND_CACHE_PATH=/repo/task001/cache export ASCEND_WORK_PATH=/repo/task001/172.16.1.12_01_03