Package org.apache.sysds.resource
Class ResourceCompiler
- java.lang.Object
 - 
- org.apache.sysds.resource.ResourceCompiler
 
 
- 
public class ResourceCompiler extends Object
This class does full or partial program recompilation based on given runtime program. It uses the methods provided byhops.recompile.Recompiler). It keeps a state of the current recompilation phase in order to decide when to do full recompilation and when not. 
- 
- 
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_DRIVER_MEMORYstatic intDEFAULT_DRIVER_THREADSstatic longDEFAULT_EXECUTOR_MEMORYstatic intDEFAULT_EXECUTOR_THREADSstatic intDEFAULT_NUMBER_EXECUTORS 
- 
Constructor Summary
Constructors Constructor Description ResourceCompiler() 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Programcompile(String filePath, Map<String,String> args)static Programcompile(String filePath, Map<String,String> args, HashMap<String,String> replaceVars)static ProgramdoFullRecompilation(Program program)Recompiling a given program for resource optimization.static voidreplaceFilename(DMLProgram dmlp, HashMap<String,String> replaceVars)static voidsetSingleNodeResourceConfigs(long nodeMemory, int nodeCores)Sets resource configurations for executions in single-node mode including the hardware configurations for the node running the CP.static voidsetSparkClusterResourceConfigs(long driverMemory, int driverCores, int numExecutors, long executorMemory, int executorCores)Sets resource configurations for executions in hybrid mode including the hardware configurations for the node running the CP and the worker nodes running Spark executors 
 - 
 
- 
- 
Field Detail
- 
DEFAULT_DRIVER_MEMORY
public static final long DEFAULT_DRIVER_MEMORY
- See Also:
 - Constant Field Values
 
 
- 
DEFAULT_DRIVER_THREADS
public static final int DEFAULT_DRIVER_THREADS
- See Also:
 - Constant Field Values
 
 
- 
DEFAULT_EXECUTOR_MEMORY
public static final long DEFAULT_EXECUTOR_MEMORY
- See Also:
 - Constant Field Values
 
 
- 
DEFAULT_EXECUTOR_THREADS
public static final int DEFAULT_EXECUTOR_THREADS
- See Also:
 - Constant Field Values
 
 
- 
DEFAULT_NUMBER_EXECUTORS
public static final int DEFAULT_NUMBER_EXECUTORS
- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
compile
public static Program compile(String filePath, Map<String,String> args) throws IOException
- Throws:
 IOException
 
- 
compile
public static Program compile(String filePath, Map<String,String> args, HashMap<String,String> replaceVars) throws IOException
- Throws:
 IOException
 
- 
replaceFilename
public static void replaceFilename(DMLProgram dmlp, HashMap<String,String> replaceVars)
 
- 
doFullRecompilation
public static Program doFullRecompilation(Program program)
Recompiling a given program for resource optimization. This method should always be called after setting the target resources toInfrastructureAnalyzerandSparkExecutionContext- Parameters:
 program- program to be recompiled- Returns:
 - the recompiled program as a new 
Programinstance 
 
- 
setSingleNodeResourceConfigs
public static void setSingleNodeResourceConfigs(long nodeMemory, int nodeCores)Sets resource configurations for executions in single-node mode including the hardware configurations for the node running the CP.- Parameters:
 nodeMemory- memory budget for the node running CPnodeCores- number of CPU cores for the node running CP
 
- 
setSparkClusterResourceConfigs
public static void setSparkClusterResourceConfigs(long driverMemory, int driverCores, int numExecutors, long executorMemory, int executorCores)Sets resource configurations for executions in hybrid mode including the hardware configurations for the node running the CP and the worker nodes running Spark executors- Parameters:
 driverMemory- memory budget for the node running CPdriverCores- number of CPU cores for the node running CPnumExecutors- number of nodes in clusterexecutorMemory- memory budget for the nodes running executorsexecutorCores- number of CPU cores for the nodes running executors
 
 - 
 
 -