Operator Building
After the custom operator project is built, an OPP runfile installer (a .run file) is generated. You do not need to modify the build script.
TensorFlow
- Go to the TensorFlow custom operator project directory op/tensorflow as the HwHiAiUser user (running user) and run the following command to create a directory for storing build result files. The directory name is user-defined.
mkdir build_out
- Set the environment variable.Run the export command to declare environment variables on the shell terminal. The environment variables become invalid when the terminal is closed.
export ASCEND_TENSOR_COMPLIER_INCLUDE=/home/HwHiAiUser/Ascend/ascend-toolkit/latest/atc/include export SYSTEM_INFO=centos_x86_64
- ASCEND_TENSOR_COMPLIER_INCLUDE specifies the path of the ATC header files. Set it to the actual one.
- SYSTEM_INFO specifies the form name of the generated OPP runfile after build. Set it as needed.See the following examples:
- If the SYSTEM_INFO environment variable is not set, the form name is automatically obtained based on the OS and architecture configuration.
- Go to the build_out directory created in 1 and run the cmake command to generate the build configuration file of your custom operator project:
cd build_out
cmake .. -DCMAKE_CXX_COMPILER=g++
- Build your operator project:
make
After successful build, an OPP runfile custom_opp_<target os>_<target architecture>.run is generated in the build_out directory.
The generated OPP contains all operators in the custom operator project directory.