org.apache.sysds.runtime.instructions.gpu.context

## Class GPULazyCudaFreeMemoryManager

- java.lang.Object
- - org.apache.sysds.runtime.instructions.gpu.context.GPULazyCudaFreeMemoryManager

-     public class GPULazyCudaFreeMemoryManager
      extends Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GPULazyCudaFreeMemoryManager(GPUMemoryManager gpuManager)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(long size, jcuda.Pointer toFree)` Add a pointer to the rmvar-ed list
    `void` | `clearAll()`
    `Set<jcuda.Pointer>` | `getAllPointers()`
    `int` | `getNumPointers()` Get total number of rmvared pointers
    `jcuda.Pointer` | `getRmvarPointer(String opcode, long size)` Get any pointer of the given size from rmvar-ed pointers (applicable if eager cudaFree is set to false)
    `jcuda.Pointer` | `getRmvarPointerMinSize(String opcode, long minSize)`
    `long` | `getTotalMemoryAllocated()` Return the total memory in bytes used by this memory manager
    `void` | `removeIfPresent(long size, jcuda.Pointer ptr)` Remove a specific pointer if present in the internal hashmap

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GPULazyCudaFreeMemoryManager

          public GPULazyCudaFreeMemoryManager(GPUMemoryManager gpuManager)

  - ### Method Detail

    - #### getRmvarPointer

          public jcuda.Pointer getRmvarPointer(String opcode,
                                               long size)

      Get any pointer of the given size from rmvar-ed pointers (applicable if eager cudaFree is set to false)
      Parameters:
        `opcode` - opcode
        `size` - size in bytes
      Returns:
        pointer

    - #### getAllPointers

          public Set<jcuda.Pointer> getAllPointers()

    - #### clearAll

          public void clearAll()

    - #### getRmvarPointerMinSize

          public jcuda.Pointer getRmvarPointerMinSize(String opcode,
                                                      long minSize)
                                               throws DMLRuntimeException

      Throws:
        `DMLRuntimeException`

    - #### getTotalMemoryAllocated

          public long getTotalMemoryAllocated()

      Return the total memory in bytes used by this memory manager
      Returns:
        number of bytes

    - #### getNumPointers

          public int getNumPointers()

      Get total number of rmvared pointers
      Returns:
        number of pointers

    - #### add

          public void add(long size,
                          jcuda.Pointer toFree)

      Add a pointer to the rmvar-ed list
      Parameters:
        `size` - size of the pointer
        `toFree` - pointer

    - #### removeIfPresent

          public void removeIfPresent(long size,
                                      jcuda.Pointer ptr)

      Remove a specific pointer if present in the internal hashmap
      Parameters:
        `size` - size in bytes
        `ptr` - pointer to be removed

Copyright © 2021 The Apache Software Foundation. All rights reserved.