aclmdlRICaptureThreadExchangeMode
Note: This API is for trial use and may be changed in later versions. It is not available in commercial products.
Applicability
|
Product |
Supported |
|---|---|
|
Atlas 350 Accelerator Card |
√ |
|
|
√ |
|
|
√ |
|
|
☓ |
|
|
√ |
|
|
☓ |
Description
Switches the capture mode of the current thread.
Calling this API will set the capture mode of the calling thread to the value contained in *mode, and return the previously set mode of the thread through *mode.
- If aclmdlRICaptureBegin is called to set the capture mode to ACL_MODEL_RI_CAPTURE_MODE_RELAXED (RELAXED mode for short), all threads can call unsafe functions. In this case, even if aclmdlRICaptureThreadExchangeMode is called in other threads (threads that are not in the capture state) to set the capture mode to another value, the setting does not take effect. Other threads still follow the RELAXED mode.
- If aclmdlRICaptureBegin is called to set the capture mode to ACL_MODEL_RI_CAPTURE_MODE_THREAD_LOCAL (THREAD_LOCAL mode for short), the current thread is not allowed to call unsafe functions, but other threads can call unsafe functions. If the current thread needs to call unsafe functions, aclmdlRICaptureThreadExchangeMode needs to be called to switch the current thread mode to RELAXED.
- If aclmdlRICaptureBegin is called to set the capture mode to ACL_MODEL_RI_CAPTURE_MODE_GLOBAL (GLOBAL mode for short), no thread can call unsafe functions. If the current thread needs to call unsafe functions, aclmdlRICaptureThreadExchangeMode needs to be called to switch the current thread mode to RELAXED. If other threads need to call unsafe functions, aclmdlRICaptureThreadExchangeMode needs to be called to switch the current thread mode to RELAXED or THREAD_LOCAL.
Prototype
1
|
aclError aclmdlRICaptureThreadExchangeMode(aclmdlRICaptureMode *mode) |
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
mode |
Input/Output |
Capture mode. This mode is used to limit the scope of unsafe functions, including aclrtMemset, aclrtMemcpy, aclrtMemcpy2d, and APIs (such as aclrtMemcpyAsync) that use non-page-locked host memory for asynchronous memory copy. For details about the type definition, see aclmdlRICaptureMode. |
Returns
0 on success; otherwise, failure. For details, see aclError.