--singleop

Applicable Products

All processors

Description

Converts a single-operator description file (.json) into an offline model adapted to the AI processor for operator functional verification.

Compatibility:

In dynamic-shape operator scenarios and Ascend virtual instance scenarios, the CANN package version used in the offline model conversion environment must be the same as that used in the operating environment.

(The Ascend virtual instance is used in the NPU resource virtualization scenario, which aims to improve the utilization of physical NPU resources through isolated vNPU instances. NPU is short for neural network processing unit and vNPU is short for virtual NPU.)

Support for Ascend virtual instances is as follows:

  • Atlas inference products: supported
  • Atlas training products: supported
  • Atlas A2 training products/Atlas A2 inference products: supported
  • Ascend 950PR/Ascend 950DT: not supported
  • Atlas A3 training products/Atlas A3 inference products: not supported
  • Atlas 200I/500 A2 inference products: not supported

See Also

This option works with the following options, of which, --output and --soc_version are required.

Arguments

Argument: single-operator description file (.json). For details about the format and configuration of the file, see Generating a Single-Operator Model.

Restrictions: The specified single operator is defined based on Ascend IR. For details about the single-operator definition, see Ascend IR Operator Specifications.

Suggestions and Benefits

None

Example

The following uses the single operator Add as an example for illustration. Upload the operator description file add.json to any directory on the ATC server, for example, $HOME/singleop.

--singleop=$HOME/singleop/add.json --output=$HOME/singleop/out/op_model  --soc_version=<soc_version>

Dependencies and Restrictions

  • Option Usage:
    To convert a single-operator JSON file into an offline model and only use TBE operators during the conversion process (errors occur if TBE operators cannot be found, without searching for AI CPU operators), set the following environment variable:
    export ASCEND_ENGINE_PATH=${INSTALL_DIR}/lib64/plugin/opskernel/libfe.so:${INSTALL_DIR}/lib64/plugin/opskernel/libge_local_engine.so:${INSTALL_DIR}/lib64/plugin/opskernel/librts_engine.so

    If you want to perform other operations after running the preceding command, run the unset ASCEND_ENGINE_PATH command to disable the environment variable.

    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.

  • API Usage:

    When using an offline model file converted from a single-operator description file in an application project for model inference, call the single-operator model loading API (for example, aclopSetModelDir) to load the operator model, and then call the single-operator execution API (for example, aclopExecuteV2) to execute the operator.

    For details about the APIs, see Single-Operator Model Execution.