RunGraph

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

Runs the graph of a specified ID and returns the execution result. This API is synchronous.

This API is mutually exclusive with RunGraphAsync/RunGraphWithStreamAsync. If a graph has not been loaded by calling LoadGraph before this API is called, this API automatically calls LoadGraph to complete the loading.

Prototype

1
Status RunGraph(uint32_t graph_id, const std::vector<gert::Tensor>& inputs, std::vector<gert::Tensor>& outputs)

Parameters

Parameter

Input/Output

Description

graph_id

Input

ID of the graph to be run.

inputs

Input

Input data of the computational graph, which can be located on a host or device.

If the data is stored on the host but is executed on the device, when user inputs enter a data queue, memory must be allocated and copied for each input. A large input size or quantity may result in a performance bottleneck.

outputs

Output

Output tensors of the computational graph. You do not need to allocate the memory manually. After the execution is complete, GE allocates and initializes the host memory.

Returns

Parameter

Type

Description

-

Status

  • SUCCESS: The subgraph is run successfully.
  • FAILED: The subgraph fails to be run.

Constraints

The inputs correspond to the data node in the graph. The index attribute of the data node indicates the location of the data in the inputs list. Ensure that the corresponding data can be obtained from inputs based on the index attribute of the data node. Otherwise, an error is returned. If there is no data node in the graph, the inputs option can be left blank. The outputs are consistent with the specified output nodes and output ports, with the amount and ordering preserved.