LoadGraph

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

Binds a graph with a specified ID to a stream in asynchronous graph execution scenarios.

Before calling this API, you need to complete the CompileGraph process. After LoadGraph is complete, you need to call the ExecuteGraphWithStreamAsync API to execute the graph.

Prototype

1
Status LoadGraph(const uint32_t graph_id, const std::map<AscendString, AscendString> &options, void *stream) const

Parameters

Parameter

Input/Output

Description

graph_id

Input

ID of the graph to be executed.

options

Input

Options that may be used in the execution phase. A key-value mapping table, for the graph configuration. key indicates the option type, and value indicates the option value.

Generally, this parameter can be left empty, indicating using the same options configuration passed to GEInitialize.

The key and value are of the AscendString type. You can use this parameter to configure the current graph separately. For details about the supported configuration options, see Command-Line Options> ge.exec.frozenInputIndexes and ge.exec.hostInputIndexes. Currently, only these two parameters can be configured.

stream (asynchronous graph execution)

Input

Graph execution flow.

Returns

Parameter

Type

Description

-

Status

GE_CLI_SESS_RUN_FAILED: Serialization failed when a subgraph is executed.

SUCCESS: Subgraph executed successfully.

FAILED: Failed to execute the subgraph.

Restrictions

It is recommended that the stream loaded by LoadGraph be the same as the stream used by the ExecuteGraphWithStreamAsync API. If they are different, call the stream synchronization interface "aclrtSynchronizeStream" to synchronize the stream used for loading after LoadGraph is called.