aclrtSwitchStream

Applicable Products

Product

Supported

Ascend 950PR/Ascend 950DT

√

Atlas A3 training products/Atlas A3 inference products

☓

Atlas A2 training products/Atlas A2 inference products

√

Atlas 200I/500 A2 inference products

√

Atlas inference products

√

Atlas training products

√

Function

Switches between streams based on conditions. This is an asynchronous API.

After a successful switch, only the tasks on the target stream are executed, while those on the current stream are stopped.

Prototype

1
aclError aclrtSwitchStream(void *leftValue, aclrtCondition cond, void *rightValue, aclrtCompareDataType dataType, aclrtStream trueStream, aclrtStream falseStream, aclrtStream stream)

Parameters

Parameter

Input/Output

Description

leftValue

Input

Device memory address of the left-value data.

cond

Input

Comparison condition between the left-value and right-value data. For details about the type definition, see aclrtCondition.

rightValue

Input

Device memory address of the right-value data.

dataType

Input

Data type of the left-value and right-value data. For details about the type definition, see aclrtCompareDataType.

trueStream

Input

Target stream. If the condition specified by cond is met, the tasks on trueStream are executed. For details about the type definition, see aclrtStream.

falseStream

Input

Reserved. The value is fixed at NULL.

stream

Input

Stream for executing the switch task. For details about the type definition, see aclrtStream.

Returns

0 on success; otherwise, failure. For details, see aclError.