Applicable Products
Product
|
Supported (√/x)
|
Ascend 950PR/Ascend 950DT
|
√
|
Atlas A3 training products/Atlas A3 inference products
|
√
|
Atlas A2 training products/Atlas A2 inference products
|
√
|
Atlas training products
|
√
|
Atlas inference products
|
√
|
Atlas 200I/500 A2 inference products
|
√
|
Description
Creates a stream in the calling process or thread.
For the Atlas inference products, compared with the acl.rt.create_stream API, this API can be used to create a stream for quickly delivering tasks, but it increases the memory consumption or CPU performance consumption.
For the Atlas training products, compared with the acl.rt.create_stream API, this API can be used to create a stream for quickly delivering tasks, but it increases the memory consumption or CPU performance consumption.
For the Atlas A2 training products/Atlas A2 inference products, compared with the acl.rt.create_stream API, this API can be used to create a stream for quickly delivering tasks, but it increases the memory consumption or CPU performance consumption.
For the Atlas 200I/500 A2 inference products, this API functions equivalently to the acl.rt.create_stream API.
For the Atlas A3 training products/Atlas A3 inference products, compared with the acl.rt.create_stream API, this API can be used to create a stream for quickly delivering tasks, but it increases the memory consumption or CPU performance consumption.
Prototype
- C Prototype
| aclError aclrtCreateStreamWithConfig(aclrtStream *stream, uint32_t priority, uint32_t flag)
|
- Python Function
| stream, ret = acl.rt.create_stream_with_config(priority,flag)
|
Parameters
Parameter
|
Description
|
priority
|
priority: int, priority.
For the Atlas training products, this parameter is reserved and fixed at 0.
For the Atlas A2 training products/Atlas A2 inference products, this parameter is reserved and fixed at 0.
For the Atlas 200I/500 A2 inference products, this parameter is reserved and fixed at 0.
For the Atlas inference products, the value range is [0, 7]. A maximum of eight priorities are supported. A smaller value indicates a higher priority. The value 0 indicates the highest priority, and the value 7 indicates the lowest priority. If the configured priority exceeds the value range, the priority is changed to the boundary value.
|
flag
|
Int, flag of the stream.
Values:
- ACL_STREAM_FAST_LAUNCH = 1: creates a stream that features fast task launching.
In ACL_STREAM_FAST_LAUNCH mode, the internal system resources are pre-allocated when the stream is created. Therefore, the stream creation duration is prolonged but the task launching duration is shortened. If a stream is created once and used for multiple times, the total duration will be shortened. However, pre-allocation for internal resources during stream creation increases memory consumption. By contrast, if you create a stream by calling acl.rt.create_stream, the internal system resources are allocated only when the stream is used. As a result, the task launching duration is prolonged.
- ACL_STREAM_FAST_SYNC = 2: creates a stream that blocks the current thread and queries the task execution status to return a result upon task completion after you call acl.rt.synchronize_stream.
In ACL_STREAM_FAST_SYNC mode, the total duration is shortened. However, the query operation increases the CPU performance consumption. By contrast, if you create a stream by calling acl.rt.create_stream, after you call acl.rt.synchronize_stream, the stream waits for the notification indicating that the task execution on the device is complete, which is time-consuming.
NOTE: If this parameter is set to a value beyond the value range, the stream created by this API is equivalent to that created by acl.rt.create_stream.
|
Return Values
Return Value
|
Description
|
stream
|
Int, stream object pointer address.
|
ret
|
Int, error code. 0 on success; else, failure.
|