aclrtDeviceEnablePeerAccess

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product / Atlas A3 inference product

Atlas A2 training product / Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

Description

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 supported 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.

Must be in the range of [0, 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 app runs on the Ctrl CPU on the device of the Atlas inference product in the Ctrl CPU open form, this API does not support data exchange between devices.

API Call Example

For the API call example, see Cross-Device Data Exchange.