---
title: 函数：use_stream_res_in_current_thread
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/runtimeapi/aclpythondevg_01_1138.html
sourcePath: /source/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_1138.html
indexId: 5b52d4502feb8dc42ae53c490c058ea3b8af8d2d94218265f5cdf33dfff8363371
---
# 函数：use_stream_res_in_current_thread

#### 产品支持情况

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


#### 功能说明

在当前线程中使用指定Stream上的Device资源限制。如果多次调用本接口设置Stream，将以最后一次设置为准。

需先调用acl.rt.set_stream_res_limit接口设置该Stream上的Device资源限制。


#### 函数原型

- C函数原型

```
aclError aclrtUseStreamResInCurrentThread(aclrtStream stream)
```


- python函数
  1 ret = acl.rt.use_stream_res_in_current_thread(stream)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| stream | int，指定stream, 若传入0，则表示默认Stream。 |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| ret | int，返回0表示成功，返回其他值表示失败。 |
