---
title: SetExecuteStreamId
description: "设置Operation使用的streamId，这里的streamId为调用Context的SetExecuteStreams接口时传入streams中的序号。（例如如果需要op1在stream2上运行（streams={stream1, stream2, stream3}），那么这里调用为SetExecuteStreamId(op1, 1)）。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendtb/ascendtb_01_0123.html
sourcePath: /source/zh/canncommercial/900/API/ascendtb/ascendtb_01_0123.html
indexId: cbd8aba5822a217dafedd85d59d56b75aa84fc4fbff7de6de8d8c2c121cb4c1a64
---
# SetExecuteStreamId

#### 功能说明

设置Operation使用的streamId，这里的streamId为调用Context的SetExecuteStreams接口时传入streams中的序号。（例如如果需要op1在stream2上运行（streams={stream1, stream2, stream3}），那么这里调用为SetExecuteStreamId(op1, 1)）。


#### 定义

```
Status SetExecuteStreamId(Operation *operation, uint32_t streamId);
```


#### 参数列表

| 参数名称 | 输入/输出 | 描述 |
| --- | --- | --- |
| operation | 输入 | 被设置的Operation指针。 |
| streamId | 输入 | 需要设置的streamId。 |


#### 返回值说明

| 类型 | 输入/输出 | 说明 |
| --- | --- | --- |
| Status | 输出 | 状态值，返回NO\_ERROR表示成功，返回其它值表示失败。 |


#### 约束说明

若自定义插件算子（PluginOperation）需要使用该功能，PluginOperation需要继承自OperationInfra接口基类。

该接口对单算子与图算子的设置行为略有差异，单算子调用该接口时修改单算子本身的StreamId，图算子调用该接口会修改图中所有streamId为0的Operation。默认的streamId为0。
