Package org.nd4j.linalg.api.memory
Interface MemoryWorkspaceManager
-
- All Known Implementing Classes:
BasicWorkspaceManager
public interface MemoryWorkspaceManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleananyWorkspaceActiveForCurrentThread()Determine if there are any workspaces open for the current thread.booleancheckIfWorkspaceExists(String id)This method checks, if Workspace with a given Id was created before this callbooleancheckIfWorkspaceExistsAndActive(String id)This method checks, if Workspace with a given Id was created before this call, AND is active at the moment of callMemoryWorkspacecreateNewWorkspace()This method builds new Workspace with default configurationMemoryWorkspacecreateNewWorkspace(WorkspaceConfiguration configuration)This method builds new Workspace with given configurationMemoryWorkspacecreateNewWorkspace(WorkspaceConfiguration configuration, String id)This method builds new Workspace with given configurationMemoryWorkspacecreateNewWorkspace(WorkspaceConfiguration configuration, String id, Integer deviceId)This method builds new Workspace with given configurationvoiddestroyAllWorkspacesForCurrentThread()This method destroys & deallocates all Workspaces for a calling Thread PLEASE NOTE: This method is NOT safevoiddestroyWorkspace()This method destroys current Workspace for current ThreadvoiddestroyWorkspace(MemoryWorkspace workspace)This method allows you to destroy given WorkspaceList<MemoryWorkspace>getAllWorkspacesForCurrentThread()This method returns all workspaces for current threadList<String>getAllWorkspacesIdsForCurrentThread()This method returns list of workspace IDs for current threadMemoryWorkspacegetAndActivateWorkspace()This method gets & activates default workspaceMemoryWorkspacegetAndActivateWorkspace(String id)This method gets & activates workspace with a given IdMemoryWorkspacegetAndActivateWorkspace(WorkspaceConfiguration configuration, String id)This method gets & activates default with a given configuration and IdDebugModegetDebugMode()This method returns current debug mode active in this JVMStringgetUUID()Returns globally unique IDMemoryWorkspacegetWorkspaceForCurrentThread()This method returns you current default Workspace for current Thread PLEASE NOTE: If Workspace wasn't defined, new Workspace will be created using current default configurationMemoryWorkspacegetWorkspaceForCurrentThread(String id)This method returns you Workspace for a given Id for current Thread PLEASE NOTE: If Workspace wasn't defined, new Workspace will be created using current default configurationMemoryWorkspacegetWorkspaceForCurrentThread(WorkspaceConfiguration configuration, String id)This method returns you Workspace for a given Id for current Thread PLEASE NOTE: If Workspace wasn't defined, new Workspace will be created using given configurationvoidprintAllocationStatisticsForCurrentThread()This method prints out allocation statistics for current threadMemoryWorkspacescopeOutOfWorkspaces()This method temporary opens block out of any workspace scope.voidsetDebugMode(DebugMode mode)This method allows to enable (and pick one) global debug mode for workspaces Default value: DISABLEDvoidsetDefaultWorkspaceConfiguration(WorkspaceConfiguration configuration)This method sets default workspace configuration for this provider instancevoidsetWorkspaceForCurrentThread(MemoryWorkspace workspace)This method allows you to set given Workspace as default for current ThreadvoidsetWorkspaceForCurrentThread(MemoryWorkspace workspace, String id)This method allows you to set given Workspace for spacific Id for current Thread
-
-
-
Method Detail
-
getUUID
String getUUID()
Returns globally unique ID- Returns:
-
getDebugMode
DebugMode getDebugMode()
This method returns current debug mode active in this JVM- Returns:
-
setDebugMode
void setDebugMode(DebugMode mode)
This method allows to enable (and pick one) global debug mode for workspaces Default value: DISABLED- Parameters:
mode-
-
setDefaultWorkspaceConfiguration
void setDefaultWorkspaceConfiguration(WorkspaceConfiguration configuration)
This method sets default workspace configuration for this provider instance- Parameters:
configuration-
-
createNewWorkspace
MemoryWorkspace createNewWorkspace(WorkspaceConfiguration configuration)
This method builds new Workspace with given configuration- Parameters:
configuration-- Returns:
-
createNewWorkspace
MemoryWorkspace createNewWorkspace()
This method builds new Workspace with default configuration- Returns:
-
createNewWorkspace
MemoryWorkspace createNewWorkspace(WorkspaceConfiguration configuration, String id)
This method builds new Workspace with given configuration- Parameters:
configuration-- Returns:
-
createNewWorkspace
MemoryWorkspace createNewWorkspace(WorkspaceConfiguration configuration, String id, Integer deviceId)
This method builds new Workspace with given configuration- Parameters:
configuration-- Returns:
-
getWorkspaceForCurrentThread
MemoryWorkspace getWorkspaceForCurrentThread()
This method returns you current default Workspace for current Thread PLEASE NOTE: If Workspace wasn't defined, new Workspace will be created using current default configuration- Returns:
-
getWorkspaceForCurrentThread
MemoryWorkspace getWorkspaceForCurrentThread(String id)
This method returns you Workspace for a given Id for current Thread PLEASE NOTE: If Workspace wasn't defined, new Workspace will be created using current default configuration- Returns:
-
getWorkspaceForCurrentThread
MemoryWorkspace getWorkspaceForCurrentThread(WorkspaceConfiguration configuration, String id)
This method returns you Workspace for a given Id for current Thread PLEASE NOTE: If Workspace wasn't defined, new Workspace will be created using given configuration- Returns:
-
setWorkspaceForCurrentThread
void setWorkspaceForCurrentThread(MemoryWorkspace workspace)
This method allows you to set given Workspace as default for current Thread- Parameters:
workspace-
-
setWorkspaceForCurrentThread
void setWorkspaceForCurrentThread(MemoryWorkspace workspace, String id)
This method allows you to set given Workspace for spacific Id for current Thread- Parameters:
workspace-
-
destroyWorkspace
void destroyWorkspace(MemoryWorkspace workspace)
This method allows you to destroy given Workspace- Parameters:
workspace-
-
destroyAllWorkspacesForCurrentThread
void destroyAllWorkspacesForCurrentThread()
This method destroys & deallocates all Workspaces for a calling Thread PLEASE NOTE: This method is NOT safe
-
destroyWorkspace
void destroyWorkspace()
This method destroys current Workspace for current Thread
-
getAndActivateWorkspace
MemoryWorkspace getAndActivateWorkspace()
This method gets & activates default workspace- Returns:
-
getAndActivateWorkspace
MemoryWorkspace getAndActivateWorkspace(String id)
This method gets & activates workspace with a given Id- Returns:
-
getAndActivateWorkspace
MemoryWorkspace getAndActivateWorkspace(WorkspaceConfiguration configuration, String id)
This method gets & activates default with a given configuration and Id- Returns:
-
checkIfWorkspaceExists
boolean checkIfWorkspaceExists(String id)
This method checks, if Workspace with a given Id was created before this call- Parameters:
id-- Returns:
-
checkIfWorkspaceExistsAndActive
boolean checkIfWorkspaceExistsAndActive(String id)
This method checks, if Workspace with a given Id was created before this call, AND is active at the moment of call- Parameters:
id-- Returns:
-
scopeOutOfWorkspaces
MemoryWorkspace scopeOutOfWorkspaces()
This method temporary opens block out of any workspace scope. PLEASE NOTE: Do not forget to close this block.- Returns:
-
printAllocationStatisticsForCurrentThread
void printAllocationStatisticsForCurrentThread()
This method prints out allocation statistics for current thread
-
getAllWorkspacesIdsForCurrentThread
List<String> getAllWorkspacesIdsForCurrentThread()
This method returns list of workspace IDs for current thread- Returns:
-
getAllWorkspacesForCurrentThread
List<MemoryWorkspace> getAllWorkspacesForCurrentThread()
This method returns all workspaces for current thread
-
anyWorkspaceActiveForCurrentThread
boolean anyWorkspaceActiveForCurrentThread()
Determine if there are any workspaces open for the current thread.- Returns:
- True if any workspaces are open for this thread, false otherwise
-
-