aclrtDeviceCanAccessPeer

Applicable Products

Product

Supported

Ascend 950PR / Ascend 950DT

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

Function

Queries whether data can be exchanged between devices.

Prototype

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

Parameters

Parameter

Input/Output

Description

canAccessPeer

Output

Whether data can be exchanged. 1 indicates that data can be exchanged, and 0 indicates that data cannot be exchanged.

deviceId

Input

ID of a device, which must be different from peerDeviceId.

The value must be in the range of [0, (Available device count – 1)]. Call aclrtGetDeviceCount to obtain the device count.

peerDeviceId

Input

ID of another device, which must be different from deviceId.

The value must be in the range of [0, (Available device count – 1)]. Call aclrtGetDeviceCount to obtain the device count.

Returns

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

Restrictions

  • This API is only available for physical machines and containers.
  • This API is only available for data exchange between devices in the same PCIe switch. For AI servers, data exchange is possible between devices across PCIe switches.
  • This API is only available for data exchange between devices in the same physical machine or container.
  • This API is only available for data exchange between devices of threads in the same process.
  • End-to-end data copy is available between devices in the same PCIe switch only when related host ports (for example, through the host BIOS) are enabled.
  • When your application runs on the Control CPU on the device of the Atlas inference products in Open Ctrl CPU form, this API does not support data exchange between devices.

API Call Example

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