Class GPUMemoryManager
- java.lang.Object
- 
- org.apache.sysds.runtime.instructions.gpu.context.GPUMemoryManager
 
- 
 public class GPUMemoryManager extends Object - All cudaFree and cudaMalloc in SystemDS should go through this class to avoid OOM or incorrect results. - This class can be refactored in future to accept a chunk of memory ahead of time rather than while execution. This will only thow memory-related errors during startup.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classGPUMemoryManager.EvictionPolicyBasedComparatorClass that governs the eviction policy
 - 
Constructor SummaryConstructors Constructor Description GPUMemoryManager(GPUContext gpuCtx)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearMemory()Clear the allocated GPU objectsvoidclearTemporaryMemory()Clears up the memory used by non-dirty pointers that are not inside lineage cachevoidfree(String opcode, jcuda.Pointer toFree, boolean eager)Deallocate the pointerGPULazyCudaFreeMemoryManagergetGPULazyCudaFreeMemoryManager()GPUMatrixMemoryManagergetGPUMatrixMemoryManager()longgetSizeAllocatedGPUPointer(jcuda.Pointer ptr)Get size of allocated GPU Pointerjcuda.Pointermalloc(String opcode, long size, boolean initialize)Allocate pointer of the given size in bytes.voidremoveGPUObject(GPUObject gpuObj)Removes the GPU object from the memory managerStringtoString()Print debugging information
 
- 
- 
- 
Constructor Detail- 
GPUMemoryManagerpublic GPUMemoryManager(GPUContext gpuCtx) 
 
- 
 - 
Method Detail- 
getGPUMatrixMemoryManagerpublic GPUMatrixMemoryManager getGPUMatrixMemoryManager() 
 - 
getGPULazyCudaFreeMemoryManagerpublic GPULazyCudaFreeMemoryManager getGPULazyCudaFreeMemoryManager() 
 - 
getSizeAllocatedGPUPointerpublic long getSizeAllocatedGPUPointer(jcuda.Pointer ptr) Get size of allocated GPU Pointer- Parameters:
- ptr- pointer to get size of
- Returns:
- either the size or -1 if no such pointer exists
 
 - 
mallocpublic jcuda.Pointer malloc(String opcode, long size, boolean initialize) Allocate pointer of the given size in bytes.- Parameters:
- opcode- instruction name
- size- size in bytes
- initialize- if cudaMemset() should be called
- Returns:
- allocated pointer
 
 - 
freepublic void free(String opcode, jcuda.Pointer toFree, boolean eager) throws DMLRuntimeException Deallocate the pointer- Parameters:
- opcode- instruction name
- toFree- pointer to free
- eager- whether to deallocate eagerly
- Throws:
- DMLRuntimeException- if error occurs
 
 - 
removeGPUObjectpublic void removeGPUObject(GPUObject gpuObj) Removes the GPU object from the memory manager- Parameters:
- gpuObj- the handle to the GPU object
 
 - 
clearMemorypublic void clearMemory() Clear the allocated GPU objects
 - 
clearTemporaryMemorypublic void clearTemporaryMemory() Clears up the memory used by non-dirty pointers that are not inside lineage cache
 
- 
 
-