public class GPUMemoryManager extends Object
Modifier and Type | Class and Description |
---|---|
static class |
GPUMemoryManager.GPUComparator
Class that governs the eviction policy
|
Modifier and Type | Field and Description |
---|---|
double |
GPU_MEMORY_UTILIZATION_FACTOR |
protected static org.apache.commons.logging.Log |
LOG |
Constructor and Description |
---|
GPUMemoryManager(GPUContext gpuCtx) |
Modifier and Type | Method and Description |
---|---|
void |
addGPUObject(GPUObject gpuObj)
Adds the GPU object to the memory manager
|
void |
clearMemory()
Clear the allocated GPU objects
|
void |
clearTemporaryMemory()
Clears up the memory used by non-dirty pointers.
|
void |
free(String opcode,
jcuda.Pointer toFree,
boolean eager)
Deallocate the pointer
|
long |
getAvailableMemory()
Gets the available memory on GPU that SystemML can use.
|
long |
getSizeAllocatedGPUPointer(jcuda.Pointer ptr)
Get size of allocated GPU Pointer
|
jcuda.Pointer |
malloc(String opcode,
long size)
Allocate pointer of the given size in bytes.
|
void |
removeGPUObject(GPUObject gpuObj)
Removes the GPU object from the memory manager
|
String |
toString()
Print debugging information
|
protected static final org.apache.commons.logging.Log LOG
public double GPU_MEMORY_UTILIZATION_FACTOR
public GPUMemoryManager(GPUContext gpuCtx)
public void addGPUObject(GPUObject gpuObj)
gpuObj
- the handle to the GPU objectpublic void removeGPUObject(GPUObject gpuObj)
gpuObj
- the handle to the GPU objectpublic long getSizeAllocatedGPUPointer(jcuda.Pointer ptr)
ptr
- pointer to get size ofpublic jcuda.Pointer malloc(String opcode, long size) throws DMLRuntimeException
opcode
- instruction namesize
- size in bytesDMLRuntimeException
- if errorpublic void free(String opcode, jcuda.Pointer toFree, boolean eager) throws DMLRuntimeException
opcode
- instruction nametoFree
- pointer to freeeager
- whether to deallocate eagerlyDMLRuntimeException
- if errorpublic void clearMemory() throws DMLRuntimeException
DMLRuntimeException
- if errorpublic void clearTemporaryMemory()
public long getAvailableMemory()
Copyright © 2018 The Apache Software Foundation. All rights reserved.