Function: unsubscribe_report
Applicable Products
|
Product |
Supported (√/x) |
|---|---|
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
Description
Unsubscribes from a thread in the asynchronous scenario. The callback function in the stream will no longer be processed by the thread.
- Create a thread. Once acl.rt.process_report in the thread function is called to set the timeout interval (cyclic calling is required), acl.rt.launch_callback will deliver a callback task after a period of time.
- Call acl.rt.subscribe_report to bind the thread created in Step 1 to the stream. The callback task delivered by the stream is executed in the bound thread.
- Execute an asynchronous job (for example, an asynchronous inference job) on the specified stream.
- Define and implement the callback function, call acl.rt.launch_callback to deliver a callback task in the task queue of the stream, and trigger the thread to process the callback function subscribed by acl.rt.subscribe_report. Each time acl.rt.launch_callback is called, a callback task is delivered.
- Call acl.rt.unsubscribe_report to unsubscribe from threads and unbind threads from streams after all asynchronous tasks are executed.
Prototype
- C Prototype
1aclError aclrtUnSubscribeReport(uint64_t threadId, aclrtStream stream)
- Python Function
1ret = acl.rt.unsubscribe_report(thread_id, stream)
Parameters
|
Parameter |
Description |
|---|---|
|
thread_id |
Int, thread ID. |
|
stream |
Int, pointer address of the stream to be processed. |
Return Values
|
Return Value |
Description |
|---|---|
|
ret |
Int, error code. 0 on success; else, failure. |