CompileGraph

Applicability

Product

Supported or Not

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

x

Atlas inference products

Atlas training products

Header File/Library File

  • Header file: #include <ge/ge_api.h>
  • Library file: libge_runner.so

Function Usage

Synchronously compiles the graph corresponding to the specified ID. Compared with BuildGraph, this API provides only the graph compilation function and does not generate executable models. BuildGraph contains the graph build process, initializes the memory resources required by the model after the process, and generates an executable model.

  • This API does not provide the memory resource management function. Instead, users can customize the memory management. This API can be used together with the API for querying the graph resource usage after compilation, and the API for updating the memory base address. In this way, you can manage the model memory with higher flexibility.

    After calling this API, call GetCompiledGraphSummary to obtain the brief information about the graph compilation result (such as the memory size required for model execution and whether the memory can be updated and reused). Allocate and manage the memory based on the queried memory size. Then, call SetGraphConstMemoryBase and UpdateGraphFeatureMemoryBase to set and update the memory base address.

  • This API can be used only with RunGraphWithStreamAsync or ExecuteGraphWithStreamAsync and cannot be used with RunGraph or RunGraphAsync.
  • Graphs containing the Variable operator do not support this API.

Prototype

1
Status CompileGraph(uint32_t graph_id)

Parameters

Parameter

Input/Output

Description

graph_id

Input

Subgraph ID.

Returns

Parameter

Type

Description

-

Status

SUCCESS: Subgraph build successful.

FAILED: Subgraph build failed.

PARAM_INVALID: The input graph information is abnormal when the subgraph is compiled.

Restrictions

None