public abstract class BasicWorkspaceManager extends Object implements MemoryWorkspaceManager
Modifier and Type | Class and Description |
---|---|
protected class |
BasicWorkspaceManager.WorkspaceDeallocatorThread |
Modifier and Type | Field and Description |
---|---|
protected ThreadLocal<Map<String,MemoryWorkspace>> |
backingMap |
protected AtomicLong |
counter |
protected org.nd4j.linalg.primitives.SynchronizedObject<DebugMode> |
debugMode |
protected WorkspaceConfiguration |
defaultConfiguration |
static String |
WorkspaceDeallocatorThreadName
Deprecated.
|
Constructor and Description |
---|
BasicWorkspaceManager() |
BasicWorkspaceManager(WorkspaceConfiguration defaultConfiguration) |
Modifier and Type | Method and Description |
---|---|
boolean |
anyWorkspaceActiveForCurrentThread() |
boolean |
checkIfWorkspaceExists(String id)
This method checks, if Workspace with a given Id was created before this call
|
boolean |
checkIfWorkspaceExistsAndActive(String id) |
void |
destroyAllWorkspacesForCurrentThread()
This method destroys all workspaces allocated in current thread
|
void |
destroyWorkspace()
This method destroy default workspace, if any
|
void |
destroyWorkspace(MemoryWorkspace workspace)
This method destroys given workspace
|
protected void |
ensureThreadExistense() |
List<MemoryWorkspace> |
getAllWorkspacesForCurrentThread() |
List<String> |
getAllWorkspacesIdsForCurrentThread() |
MemoryWorkspace |
getAndActivateWorkspace()
This method gets & activates default workspace
|
MemoryWorkspace |
getAndActivateWorkspace(String id)
This method gets & activates workspace with a given Id
|
MemoryWorkspace |
getAndActivateWorkspace(WorkspaceConfiguration configuration,
String id)
This method gets & activates default with a given configuration and Id
|
DebugMode |
getDebugMode() |
String |
getUUID()
Returns globally unique ID
|
MemoryWorkspace |
getWorkspaceForCurrentThread()
This method will return workspace with default configuration and default id.
|
MemoryWorkspace |
getWorkspaceForCurrentThread(String id) |
protected void |
pickReference(MemoryWorkspace workspace) |
void |
printAllocationStatisticsForCurrentThread()
This method prints out basic statistics for workspaces allocated in current thread
|
MemoryWorkspace |
scopeOutOfWorkspaces()
This method temporary opens block out of any workspace scope.
|
void |
setDebugMode(DebugMode mode) |
void |
setDefaultWorkspaceConfiguration(WorkspaceConfiguration configuration)
This method allows to specify "Default" configuration, that will be used in signatures which do not have WorkspaceConfiguration argument
|
void |
setWorkspaceForCurrentThread(MemoryWorkspace workspace) |
void |
setWorkspaceForCurrentThread(MemoryWorkspace workspace,
String id) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createNewWorkspace, createNewWorkspace, createNewWorkspace, createNewWorkspace, getWorkspaceForCurrentThread
protected AtomicLong counter
protected WorkspaceConfiguration defaultConfiguration
protected ThreadLocal<Map<String,MemoryWorkspace>> backingMap
protected org.nd4j.linalg.primitives.SynchronizedObject<DebugMode> debugMode
@Deprecated public static final String WorkspaceDeallocatorThreadName
public BasicWorkspaceManager()
public BasicWorkspaceManager(@NonNull WorkspaceConfiguration defaultConfiguration)
public String getUUID()
getUUID
in interface MemoryWorkspaceManager
public void setDefaultWorkspaceConfiguration(@NonNull WorkspaceConfiguration configuration)
setDefaultWorkspaceConfiguration
in interface MemoryWorkspaceManager
configuration
- public MemoryWorkspace getWorkspaceForCurrentThread()
getWorkspaceForCurrentThread
in interface MemoryWorkspaceManager
public MemoryWorkspace getWorkspaceForCurrentThread(@NonNull String id)
getWorkspaceForCurrentThread
in interface MemoryWorkspaceManager
public DebugMode getDebugMode()
getDebugMode
in interface MemoryWorkspaceManager
public void setDebugMode(DebugMode mode)
setDebugMode
in interface MemoryWorkspaceManager
protected void pickReference(MemoryWorkspace workspace)
public void setWorkspaceForCurrentThread(MemoryWorkspace workspace)
setWorkspaceForCurrentThread
in interface MemoryWorkspaceManager
public void setWorkspaceForCurrentThread(@NonNull MemoryWorkspace workspace, @NonNull String id)
setWorkspaceForCurrentThread
in interface MemoryWorkspaceManager
public void destroyWorkspace(MemoryWorkspace workspace)
destroyWorkspace
in interface MemoryWorkspaceManager
workspace
- public void destroyWorkspace()
destroyWorkspace
in interface MemoryWorkspaceManager
public void destroyAllWorkspacesForCurrentThread()
destroyAllWorkspacesForCurrentThread
in interface MemoryWorkspaceManager
protected void ensureThreadExistense()
public MemoryWorkspace getAndActivateWorkspace()
getAndActivateWorkspace
in interface MemoryWorkspaceManager
public MemoryWorkspace getAndActivateWorkspace(@NonNull String id)
getAndActivateWorkspace
in interface MemoryWorkspaceManager
id
- public MemoryWorkspace getAndActivateWorkspace(@NonNull WorkspaceConfiguration configuration, @NonNull String id)
getAndActivateWorkspace
in interface MemoryWorkspaceManager
configuration
- id
- public boolean checkIfWorkspaceExists(@NonNull String id)
checkIfWorkspaceExists
in interface MemoryWorkspaceManager
id
- public boolean checkIfWorkspaceExistsAndActive(@NonNull String id)
checkIfWorkspaceExistsAndActive
in interface MemoryWorkspaceManager
public MemoryWorkspace scopeOutOfWorkspaces()
PLEASE NOTE: Do not forget to close this block.
scopeOutOfWorkspaces
in interface MemoryWorkspaceManager
public void printAllocationStatisticsForCurrentThread()
printAllocationStatisticsForCurrentThread
in interface MemoryWorkspaceManager
public List<String> getAllWorkspacesIdsForCurrentThread()
getAllWorkspacesIdsForCurrentThread
in interface MemoryWorkspaceManager
public List<MemoryWorkspace> getAllWorkspacesForCurrentThread()
getAllWorkspacesForCurrentThread
in interface MemoryWorkspaceManager
public boolean anyWorkspaceActiveForCurrentThread()
anyWorkspaceActiveForCurrentThread
in interface MemoryWorkspaceManager
Copyright © 2018. All rights reserved.