目录

Operator Project Build

After an operator is developed on the kernel and host, you need to build the operator project and deploy the custom operator to the OMG tool. The build operations are as follows:

The following figure shows the build process.

Figure 1 Building an operator project

Build Procedure

  1. Complete the project build configuration.

    Modify cacheVariables in CMakePresets.json under the project directory. The content of the CMakePresets.json file is as follows:

    {
        "version": 1,
        "cmakeMinimumRequired": {
            "major": 3,
            "minor": 19,
            "patch": 0
        },
        "configurePresets": [
            {
                "name": "default",
                "displayName": "Default Config",
                "description": "Default build using Unix Makefiles generator",
                "generator": "Unix Makefiles",
                "binaryDir": "${sourceDir}/build_out",
                "cacheVariables": {
                    "CMAKE_BUILD_TYPE": {
                        "type": "STRING",
                        "value": "Release"
                    },
                    "ASCEND_COMPUTE_UNIT": {
                        "type": "STRING",
                        "value": "kirin9020"
                    },
                    "vendor_name": {
                        "type": "STRING",
                        "value": "customize"
                    },
                    "ASCEND_PYTHON_EXECUTABLE": {
                        "type": "STRING",
                        "value": "python3"
                    },
                    "CMAKE_INSTALL_PREFIX": {
                        "type": "PATH",
                        "value": "${sourceDir}/build_out"
                    }
                }
            }
        ]
    }

    Table 1 Common parameters to be configured by developers

    Parameter Description Default Value
    CMAKE_BUILD_TYPE

    Build mode options:

    - Release: release version, which does not contain debugging information. The final release version is compiled.

    - Debug: debug version, which contains debugging information for you to develop and debug.

    Release
  2. Run the following command in the operator project directory to build the operator project:

    ./build.sh

    After the build is successful, the build_out directory is created in the current directory, and the custom operator deliverables generated in the build_out directory are installed in tools_omg.

    To build the operator kernel separately, run the following command in the operator project:

    ./build_devices.sh

    To save build process logs, use the environment variable ASCENDC_BUILD_LOG_DIR to control the storage path.

    # To store build logs in **/home/build_log/**, do as follows and disable log storage by default.
    export ASCENDC_BUILD_LOG_DIR=/home/build_log/