GeSessionExecuteGraphWithStreamAsync

Applicable Products

  • Ascend 950PR / Ascend 950DT : supported
  • Atlas A3 training products / Atlas A3 inference products : supported
  • Atlas A2 training products / Atlas A2 inference products : supported
  • Atlas 200I/500 A2 inference products : not supported
  • Atlas inference products : supported
  • Atlas training products : supported

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.

  • The CompileGraph and GeSessionLoadGraph processes (asynchronous graph execution) must be completed before this API call.
  • The data type of inputs and outputs is gert::Tensor. For details, see Constructor.

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 run.

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 run by using the asynchronous API.

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

Restrictions

  • 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 obtained, the tasks on the stream must be completed by using aclrtSynchronizeStream.

For details about the API, see Stream Management.