GeSessionExecuteGraphWithStreamAsync
Description
Runs the graph of a specified ID using the specified session instance and returns the execution result. This API is asynchronous.
Both this API and ExecuteGraphWithStreamAsync are used to execute the graph of the specified ID and output the result. This API is used to be forward compatible with the graph mode of the upper-layer open-source framework. If the CANN package of 8.0.RC3 or later is used, ExecuteGraphWithStreamAsync is recommended.
- Complete the CompileGraph and GeSessionLoadGraph processes (asynchronous graph execution) before this API call.
- The data type of inputs and outputs is gert::Tensor. For details, see Tensor Constructor.
Prototype
ge::Status GeSessionExecuteGraphWithStreamAsync(ge::Session &session, uint32_t graph_id, void *stream, const std::vector<gert::Tensor> &inputs, std::vector<gert::Tensor> &outputs);
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
session |
Input |
Session instance of the graph to be loaded. |
|
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 GeSessionLoadGraph 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.