Class UnifiedMemoryAllocator
- java.lang.Object
- 
- org.apache.sysds.runtime.instructions.gpu.context.UnifiedMemoryAllocator
 
- 
- All Implemented Interfaces:
- GPUMemoryAllocator
 
 public class UnifiedMemoryAllocator extends Object implements GPUMemoryAllocator 
- 
- 
Constructor SummaryConstructors Constructor Description UnifiedMemoryAllocator()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidallocate(jcuda.Pointer devPtr, long size)Allocate memory on the device.booleancanAllocate(long size)Check if there is enough memory to allocate a pointer of given sizevoidfree(jcuda.Pointer devPtr)Frees memory on the devicelonggetAvailableMemory()Gets the available memory on GPU that SystemDS can use.
 
- 
- 
- 
Method Detail- 
allocatepublic void allocate(jcuda.Pointer devPtr, long size) throws jcuda.CudaExceptionAllocate memory on the device.- Specified by:
- allocatein interface- GPUMemoryAllocator
- Parameters:
- devPtr- Pointer to allocated device memory
- size- size in bytes
- Throws:
- jcuda.CudaException- if unable to allocate
 
 - 
freepublic void free(jcuda.Pointer devPtr) throws jcuda.CudaExceptionFrees memory on the device- Specified by:
- freein interface- GPUMemoryAllocator
- Parameters:
- devPtr- Device pointer to memory to free
- Throws:
- jcuda.CudaException- if error occurs
 
 - 
canAllocatepublic boolean canAllocate(long size) Check if there is enough memory to allocate a pointer of given size- Specified by:
- canAllocatein interface- GPUMemoryAllocator
- Parameters:
- size- size in bytes
- Returns:
- true if there is enough available memory to allocate a pointer of the given size
 
 - 
getAvailableMemorypublic long getAvailableMemory() Gets the available memory on GPU that SystemDS can use.- Specified by:
- getAvailableMemoryin interface- GPUMemoryAllocator
- Returns:
- the available memory in bytes
 
 
- 
 
-