aclrtDeviceCanAccessPeer

The Atlas 200/300/500 Inference Product does not support this API.

Description

Queries whether memory copy is supported between two devices.

Restrictions

  • This API supports memory copy only in physical machines and containers.
  • This API supports memory copy only between devices in the same PCIe switch. In the AI Server scenario, memory copy between devices is supported despite they reside in different PCIe switches.
  • This API supports memory copy only between devices in the same physical machine or container.
  • This API supports memory copy 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).

Prototype

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

Parameters

Parameter

Input/Output

Description

canAccessPeer

Output

Whether memory copy is supported between the device specified by deviceId and the device specified by peerDeviceId. 1 indicates that memory copy is supported, and 0 indicates that memory copy 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

The value 0 indicates success, and other values indicate failure. For details, see aclError.

See Also

For the API call example, see Inter-Device Data Transfer.