HIP: Heterogenous-computing Interface for Portability
|
Functions | |
hipError_t | hipIpcGetMemHandle (hipIpcMemHandle_t *handle, void *devPtr) |
Gets an interprocess memory handle for an existing device memory allocation. More... | |
hipError_t | hipIpcOpenMemHandle (void **devPtr, hipIpcMemHandle_t handle, unsigned int flags) |
Opens an interprocess memory handle exported from another process and returns a device pointer usable in the local process. More... | |
hipError_t | hipIpcCloseMemHandle (void *devPtr) |
Close memory mapped with hipIpcOpenMemHandle. More... | |
Defines the HIP API. See the individual sections for more information.
hipError_t hipIpcCloseMemHandle | ( | void * | devPtr | ) |
Close memory mapped with hipIpcOpenMemHandle.
Unmaps memory returnd by hipIpcOpenMemHandle. The original allocation in the exporting process as well as imported mappings in other processes will be unaffected.
Any resources used to enable peer access will be freed if this is the last mapping using them.
devPtr | - Device pointer returned by hipIpcOpenMemHandle |
hipError_t hipIpcGetMemHandle | ( | hipIpcMemHandle_t * | handle, |
void * | devPtr | ||
) |
Gets an interprocess memory handle for an existing device memory allocation.
Takes a pointer to the base of an existing device memory allocation created with hipMalloc and exports it for use in another process. This is a lightweight operation and may be called multiple times on an allocation without adverse effects.
If a region of memory is freed with hipFree and a subsequent call to hipMalloc returns memory with the same device address, hipIpcGetMemHandle will return a unique handle for the new memory.
handle | - Pointer to user allocated hipIpcMemHandle to return the handle in. |
devPtr | - Base pointer to previously allocated device memory |
hipError_t hipIpcOpenMemHandle | ( | void ** | devPtr, |
hipIpcMemHandle_t | handle, | ||
unsigned int | flags | ||
) |
Opens an interprocess memory handle exported from another process and returns a device pointer usable in the local process.
Maps memory exported from another process with hipIpcGetMemHandle into the current device address space. For contexts on different devices hipIpcOpenMemHandle can attempt to enable peer access between the devices as if the user called hipDeviceEnablePeerAccess. This behavior is controlled by the hipIpcMemLazyEnablePeerAccess flag. hipDeviceCanAccessPeer can determine if a mapping is possible.
Contexts that may open hipIpcMemHandles are restricted in the following way. hipIpcMemHandles from each device in a given process may only be opened by one context per device per other process.
Memory returned from hipIpcOpenMemHandle must be freed with hipIpcCloseMemHandle.
Calling hipFree on an exported memory region before calling hipIpcCloseMemHandle in the importing context will result in undefined behavior.
devPtr | - Returned device pointer |
handle | - hipIpcMemHandle to open |
flags | - Flags for this operation. Must be specified as hipIpcMemLazyEnablePeerAccess |
*devPtr
. In particular, multiple processes may not receive the same address for the same handle
.