---
title: aclrtSetStreamOverflowSwitch
description: 饱和模式下，对接上层训练框架时（例如PyTorch），针对指定Stream，打开或关闭溢出检测开关，关闭后无法通过溢出检测算子获取任务是否溢出，同步接口。
url: "https://www.hiascend.com/document/detail/zh/Atlas200IDKA2DeveloperKit/23.0.RC2/Application%20Development%20Guide/aadgc/aclcppdevg_03_0060.html"
---

# aclrtSetStreamOverflowSwitch

#### 函数功能

饱和模式下，对接上层训练框架时（例如PyTorch），针对指定Stream，打开或关闭溢出检测开关，关闭后无法通过溢出检测算子获取任务是否溢出，同步接口。

Atlas 200/500 A2推理产品，不支持该接口。


#### 约束说明

- 在调用本接口前，可调用  aclrtSetDeviceSatMode
接口设置饱和模式。
- 调用该接口打开或关闭溢出检测开关后，仅对后续新下的任务生效，已下发的任务仍维持原样。


#### 函数原型

aclError aclrtSetStreamOverflowSwitch(aclrtStream stream, uint32_t flag)


#### 参数说明

| 参数名 | 输入/输出 | 说明 |
| --- | --- | --- |
| stream | 输入 | 待操作Stream，若传入NULL，则操作默认Stream。 |
| flag | 输入 | 溢出检测开关，取值范围如下： 0：关闭 1：打开 |


#### 返回值说明

返回0表示成功，返回其它值表示失败。
