GeSessionExecuteGraphWithStreamAsync

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.h>
  • Library file: libge_runner.so

Function Usage

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.

Prototype

1
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 the 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.

Constraints

  • The device memory must be allocated before this API call.
  • The CompileGraph and GeSessionLoadGraph 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 outputted, the tasks on the stream must be completed by using the aclrtSynchronizeStream API.

For details about the APIs, see "Stream Management".