aclrtRegStreamStateCallback
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Description
Registers the callback function for the stream status. Repeated registration is not supported.
When the stream status changes (for example, after aclrtCreateStream or aclrtDestroyStream is called), the Runtime module triggers the callback function. The stream here includes the explicitly created stream and the default stream.
Prototype
1 | aclError aclrtRegStreamStateCallback(const char *regName, aclrtStreamStateCallback callback, void *args) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
regName |
Input |
Unique name for registration. It cannot be left empty and must end with \0. |
callback |
Input |
Callback function. If callback is not NULL, the callback function is registered. If callback is NULL, the callback function is deregistered. Prototype: typedef enum {
ACL_RT_STREAM_STATE_CREATE_POST = 1, // After the create API (for example, aclrtCreateStream) is called
ACL_RT_STREAM_STATE_DESTROY_PRE, // Before the destroy API (for example, aclrtDestroyStream) is called
} aclrtStreamState;
typedef void (*aclrtStreamStateCallback)(aclrtStream stm, aclrtStreamState state, void *args);
|
args |
Input |
Pointer to the user data to be passed to the callback function. |
Returns
0 on success; else, failure. For details, see aclError.