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 boolean
anyWorkspaceActiveForCurrentThread()
Determine if there are any workspaces open for the current thread.boolean
checkIfWorkspaceExists(String id)
This method checks, if Workspace with a given Id was created before this callboolean
checkIfWorkspaceExistsAndActive(String id)
This method checks, if Workspace with a given Id was created before this call, AND is active at the moment of callMemoryWorkspace
createNewWorkspace()
This method builds new Workspace with default configurationMemoryWorkspace
createNewWorkspace(WorkspaceConfiguration configuration)
This method builds new Workspace with given configurationMemoryWorkspace
createNewWorkspace(WorkspaceConfiguration configuration, String id)
This method builds new Workspace with given configurationMemoryWorkspace
createNewWorkspace(WorkspaceConfiguration configuration, String id, Integer deviceId)
This method builds new Workspace with given configurationvoid
destroyAllWorkspacesForCurrentThread()
This method destroys & deallocates all Workspaces for a calling Thread PLEASE NOTE: This method is NOT safevoid
destroyWorkspace()
This method destroys current Workspace for current Threadvoid
destroyWorkspace(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 threadMemoryWorkspace
getAndActivateWorkspace()
This method gets & activates default workspaceMemoryWorkspace
getAndActivateWorkspace(String id)
This method gets & activates workspace with a given IdMemoryWorkspace
getAndActivateWorkspace(WorkspaceConfiguration configuration, String id)
This method gets & activates default with a given configuration and IdDebugMode
getDebugMode()
This method returns current debug mode active in this JVMString
getUUID()
Returns globally unique IDMemoryWorkspace
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 configurationMemoryWorkspace
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 configurationMemoryWorkspace
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 configurationvoid
printAllocationStatisticsForCurrentThread()
This method prints out allocation statistics for current threadMemoryWorkspace
scopeOutOfWorkspaces()
This method temporary opens block out of any workspace scope.void
setDebugMode(DebugMode mode)
This method allows to enable (and pick one) global debug mode for workspaces Default value: DISABLEDvoid
setDefaultWorkspaceConfiguration(WorkspaceConfiguration configuration)
This method sets default workspace configuration for this provider instancevoid
setWorkspaceForCurrentThread(MemoryWorkspace workspace)
This method allows you to set given Workspace as default for current Threadvoid
setWorkspaceForCurrentThread(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
-
-