Description
Creates a stream in the calling process or thread. This API is synchronous.
Restrictions
- Each context has a default stream, which is implicitly created with the call to aclrtSetDevice or aclrtCreateContext. You are advised to use aclrtCreateStream to explicitly create a stream.
- Implicit stream creation: applies to simple apps with low complicity of interaction logic. However, in multithreaded programming, the execution result depends on the thread scheduling sequence.
- (Recommended) Explicit stream creation: applies to large apps with complex interaction logic, offering better app readability and maintainability.
- For the Ascend 310 AI Processor, hardware supports a maximum of 1024 streams. If there are multiple default streams, the number of allowed explicit streams is (1024 – Number of default streams – Number of streams for internal synchronization). For example, if a default stream and a stream for internal synchronization already exist, only 1022 streams can be created explicitly.
- For the Ascend 310P AI Processor, hardware supports a maximum of 1024 streams.
- In standard form, if there are multiple default streams, the number of allowed explicit streams is (1024 – Number of default streams – Number of streams for internal synchronization). For example, if a default stream and a stream for internal synchronization already exist, only 1022 streams can be created explicitly.
- For the Ascend 910 AI Processor, hardware supports a maximum of 2048 streams. If there are multiple default streams, the number of allowed explicit streams is (2048 – Number of default streams – Number of streams for internal synchronization). For example, if a default stream and a stream for internal synchronization already exist, only 2046 streams can be created explicitly.
Parameters
Parameter |
Input/Output |
Description |
stream |
Output |
Stream pointer. |
Returns
0 on success; else, failure.