ExecuteGraphWithStreamAsync

Description

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

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

Prototype

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 a graph is executed.

inputs

Input

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

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 device memory must be allocated before this API call.
  • Complete the CompileGraph and LoadGraph processes before this API call.
  • A stream must be created using aclrtCreateStream provided by AscendCL before this API call.
  • Before the graph execution result is output, the tasks on the stream are complete by using aclrtSynchronizeStream provided by AscendCL.

    For details about the APIs, see Stream Management.

Example

For details, see Running a Graph Asynchronously.