Package org.apache.sysds.api.mlcontext
Class ScriptExecutor
- java.lang.Object
- 
- org.apache.sysds.api.mlcontext.ScriptExecutor
 
- 
 public class ScriptExecutor extends Object ScriptExecutor executes a DML or PYDML Script object using SystemDS. This is accomplished by calling theexecute(org.apache.sysds.api.mlcontext.Script)method.Script execution via the MLContext API typically consists of the following steps: - Language Steps
 - Parse script into program
- Live variable analysis
- Validate program
 
- HOP (High-Level Operator) Steps
 - Construct HOP DAGs
- Static rewrites
- Intra-/Inter-procedural analysis
- Dynamic rewrites
- Compute memory estimates
- Rewrite persistent reads and writes (MLContext-specific)
 
- LOP (Low-Level Operator) Steps
 - Contruct LOP DAGs
- Generate runtime program
- Execute runtime program
- Dynamic recompilation
 
 Modifications to these steps can be accomplished by subclassing ScriptExecutor. For more information, please see the execute(org.apache.sysds.api.mlcontext.Script)method.
- Language Steps
 
- 
- 
Constructor SummaryConstructors Constructor Description ScriptExecutor()ScriptExecutor constructor.ScriptExecutor(DMLConfig config)ScriptExecutor constructor, where the configuration properties are passed in.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcompile(Script script)voidcompile(Script script, boolean performHOPRewrites)Compile a DML or PYDML script.MLResultsexecute(Script script)Execute a DML or PYDML script.DMLConfiggetConfig()Obtain the SystemDS configuration properties.DMLProgramgetDmlProgram()Obtain the programDMLTranslatorgetDmlTranslator()Obtain the translatorExecutionContextgetExecutionContext()Obtain the execution contextMLContext.ExecutionTypegetExecutionType()Obtain the current execution environment.ProgramgetRuntimeProgram()Obtain the runtime programScriptgetScript()Obtain the Script object associated with this ScriptExecutorbooleanisMaintainSymbolTable()Obtain whether or not all values should be maintained in the symbol table after execution.voidsetConfig(DMLConfig config)Set the SystemDS configuration properties.voidsetExecutionType(MLContext.ExecutionType executionType)Set the execution environment.voidsetExplain(boolean explain)Whether or not an explanation of the DML/PYDML program should be output to standard output.voidsetExplainLevel(MLContext.ExplainLevel explainLevel)Set the level of program explanation that should be displayed if explain is set to true.voidsetForceGPU(boolean enabled)Whether or not to force GPU usage.voidsetGPU(boolean enabled)Whether or not to enable GPU usage.voidsetInit(boolean init)Whether or not to initialize the scratch_space, bufferpool, etc.voidsetMaintainSymbolTable(boolean maintainSymbolTable)Set whether or not all values should be maintained in the symbol table after execution.voidsetStatistics(boolean statistics)Whether or not statistics about the DML/PYDML program should be output to standard output.voidsetStatisticsMaxHeavyHitters(int maxHeavyHitters)Set the maximum number of heavy hitters to display with statistics.
 
- 
- 
- 
Constructor Detail- 
ScriptExecutorpublic ScriptExecutor() ScriptExecutor constructor.
 - 
ScriptExecutorpublic ScriptExecutor(DMLConfig config) ScriptExecutor constructor, where the configuration properties are passed in.- Parameters:
- config- the configuration properties to use by the ScriptExecutor
 
 
- 
 - 
Method Detail- 
compilepublic void compile(Script script) 
 - 
compilepublic void compile(Script script, boolean performHOPRewrites) Compile a DML or PYDML script. This will help analysis of DML programs that have dynamic recompilation flag set to false without actually executing it. This is broken down into the following primary methods:- Parameters:
- script- the DML or PYDML script to compile
- performHOPRewrites- should perform static rewrites, perform intra-/inter-procedural analysis to propagate size information into functions and apply dynamic rewrites
 
 - 
executepublic MLResults execute(Script script) Execute a DML or PYDML script. This is broken down into the following primary methods:- Parameters:
- script- the DML or PYDML script to execute
- Returns:
- the results as a MLResults object
 
 - 
setConfigpublic void setConfig(DMLConfig config) Set the SystemDS configuration properties.- Parameters:
- config- The configuration properties
 
 - 
getDmlProgrampublic DMLProgram getDmlProgram() Obtain the program- Returns:
- the program
 
 - 
getDmlTranslatorpublic DMLTranslator getDmlTranslator() Obtain the translator- Returns:
- the translator
 
 - 
getRuntimeProgrampublic Program getRuntimeProgram() Obtain the runtime program- Returns:
- the runtime program
 
 - 
getExecutionContextpublic ExecutionContext getExecutionContext() Obtain the execution context- Returns:
- the execution context
 
 - 
getScriptpublic Script getScript() Obtain the Script object associated with this ScriptExecutor- Returns:
- the Script object associated with this ScriptExecutor
 
 - 
setExplainpublic void setExplain(boolean explain) Whether or not an explanation of the DML/PYDML program should be output to standard output.- Parameters:
- explain-- trueif explanation should be output,- falseotherwise
 
 - 
setStatisticspublic void setStatistics(boolean statistics) Whether or not statistics about the DML/PYDML program should be output to standard output.- Parameters:
- statistics-- trueif statistics should be output,- falseotherwise
 
 - 
setStatisticsMaxHeavyHitterspublic void setStatisticsMaxHeavyHitters(int maxHeavyHitters) Set the maximum number of heavy hitters to display with statistics.- Parameters:
- maxHeavyHitters- the maximum number of heavy hitters
 
 - 
isMaintainSymbolTablepublic boolean isMaintainSymbolTable() Obtain whether or not all values should be maintained in the symbol table after execution.- Returns:
- trueif all values should be maintained in the symbol table,- falseotherwise
 
 - 
setMaintainSymbolTablepublic void setMaintainSymbolTable(boolean maintainSymbolTable) Set whether or not all values should be maintained in the symbol table after execution.- Parameters:
- maintainSymbolTable-- trueif all values should be maintained in the symbol table,- falseotherwise
 
 - 
setInitpublic void setInit(boolean init) Whether or not to initialize the scratch_space, bufferpool, etc. Note that any redundant initialize (e.g., multiple scripts from one MLContext) clears existing files from the scratch space and buffer pool.- Parameters:
- init-- trueif should initialize,- falseotherwise
 
 - 
setExplainLevelpublic void setExplainLevel(MLContext.ExplainLevel explainLevel) Set the level of program explanation that should be displayed if explain is set to true.- Parameters:
- explainLevel- the level of program explanation
 
 - 
setGPUpublic void setGPU(boolean enabled) Whether or not to enable GPU usage.- Parameters:
- enabled-- trueif enabled,- falseotherwise
 
 - 
setForceGPUpublic void setForceGPU(boolean enabled) Whether or not to force GPU usage.- Parameters:
- enabled-- trueif enabled,- falseotherwise
 
 - 
getConfigpublic DMLConfig getConfig() Obtain the SystemDS configuration properties.- Returns:
- the configuration properties
 
 - 
getExecutionTypepublic MLContext.ExecutionType getExecutionType() Obtain the current execution environment.- Returns:
- the execution environment
 
 - 
setExecutionTypepublic void setExecutionType(MLContext.ExecutionType executionType) Set the execution environment.- Parameters:
- executionType- the execution environment
 
 
- 
 
-