HIP: Heterogenous-computing Interface for Portability
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
Device Memory Access

Functions

hipError_t hipDeviceCanAccessPeer (int *canAccessPeer, int device, int peerDevice)
 Determine if a device can access a peer's memory. More...
 
hipError_t hipDeviceDisablePeerAccess (int peerDevice)
 Disables registering memory on peerDevice for direct access from the current device. More...
 
hipError_t hipDeviceEnablePeerAccess (int peerDevice, unsigned int flags)
 Enables registering memory on peerDevice for direct access from the current device. More...
 
hipError_t hipMemcpyPeer (void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes)
 Copies memory from one device to memory on another device. More...
 
hipError_t hipMemcpyPeerAsync (void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes, hipStream_t stream=0)
 Copies memory from one device to memory on another device. More...
 

Detailed Description

----------------------------------------------------------------------------------------------—

Function Documentation

hipError_t hipDeviceCanAccessPeer ( int *  canAccessPeer,
int  device,
int  peerDevice 
)

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

Parameters
[out]canAccessPeerreturns true if specified devices are peers.
[in]device
[in]peerDeviceReturns "1" in canAccessPeer if the specified device is capable of directly accessing memory physically located on peerDevice , or "0" if not.
Warning
HCC returns 0 in *canAccessPeer ; Need to update this function when RT supports P2P
hipError_t hipDeviceDisablePeerAccess ( int  peerDevice)

Disables registering memory on peerDevice for direct access from the current device.

If there are any allocations on peerDevice which were registered in the current device using hipPeerRegister() then these allocations will be automatically unregistered. Returns hipErrorPeerAccessNotEnabled if direct access to memory on peerDevice has not yet been enabled from the current device.

Parameters
[in]peerDeviceTODO:cudaErrorPeerAccessNotEnabled and cudaErrorInvalidDevice error not supported in HIP, return hipErrorUnknown Returns hipSuccess, hipErrorUnknown
Warning
Need to update this function when RT supports P2P
hipError_t hipDeviceEnablePeerAccess ( int  peerDevice,
unsigned int  flags 
)

Enables registering memory on peerDevice for direct access from the current device.

Parameters
[in]peerDevice
[in]flagsTODO:cudaErrorInvalidDevice error not supported in HIP, return hipErrorUnknown Returns hipSuccess, hipErrorInvalidDevice, hipErrorInvalidValue, hipErrorUnknown
Warning
Need to update this function when RT supports P2P
hipError_t hipMemcpyPeer ( void *  dst,
int  dstDevice,
const void *  src,
int  srcDevice,
size_t  sizeBytes 
)

Copies memory from one device to memory on another device.

Parameters
[out]dst- Destination device pointer.
[in]dstDevice- Destination device
[in]src- Source device pointer
[in]srcDevice- Source device
[in]sizeBytes- Size of memory copy in bytes

Returns hipSuccess, hipErrorInvalidValue, hipErrorInvalidDevice

hipError_t hipMemcpyPeerAsync ( void *  dst,
int  dstDevice,
const void *  src,
int  srcDevice,
size_t  sizeBytes,
hipStream_t  stream 
)

Copies memory from one device to memory on another device.

Parameters
[out]dst- Destination device pointer.
[in]dstDevice- Destination device
[in]src- Source device pointer
[in]srcDevice- Source device
[in]sizeBytes- Size of memory copy in bytes
[in]stream- Stream identifier

Returns hipSuccess, hipErrorInvalidValue, hipErrorInvalidDevice

Bug:
This function uses a synchronous copy
Bug:
This function uses a synchronous copy