Class Nd4jWorkspace

    • Method Detail

      • getStepNumber

        public long getStepNumber()
        This method returns step number. Viable only in circular mode.
        Returns:
      • getSpilledSize

        public long getSpilledSize()
        This method returns number of bytes in spilled allocations.
        Returns:
      • getPinnedSize

        public long getPinnedSize()
        This method returns number of bytes in pinned allocations.
        Returns:
      • getInitialBlockSize

        public long getInitialBlockSize()
        This method returns number of bytes for first block of circular workspace.
        Returns:
      • getDeviceOffset

        public long getDeviceOffset()
        This method returns current device memory offset within workspace
        Returns:
      • getHostOffset

        public long getHostOffset()
        This method returns current host memory offset within workspace
        Returns:
      • getCurrentSize

        public long getCurrentSize()
        This method returns current amount of memory allocated for workspace. PLEASE NOTE: It shows only amount of HOST memory. If current backend assumes DEVICE/HOST memory pair, DEVICE memory will probably have the same size, but won't be accounted in this value.
        Specified by:
        getCurrentSize in interface MemoryWorkspace
        Returns:
      • init

        protected void init()
      • alloc

        public PagedPointer alloc​(long requiredMemory,
                                  DataType type,
                                  boolean initialize)
        Description copied from interface: MemoryWorkspace
        This method does allocation from a given Workspace
        Specified by:
        alloc in interface MemoryWorkspace
        Parameters:
        requiredMemory - allocation size, in bytes
        type - dataType that is going to be used
        Returns:
      • enableDebug

        public void enableDebug​(boolean reallyEnable)
        This method enabled debugging mode for this workspace
        Specified by:
        enableDebug in interface MemoryWorkspace
        Parameters:
        reallyEnable -
      • alloc

        public PagedPointer alloc​(long requiredMemory,
                                  MemoryKind kind,
                                  DataType type,
                                  boolean initialize)
        Description copied from interface: MemoryWorkspace
        This method does allocation from a given Workspace
        Specified by:
        alloc in interface MemoryWorkspace
        Parameters:
        requiredMemory - allocation size, in bytes
        kind - MemoryKind for allocation
        type - dataType that is going to be used
        Returns:
      • free

        public void free​(org.bytedeco.javacpp.Pointer pointer)
      • initializeWorkspace

        public void initializeWorkspace()
        Description copied from interface: MemoryWorkspace
        This method causes Workspace initialization PLEASE NOTE: This call will have no effect on previously initialized Workspace
        Specified by:
        initializeWorkspace in interface MemoryWorkspace
      • getNumberOfExternalAllocations

        public int getNumberOfExternalAllocations()
        This method returns number of spilled allocations, that can be purged at the end of block
        Returns:
      • getNumberOfPinnedAllocations

        public int getNumberOfPinnedAllocations()
        This method returns number of pinned allocations, they can be purged after 2 steps. PLEASE NOTE: This method can return non-zero calues only for circular workspace mode
        Returns:
      • destroyWorkspace

        public void destroyWorkspace()
        Description copied from interface: MemoryWorkspace
        This method causes Workspace destruction: all memory allocations are released after this call.
        Specified by:
        destroyWorkspace in interface MemoryWorkspace
      • destroyWorkspace

        public void destroyWorkspace​(boolean extended)
        This method basically deallocates workspace memory
        Specified by:
        destroyWorkspace in interface MemoryWorkspace
        Parameters:
        extended -
      • getCyclesCount

        public long getCyclesCount()
      • close

        public void close()
        Description copied from interface: MemoryWorkspace
        This method is for compatibility with "try-with-resources" java blocks. Internally it should be equal to notifyScopeLeft() method
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface MemoryWorkspace
      • clearPinnedAllocations

        protected abstract void clearPinnedAllocations​(boolean extended)
      • clearExternalAllocations

        protected abstract void clearExternalAllocations()
      • reset

        public void reset()
        This method reset host/device offsets within workspace PLEASE NOTE: Never call this method unless you realize all consequences
      • resetWorkspace

        protected abstract void resetWorkspace()
      • toggleWorkspaceUse

        public void toggleWorkspaceUse​(boolean isEnabled)
        This method allows to temporary disable this workspace, and issue allocations directly.
        Specified by:
        toggleWorkspaceUse in interface MemoryWorkspace
        Parameters:
        isEnabled -
      • getLastCycleAllocations

        public long getLastCycleAllocations()
        This method returns number of bytes allocated during last full cycle
        Specified by:
        getLastCycleAllocations in interface MemoryWorkspace
        Returns:
      • getThisCycleAllocations

        public long getThisCycleAllocations()
        This method returns number of bytes allocated during THIS cycle
        Specified by:
        getThisCycleAllocations in interface MemoryWorkspace
        Returns:
      • getMaxCycleAllocations

        public long getMaxCycleAllocations()
        This method returns number of bytes of biggest cycle
        Specified by:
        getMaxCycleAllocations in interface MemoryWorkspace
        Returns:
      • isScopeActive

        public boolean isScopeActive()
        This method returns True if scope was opened, and not closed yet.
        Specified by:
        isScopeActive in interface MemoryWorkspace
        Returns: