ExecuteGraphWithStreamAsync

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product / Atlas A3 inference product

Atlas A2 training product / Atlas A2 inference product

Atlas 200I/500 A2 inference product

x

Atlas inference product

Atlas training product

Header File/Library File

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

Function Usage

Asynchronously runs the graph of a specified ID and returns the execution result.

Both this function and RunGraphWithStreamAsync are used to run the graph of a specified ID and output the result. Unlike RunGraphWithStreamAsync:

  • The CompileGraph and LoadGraph processes (asynchronous graph run) must be completed before this API call.
  • The data type of inputs and outputs of this API is gert::Tensor.

Prototype

1
Status ExecuteGraphWithStreamAsync(uint32_t graph_id, void *stream,const std::vector<gert::Tensor> &inputs,std::vector<gert::Tensor> &outputs)

Parameters

Parameter

Input/Output

Description

graph_id

Input

Subgraph ID.

stream

Input

Stream on which the graph is executed.

inputs

Input

Input data of the current subgraph, which is the memory on the device.

If the value of the ge.exec.hostInputIndexes parameter is specified using options, Tensor of the corresponding index specifies the memory space on the host.

outputs

Output

Output data of the current subgraph, which is the memory on the device.

Returns

Parameter

Type

Description

-

Status

SUCCESS: The graph is successfully executed by using the asynchronous API.

FAILED: The graph fails to be executed by using the asynchronous API.

Restrictions

  • The memory required by Tensor must be allocated before this API call.
  • The CompileGraph and LoadGraph processes must be completed before this API call.
  • A stream must be created using aclrtCreateStream provided by acl before this API call.
  • Before the graph execution result is obtained, the tasks on the stream must be completed by using the aclrtSynchronizeStream API provided by acl.

    For details about the APIs, see Stream Management.

Example

For details, see Running a Graph Asynchronously.