Function: set_stream_overflow_switch

Applicability

Product

Supported (√/x)

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas training products

x

Atlas inference products

x

Atlas 200I/500 A2 inference products

x

Function Usage

Enables or disables the overflow detection function for a specified stream when the upper-layer training framework (such as PyTorch) is connected in saturation mode. After the function is disabled, you cannot use the overflow detection operator to check whether a task overflows.

Prototype

  • C Prototype
    1
    aclError aclrtSetStreamOverflowSwitch(aclrtStream stream, uint32_t flag)
    
  • Python Function
    1
    ret = acl.rt.set_stream_overflow_switch(stream, flag)
    

Parameter Description

Parameter

Description

stream

Int, pointer address of the specified stream. If 0 is passed, the default stream will be operated.

flag

Int, overflow detection switch. The options are as follows:

  • 0: false
  • 1: true

Return Value Description

Return Value

Description

ret

Int, error code: 0 on success; else, failure.

Restrictions

  • Before calling this API, you can call acl.rt.set_device_sat_mode to set the saturation mode.
  • The setting takes effect only for tasks created after this API call.