---
title: GeSessionExecuteGraphWithStreamAsync
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendgraphapi/atlasgeapi_07_0100.html
sourcePath: /source/zh/canncommercial/900/API/ascendgraphapi/atlasgeapi_07_0100.html
indexId: dc5bfa4bbbf81b32afaca1ee5119eb8d3df60c33884e8aff20200db28848382a72
---
# GeSessionExecuteGraphWithStreamAsync


#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | x |
| Atlas 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |


#### 头文件/库文件

- 头文件：#include <ge/ge_api.h>
- 库文件：libge_runner.so


#### 功能说明

使用指定的Session实例，异步运行指定ID对应的Graph图，输出执行结果。

此接口与ExecuteGraphWithStreamAsync均为运行指定ID对应的图，并输出结果，该接口更多是为了前向兼容上层开源框架的图模式场景；如果用户使用的是8.0.RC3版本及之后的CANN包，则更推荐使用ExecuteGraphWithStreamAsync。

- 该接口执行前需要完成  CompileGraph
及  GeSessionLoadGraph
（异步运行Graph场景）流程。
- 该接口inputs和outputs数据类型为gert::Tensor(https://www.hiascend.comdocument/detail/zh/canncommercial/900/maintenref/basicdataapi/atlasopapi_07_00554.html)。


#### 函数原型

```
ge::Status GeSessionExecuteGraphWithStreamAsync(ge::Session &session, uint32_t graph_id, void *stream, const std::vector<gert::Tensor> &inputs, std::vector<gert::Tensor> &outputs)
```


#### 参数说明

| 参数名 | 输入/输出 | 说明 |
| --- | --- | --- |
| session | 输入 | 加载图的Session实例。 |
| graph\_id | 输入 | 子图对应的ID。 |
| stream | 输入 | 指定图在哪个Stream上运行。 |
| inputs | 输入 | 当前子图对应的输入数据，为Device上的内存空间。 |
| outputs | 输出 | 当前子图对应的输出数据，为Device上的内存空间。 |


#### 返回值说明

| 参数名 | 类型 | 说明 |
| --- | --- | --- |
| \- | Status | SUCCESS：异步运行图成功。 FAILED：异步运行图失败。 |


#### 约束说明

- 调用该接口前，需要确定好Device上分配的内存大小。
- 调用该接口前，需要完成  CompileGraph
及  GeSessionLoadGraph
流程。
- 调用该接口前，需要通过acl提供的aclrtCreateStream接口创建Stream。
- 得到输出运行结果前，需要通过aclrtSynchronizeStream接口保证Stream上的任务已经执行完。

接口详细说明请参见“Stream管理(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclcppdevg_03_0065.html)”。
