aclrtDeviceCanAccessPeer

Applicability

Product

Supported

Atlas A3 training products / Atlas A3 inference products

Atlas A2 training products / Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Description

Queries whether data exchange is supported between devices.

Prototype

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; else, 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 despite 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).

See Also

For the API call example, see Data Transfer Between Devices.