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:
- Complete the CompileGraph and LoadGraph processes (asynchronous graph execution) before this API call.
- The data type of inputs and outputs is gert::Tensor. For details, see Tensor Constructor.
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.
Parent topic: Graph Running APIs