aclrtDeviceEnablePeerAccess
Applicable Products
|
Product |
Supported |
|---|---|
|
|
√ |
|
|
√ |
|
|
√ |
|
|
☓ |
|
|
√ |
|
|
√ |
Function
Enables data exchange between the current device and a specified device. This API enables device-level data exchange.
Calling this API to enable data exchange between devices is unidirectional. For example, if the current device ID is 0 and aclrtDeviceEnablePeerAccess is called to specify device ID 1, only data exchange from device 0 to device 1 is feasible. To enable data exchange from device 1 to device 0, you need to switch the current device to device 1 and call aclrtDeviceEnablePeerAccess again to specify device ID 0. In this case, data exchange from device 1 to device 0 can be implemented.
Call aclrtDeviceCanAccessPeer in advance to check whether data exchange is available between the current device and the specified device. To disable data exchange between devices, call aclrtDeviceDisablePeerAccess.
Prototype
1
|
aclError aclrtDeviceEnablePeerAccess(int32_t peerDeviceId, uint32_t flags) |
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
peerDeviceId |
Input |
Device ID, which must be different from the current device ID. The value must be in the range of [0, (Available device count – 1)]. Call aclrtGetDeviceCount to obtain the device count. |
|
flags |
Input |
This parameter is reserved and must be set to 0. |
Returns
0 on success; otherwise, failure. For details, see aclError.
Restrictions
When your application runs on the Control CPU on the device of the