Description
Creates a stream in the calling process or thread. This API is synchronous.
For the Ascend 310P AI Processor, compared with aclrtCreateStream, this API can create a stream that features fast task launching. However, it consumes more memory or CPU resources.
For the Ascend 910 AI Processor, compared with aclrtCreateStream, this API can create a stream that features fast task launching. However, it consumes more memory or CPU resources.
For the Ascend 310 AI Processor, this API functions equivalently to aclrtCreateStream.
Prototype
aclError aclrtCreateStreamWithConfig(aclrtStream *stream, uint32_t priority, uint32_t flag)
Parameters
Parameter |
Input/Output |
Description |
stream |
Output |
Stream pointer. |
priority |
Input |
Priority. This parameter is reserved and fixed at 0. |
flag |
Input |
Flag of the stream pointer. The options are as follows:
- ACL_STREAM_FAST_LAUNCH: 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 aclrtCreateStream, 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: creates a stream that blocks the current thread and queries the task execution status to return a result upon task completion after you call aclrtSynchronizeStream.
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 aclrtCreateStream, after you call aclrtSynchronizeStream, the stream waits for the notification indicating that the task execution on the device is complete, which is time-consuming.
|
Returns
0 on success; else, failure.