public interface MemoryHandler
Modifier and Type | Method and Description |
---|---|
PointersPair |
alloc(AllocationStatus targetMode,
AllocationPoint point,
AllocationShape shape,
boolean initialize)
Allocate specified memory chunk on specified device/host
|
void |
copyback(AllocationPoint point,
AllocationShape shape)
Copies memory from device to host, if needed.
|
void |
copyforward(AllocationPoint point,
AllocationShape shape)
Copies memory from host buffer to device.
|
void |
fallback(AllocationPoint point,
AllocationShape shape)
Copies memory from device to zero-copy memory
|
void |
free(AllocationPoint point,
AllocationStatus target)
This method frees memory chunk specified by pointer
|
long |
getAllocatedDeviceMemory(Integer device)
This method returns total amount of memory allocated at specified device
|
long |
getAllocatedDeviceObjects(Integer deviceId)
This method returns total number of object allocated on specified device
|
long |
getAllocatedHostMemory()
This method returns total amount of host memory allocated within this MemoryHandler
|
long |
getAllocatedHostObjects()
This method returns total number of allocated objects in host memory
|
long |
getAllocatedHostObjects(Long bucketId)
This method returns number of allocated objects within specific bucket
|
com.google.common.collect.Table<AllocationStatus,Integer,Long> |
getAllocationStatistics()
This method returns total amount of memory allocated within system
|
Set<Integer> |
getAvailableDevices()
This method returns set of available devices
|
ContextPool |
getContextPool() |
ExternalContext |
getDeviceContext()
This method returns ExternalContext wrapper (if applicable)
|
Integer |
getDeviceId()
This method returns device ID for current thread
|
org.bytedeco.javacpp.Pointer |
getDeviceIdPointer()
Returns
getDeviceId() wrapped as a Pointer . |
org.bytedeco.javacpp.Pointer |
getDevicePointer(DataBuffer buffer,
CudaContext context)
PLEASE NOTE: Specific implementation, on systems without special devices can return HostPointer here
|
Set<Long> |
getDeviceTrackingPoints(Integer deviceId)
This method returns set of allocation tracking IDs for specific device
|
FlowController |
getFlowController() |
org.bytedeco.javacpp.Pointer |
getHostPointer(DataBuffer buffer)
PLEASE NOTE: This method always returns pointer valid within OS memory space
|
Set<Long> |
getHostTrackingPoints(Long bucketId)
This method returns sets of allocation tracking IDs for specific bucket
|
AllocationStatus |
getInitialLocation()
This method returns initial allocation location.
|
MemoryProvider |
getMemoryProvider() |
void |
init(Configuration configuration,
Allocator allocator)
This method gets called from Allocator, during Allocator/MemoryHandler initialization
|
void |
initializeDevice(Long threadId,
Integer deviceId)
This method initializes specific device for current thread
|
boolean |
isDeviceDependant()
This method returns if this MemoryHandler instance is device-dependant (i.e.
|
void |
memcpy(DataBuffer dstBuffer,
DataBuffer srcBuffer)
Synchronous version of memcpy
|
void |
memcpyAsync(DataBuffer dstBuffer,
org.bytedeco.javacpp.Pointer srcPointer,
long length,
long dstOffset)
Asynchronous version of memcpy
PLEASE NOTE: This is device-dependent method, if it's not supported in your environment, blocking call will be used instead.
|
void |
memcpyBlocking(DataBuffer dstBuffer,
org.bytedeco.javacpp.Pointer srcPointer,
long length,
long dstOffset)
Synchronous version of memcpy.
|
void |
memcpyDevice(DataBuffer dstBuffer,
org.bytedeco.javacpp.Pointer srcPointer,
long length,
long dstOffset,
CudaContext context) |
void |
memcpySpecial(DataBuffer dstBuffer,
org.bytedeco.javacpp.Pointer srcPointer,
long length,
long dstOffset) |
boolean |
pingDeviceForFreeMemory(Integer deviceId,
long requiredMemory)
This method checks if specified device has free memory
|
boolean |
promoteObject(DataBuffer buffer) |
void |
purgeDeviceObject(Long threadId,
Integer deviceId,
Long objectId,
AllocationPoint point,
boolean copyback)
This method removes specific previously allocated object from device memory
|
void |
purgeZeroObject(Long bucketId,
Long objectId,
AllocationPoint point,
boolean copyback)
This method removes specific previously allocated object from host memory
|
void |
registerAction(CudaContext context,
INDArray result,
INDArray... operands) |
void |
relocate(AllocationStatus currentStatus,
AllocationStatus targetStatus,
AllocationPoint point,
AllocationShape shape,
CudaContext context)
Relocates specific chunk of memory from one storage to another
|
void |
relocateObject(DataBuffer buffer) |
void |
synchronizeThreadDevice(Long threadId,
Integer deviceId,
AllocationPoint point)
This method causes memory synchronization on host side.
|
void init(Configuration configuration, Allocator allocator)
configuration
- allocator
- boolean isDeviceDependant()
void synchronizeThreadDevice(Long threadId, Integer deviceId, AllocationPoint point)
threadId
- deviceId
- point
- PointersPair alloc(AllocationStatus targetMode, AllocationPoint point, AllocationShape shape, boolean initialize)
targetMode
- valid arguments are DEVICE, ZEROboolean pingDeviceForFreeMemory(Integer deviceId, long requiredMemory)
void relocate(AllocationStatus currentStatus, AllocationStatus targetStatus, AllocationPoint point, AllocationShape shape, CudaContext context)
currentStatus
- targetStatus
- point
- void copyback(AllocationPoint point, AllocationShape shape)
point
- void copyforward(AllocationPoint point, AllocationShape shape)
point
- void fallback(AllocationPoint point, AllocationShape shape)
point
- shape
- void free(AllocationPoint point, AllocationStatus target)
point
- AllocationStatus getInitialLocation()
void initializeDevice(Long threadId, Integer deviceId)
void memcpyBlocking(DataBuffer dstBuffer, org.bytedeco.javacpp.Pointer srcPointer, long length, long dstOffset)
dstBuffer
- srcPointer
- length
- dstOffset
- void memcpyAsync(DataBuffer dstBuffer, org.bytedeco.javacpp.Pointer srcPointer, long length, long dstOffset)
dstBuffer
- srcPointer
- length
- dstOffset
- void memcpySpecial(DataBuffer dstBuffer, org.bytedeco.javacpp.Pointer srcPointer, long length, long dstOffset)
void memcpyDevice(DataBuffer dstBuffer, org.bytedeco.javacpp.Pointer srcPointer, long length, long dstOffset, CudaContext context)
void memcpy(DataBuffer dstBuffer, DataBuffer srcBuffer)
dstBuffer
- srcBuffer
- org.bytedeco.javacpp.Pointer getDevicePointer(DataBuffer buffer, CudaContext context)
org.bytedeco.javacpp.Pointer getHostPointer(DataBuffer buffer)
com.google.common.collect.Table<AllocationStatus,Integer,Long> getAllocationStatistics()
long getAllocatedHostMemory()
long getAllocatedDeviceMemory(Integer device)
device
- long getAllocatedHostObjects(Long bucketId)
bucketId
- long getAllocatedHostObjects()
long getAllocatedDeviceObjects(Integer deviceId)
deviceId
- Set<Long> getDeviceTrackingPoints(Integer deviceId)
deviceId
- Set<Long> getHostTrackingPoints(Long bucketId)
bucketId
- void purgeDeviceObject(Long threadId, Integer deviceId, Long objectId, AllocationPoint point, boolean copyback)
threadId
- deviceId
- objectId
- point
- copyback
- void purgeZeroObject(Long bucketId, Long objectId, AllocationPoint point, boolean copyback)
bucketId
- objectId
- point
- copyback
- Set<Integer> getAvailableDevices()
Integer getDeviceId()
org.bytedeco.javacpp.Pointer getDeviceIdPointer()
getDeviceId()
wrapped as a Pointer
.ExternalContext getDeviceContext()
void registerAction(CudaContext context, INDArray result, INDArray... operands)
FlowController getFlowController()
MemoryProvider getMemoryProvider()
boolean promoteObject(DataBuffer buffer)
void relocateObject(DataBuffer buffer)
ContextPool getContextPool()
Copyright © 2016. All Rights Reserved.