aclrtDeviceCanAccessPeer

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

Queries whether data exchange is supported between devices.

Prototype

1
aclError aclrtDeviceCanAccessPeer(int32_t *canAccessPeer, int32_t deviceId, int32_t peerDeviceId)

Parameters

Parameter

Input/Output

Description

canAccessPeer

Output

Whether data exchange is supported. 1 indicates that data exchange is supported, and 0 indicates that data exchange is not supported.

deviceId

Input

ID of the specified device, which must be different from peerDeviceId.

Must be in the range of [0, Device count – 1]. Call aclrtGetDeviceCount to obtain the device count.

peerDeviceId

Input

ID of the specified device, which must be different from deviceId.

Must be in the range of [0, Device count – 1]. Call aclrtGetDeviceCount to obtain the device count.

Returns

0 on success; otherwise, failure. For details, see aclError.

Restrictions

  • This API supports memory copy only in physical machines and containers.
  • This API supports data exchange only between devices in the same PCIe switch. In the AI Server scenario, data exchange between devices is supported although they reside in different PCIe switches.
  • This API supports data exchange only between devices in the same physical machine or container.
  • This API supports data exchange only between devices of threads in the same process.
  • This API supports memory copy between devices in the same PCIe switch only when the related ports of the host are enabled (such as the host BIOS).

API Call Example

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