Peer to peer device memory access#

hipError_t hipDeviceCanAccessPeer(int *canAccessPeer, int deviceId, int peerDeviceId)#

Determine if a device can access a peer’s memory.

Returns “1” in canAccessPeer if the specified device is capable of directly accessing memory physically located on peerDevice , or “0” if not.

Returns “0” in canAccessPeer if deviceId == peerDeviceId, and both are valid devices : a device is not a peer of itself.

Parameters:
  • canAccessPeer[out] Returns the peer access capability (0 or 1)

  • deviceId[in] - device from where memory may be accessed.

  • peerDeviceId[in] - device where memory is physically located

Returns:

hipSuccess,

Returns:

hipErrorInvalidDevice if deviceId or peerDeviceId are not valid devices

hipError_t hipDeviceEnablePeerAccess(int peerDeviceId, unsigned int flags)#

Enable direct access from current device’s virtual address space to memory allocations physically located on a peer device.

Memory which already allocated on peer device will be mapped into the address space of the current device. In addition, all future memory allocations on peerDeviceId will be mapped into the address space of the current device when the memory is allocated. The peer memory remains accessible from the current device until a call to hipDeviceDisablePeerAccess or hipDeviceReset.

Returns hipSuccess, hipErrorInvalidDevice, hipErrorInvalidValue,

Parameters:
  • peerDeviceId[in] Peer device to enable direct access to from the current device

  • flags[in] Reserved for future use, must be zero

Returns:

hipErrorPeerAccessAlreadyEnabled if peer access is already enabled for this device.

hipError_t hipDeviceDisablePeerAccess(int peerDeviceId)#

Disable direct access from current device’s virtual address space to memory allocations physically located on a peer device.

Returns hipErrorPeerAccessNotEnabled if direct access to memory on peerDevice has not yet been enabled from the current device.

Parameters:

peerDeviceId[in] Peer device to disable direct access to

Returns:

hipSuccess, hipErrorPeerAccessNotEnabled

hipError_t hipMemGetAddressRange(hipDeviceptr_t *pbase, size_t *psize, hipDeviceptr_t dptr)#

Get information on memory allocations.

Parameters:
  • pbase[out] - BAse pointer address

  • psize[out] - Size of allocation

  • dptr-[in] Device Pointer

Returns:

hipSuccess, hipErrorNotFound

USE_PEER_NON_UNIFIED#