Class CudaMemoryAllocator
- java.lang.Object
-
- org.apache.sysds.runtime.instructions.gpu.context.CudaMemoryAllocator
-
- All Implemented Interfaces:
GPUMemoryAllocator
public class CudaMemoryAllocator extends Object implements GPUMemoryAllocator
-
-
Constructor Summary
Constructors Constructor Description CudaMemoryAllocator()
-
Method Summary
All Methods Static 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.static voidresetUnusableFreeMemory()
-
-
-
Method Detail
-
allocate
public void allocate(jcuda.Pointer devPtr, long size)Allocate memory on the device.- Specified by:
allocatein interfaceGPUMemoryAllocator- Parameters:
devPtr- Pointer to allocated device memorysize- size in bytes- Throws:
jcuda.CudaException- if unable to allocate
-
free
public void free(jcuda.Pointer devPtr) throws jcuda.CudaExceptionFrees memory on the device- Specified by:
freein interfaceGPUMemoryAllocator- Parameters:
devPtr- Device pointer to memory to free- Throws:
jcuda.CudaException- if error occurs
-
canAllocate
public boolean canAllocate(long size)
Check if there is enough memory to allocate a pointer of given size- Specified by:
canAllocatein interfaceGPUMemoryAllocator- Parameters:
size- size in bytes- Returns:
- true if there is enough available memory to allocate a pointer of the given size
-
getAvailableMemory
public long getAvailableMemory()
Gets the available memory on GPU that SystemDS can use.- Specified by:
getAvailableMemoryin interfaceGPUMemoryAllocator- Returns:
- the available memory in bytes
-
resetUnusableFreeMemory
public static void resetUnusableFreeMemory()
-
-