CompileGraph
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 |
ID of the graph. |
Returns
Parameter |
Type |
Description |
|---|---|---|
- |
Status |
SUCCESS: The graph build is successful. FAILED: The graph build fails. PARAM_INVALID: The input graph information is abnormal during graph build. |
Restrictions
None