public abstract class BasicMemoryManager extends Object implements MemoryManager
| Modifier and Type | Field and Description |
|---|---|
protected AtomicInteger |
averageLoopTime |
protected AtomicBoolean |
averagingEnabled |
protected AtomicLong |
freqCounter |
protected AtomicInteger |
frequency |
protected Queue<Integer> |
intervals |
protected static int |
intervalTail |
protected AtomicLong |
lastGcTime |
protected AtomicInteger |
noGcWindow |
protected AtomicBoolean |
periodicEnabled |
| Constructor and Description |
|---|
BasicMemoryManager() |
| Modifier and Type | Method and Description |
|---|---|
org.bytedeco.javacpp.Pointer |
allocate(long bytes,
MemoryKind kind,
boolean initialize)
This method returns
PLEASE NOTE: Cache options
depend on specific implementations
|
void |
collect(INDArray... arrays)
This method detaches off-heap memory from passed INDArray instances, and optionally stores them in cache for future reuse
PLEASE NOTE: Cache options depend on specific implementations
|
int |
getAutoGcWindow()
This method reutrns
|
int |
getAverageLoopTime()
This method returns average time between invokeGCOccasionally() calls
|
MemoryWorkspace |
getCurrentWorkspace() |
long |
getLastGcTime()
This method returns time (in milliseconds) of the las System.gc() call
|
int |
getOccasionalGcFrequency()
This method returns
|
void |
invokeGc()
This method calls for GC.
|
void |
invokeGcOccasionally()
This method calls for GC, and if frequency is met - System.gc() will be called
|
boolean |
isPeriodicGcActive()
This method returns true, if periodic GC is active.
|
void |
memcpy(DataBuffer dstBuffer,
DataBuffer srcBuffer)
This method does memcpy from source buffer to destination buffer
PLEASE NOTE: This method is NOT safe.
|
void |
notifyScopeEntered()
PLEASE NOTE: This method is under development yet.
|
void |
notifyScopeLeft()
PLEASE NOTE: This method is under development yet.
|
void |
purgeCaches()
This method purges all cached memory chunks
|
void |
releaseCurrentContext()
This method releases Context (if current backend has one, sure)
|
MemoryWorkspace |
scopeOutOfWorkspaces()
This method temporary opens block out of any workspace scope.
|
void |
setAutoGcWindow(int windowMillis)
This method enables/disables periodic System.gc() calls.
|
void |
setCurrentWorkspace(MemoryWorkspace workspace) |
void |
setOccasionalGcFrequency(int frequency)
Sets manual GC invocation frequency.
|
void |
toggleAveraging(boolean enabled)
This method enables/disables calculation of average time spent within loops
Default: false
|
void |
togglePeriodicGc(boolean enabled)
This method enables/disables periodic GC
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitallocatedMemory, getBandwidthUse, memset, releaseprotected AtomicInteger frequency
protected AtomicLong freqCounter
protected AtomicLong lastGcTime
protected AtomicBoolean periodicEnabled
protected AtomicInteger averageLoopTime
protected AtomicInteger noGcWindow
protected AtomicBoolean averagingEnabled
protected static final int intervalTail
public org.bytedeco.javacpp.Pointer allocate(long bytes,
MemoryKind kind,
boolean initialize)
allocate in interface MemoryManagerbytes - kind - initialize - public void collect(INDArray... arrays)
collect in interface MemoryManagerarrays - public void toggleAveraging(boolean enabled)
MemoryManagertoggleAveraging in interface MemoryManagerpublic void purgeCaches()
purgeCaches in interface MemoryManagerpublic void memcpy(DataBuffer dstBuffer, DataBuffer srcBuffer)
MemoryManagermemcpy in interface MemoryManagerpublic void notifyScopeEntered()
MemoryManagernotifyScopeEntered in interface MemoryManagerpublic void notifyScopeLeft()
MemoryManagernotifyScopeLeft in interface MemoryManagerpublic void invokeGcOccasionally()
MemoryManagerinvokeGcOccasionally in interface MemoryManagerpublic void invokeGc()
MemoryManagerinvokeGc in interface MemoryManagerpublic boolean isPeriodicGcActive()
MemoryManagerisPeriodicGcActive in interface MemoryManagerpublic void setOccasionalGcFrequency(int frequency)
MemoryManagersetOccasionalGcFrequency in interface MemoryManagerpublic void setAutoGcWindow(int windowMillis)
MemoryManagersetAutoGcWindow in interface MemoryManagerwindowMillis - minimal time milliseconds between calls.public int getAutoGcWindow()
MemoryManagergetAutoGcWindow in interface MemoryManagerpublic int getOccasionalGcFrequency()
MemoryManagergetOccasionalGcFrequency in interface MemoryManagerpublic long getLastGcTime()
MemoryManagergetLastGcTime in interface MemoryManagerpublic void togglePeriodicGc(boolean enabled)
MemoryManagertogglePeriodicGc in interface MemoryManagerpublic int getAverageLoopTime()
MemoryManagergetAverageLoopTime in interface MemoryManagerpublic MemoryWorkspace getCurrentWorkspace()
getCurrentWorkspace in interface MemoryManagerpublic void setCurrentWorkspace(MemoryWorkspace workspace)
setCurrentWorkspace in interface MemoryManagerpublic MemoryWorkspace scopeOutOfWorkspaces()
MemoryManagerscopeOutOfWorkspaces in interface MemoryManagerpublic void releaseCurrentContext()
MemoryManagerreleaseCurrentContext in interface MemoryManagerCopyright © 2021. All rights reserved.