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

#### 产品支持情况

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


#### 功能说明

销毁指定Stream，销毁通过acl.rt.create_stream或acl.rt.create_stream_with_config接口创建的Stream，若Stream上有未完成的任务，会等待任务完成后再销毁Stream。


#### 函数原型

- C函数原型
  1 aclError aclrtDestroyStream(aclrtStream stream)

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


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| stream | int，待销毁的Stream的指针地址。 |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| ret | int，错误码，返回0表示成功，返回其它值表示失败。 |


#### 约束说明

- 调用  acl.rt.destroy_stream
接口销毁指定Stream前，需要先调用  acl.rt.synchronize_stream
接口确保Stream中的任务都已完成。
- 调用  acl.rt.destroy_stream
接口销毁指定Stream时，需确保该Stream在当前Context下。
- 调用  acl.rt.destroy_stream
接口销毁指定Stream时，需确保其它接口没有正在使用该Stream。


#### 资源参考

接口调用流程与示例，请参见运行时资源申请与释放(https://www.hiascend.comdocument/detail/zh/canncommercial/900/programug/acldevg/aclpythondevg_0009.html)、同步等待(https://www.hiascend.comdocument/detail/zh/canncommercial/900/programug/acldevg/aclpythondevg_0022.html)。
