public class CudaMemoryAllocator extends Object implements GPUMemoryAllocator
Constructor and Description |
---|
CudaMemoryAllocator() |
Modifier and Type | Method and Description |
---|---|
void |
allocate(jcuda.Pointer devPtr,
long size)
Allocate memory on the device.
|
boolean |
canAllocate(long size)
Check if there is enough memory to allocate a pointer of given size
|
void |
free(jcuda.Pointer devPtr)
Frees memory on the device
|
long |
getAvailableMemory()
Gets the available memory on GPU that SystemDS can use.
|
public void allocate(jcuda.Pointer devPtr, long size) throws jcuda.CudaException
allocate
in interface GPUMemoryAllocator
devPtr
- Pointer to allocated device memorysize
- size in bytesjcuda.CudaException
- if unable to allocatepublic void free(jcuda.Pointer devPtr) throws jcuda.CudaException
free
in interface GPUMemoryAllocator
devPtr
- Device pointer to memory to freejcuda.CudaException
- if error occurspublic boolean canAllocate(long size)
canAllocate
in interface GPUMemoryAllocator
size
- size in bytespublic long getAvailableMemory()
getAvailableMemory
in interface GPUMemoryAllocator
Copyright © 2022 The Apache Software Foundation. All rights reserved.