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_v2.h>
  • Library file: libge_runner_v2.so

Function Usage

Synchronously compiles the graph corresponding to the specified ID.

This API does not provide the memory resource management function. Instead, users can customize memory management functions. 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.

Prototype

1
2
Status CompileGraph(uint32_t graph_id)
Status CompileGraph(uint32_t graph_id, const std::vector<ge::Tensor> &inputs)

Parameters

Parameter

Input/Output

Description

graph_id

Input

Subgraph ID.

inputs

Input

Metadata (Shape, Format, DataType) for updating the input node of the computational graph. This parameter can be left blank.

Returns

Parameter

Type

Description

-

Status

SUCCESS: Subgraph compiled successfully.

FAILED: Failed to compile the subgraph.

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