public class MLContext extends Object
Modifier and Type | Class and Description |
---|---|
static class |
MLContext.ExecutionType
The different types of execution environments supported by SystemML.
|
static class |
MLContext.ExplainLevel
The different explain levels supported by SystemML.
|
class |
MLContext.InternalProxy
Used internally by MLContextProxy.
|
Modifier and Type | Field and Description |
---|---|
protected static org.apache.log4j.Logger |
log
Logger for MLContext
|
Constructor and Description |
---|
MLContext(org.apache.spark.api.java.JavaSparkContext javaSparkContext)
Create an MLContext based on a JavaSparkContext for interaction with
SystemML on Spark.
|
MLContext(org.apache.spark.SparkContext sparkContext)
Create an MLContext based on a SparkContext for interaction with SystemML
on Spark.
|
MLContext(org.apache.spark.sql.SparkSession spark)
Create an MLContext based on a SparkSession for interaction with SystemML
on Spark.
|
Modifier and Type | Method and Description |
---|---|
String |
buildTime()
Obtain the SystemML jar file build time.
|
void |
close()
Closes the mlcontext, which includes the cleanup of static and local
state as well as scratch space and buffer pool cleanup.
|
MLResults |
execute(Script script)
Execute a DML or PYDML Script.
|
MLResults |
execute(Script script,
ScriptExecutor scriptExecutor)
Execute a DML or PYDML Script object using a ScriptExecutor.
|
static MLContext |
getActiveMLContext()
Retrieve the currently active MLContext.
|
MLContext.ExecutionType |
getExecutionType()
Obtain the current execution environment.
|
MLContext.InternalProxy |
getInternalProxy()
Used internally by MLContextProxy.
|
org.apache.spark.sql.SparkSession |
getSparkSession()
Obtain the SparkSession associated with this MLContext.
|
int |
getStatisticsMaxHeavyHitters()
Obtain the maximum number of heavy hitters that are printed out as part
of the statistics.
|
ProjectInfo |
info()
Obtain information about the project such as version and build time from
the manifest in the SystemML jar file.
|
boolean |
isExplain()
Whether or not an explanation of the DML/PYDML program should be output
to standard output.
|
boolean |
isForceGPU()
Whether or not the "force" GPU mode is enabled.
|
boolean |
isGPU()
Whether or not the GPU mode is enabled.
|
boolean |
isInitBeforeExecution()
Whether or not the default ScriptExecutor should be initialized before
execution.
|
boolean |
isMaintainSymbolTable()
Obtain whether or not all values should be maintained in the symbol table
after execution.
|
boolean |
isStatistics()
Whether or not statistics of the DML/PYDML program execution should be
output to standard output.
|
void |
resetConfig()
Reset configuration settings to default settings.
|
void |
setConfig(String configFilePath)
Set SystemML configuration based on a configuration file.
|
void |
setConfigProperty(String propertyName,
String propertyValue)
Set configuration property, such as
setConfigProperty("sysml.localtmpdir", "/tmp/systemml") . |
void |
setExecutionScript(Script executionScript)
Sets the script that is being executed
|
void |
setExecutionType(MLContext.ExecutionType executionType)
Set the execution environment.
|
void |
setExplain(boolean explain)
Whether or not an explanation of the DML/PYDML program should be output
to standard output.
|
void |
setExplainLevel(MLContext.ExplainLevel explainLevel)
Set the level of program explanation that should be displayed if explain
is set to true.
|
void |
setExplainLevel(String explainLevel)
Set the level of program explanation that should be displayed if explain
is set to true.
|
void |
setForceGPU(boolean enable)
Whether or not to explicitly "force" the usage of GPU.
|
void |
setGPU(boolean enable)
Whether or not to use (an available) GPU on the driver node.
|
void |
setInitBeforeExecution(boolean initBeforeExecution)
Whether or not the default ScriptExecutor should be initialized before
execution.
|
void |
setMaintainSymbolTable(boolean maintainSymbolTable)
Set whether or not all values should be maintained in the symbol table
after execution.
|
void |
setStatistics(boolean statistics)
Whether or not statistics of the DML/PYDML program execution should be
output to standard output.
|
void |
setStatisticsMaxHeavyHitters(int maxHeavyHitters)
Sets the maximum number of heavy hitters that are printed out as part of
the statistics.
|
String |
version()
Obtain the SystemML version number.
|
public MLContext(org.apache.spark.sql.SparkSession spark)
spark
- SparkSessionpublic MLContext(org.apache.spark.SparkContext sparkContext)
sparkContext
- SparkContextpublic MLContext(org.apache.spark.api.java.JavaSparkContext javaSparkContext)
javaSparkContext
- JavaSparkContextpublic static MLContext getActiveMLContext()
public void resetConfig()
public void setConfigProperty(String propertyName, String propertyValue)
setConfigProperty("sysml.localtmpdir", "/tmp/systemml")
.propertyName
- property namepropertyValue
- property valuepublic MLResults execute(Script script)
script
- The DML or PYDML Script object to execute.public MLResults execute(Script script, ScriptExecutor scriptExecutor)
script
- the DML or PYDML Script objectscriptExecutor
- the ScriptExecutor that defines the script execution pathwaypublic void setExecutionScript(Script executionScript)
executionScript
- script that is being executedpublic void setConfig(String configFilePath)
configFilePath
- path to the configuration filepublic org.apache.spark.sql.SparkSession getSparkSession()
public boolean isExplain()
true
if explanation should be output, false
otherwisepublic void setExplain(boolean explain)
explain
- true
if explanation should be output, false
otherwisepublic boolean isMaintainSymbolTable()
true
if all values should be maintained in the symbol
table, false
otherwisepublic void setMaintainSymbolTable(boolean maintainSymbolTable)
maintainSymbolTable
- true
if all values should be maintained in the symbol
table, false
otherwisepublic void setExplainLevel(MLContext.ExplainLevel explainLevel)
explainLevel
- the level of program explanationpublic void setExplainLevel(String explainLevel)
explainLevel
- string denoting program explanationpublic void setGPU(boolean enable)
enable
- true if needs to be enabled, false otherwisepublic void setForceGPU(boolean enable)
enable
- true if needs to be enabled, false otherwisepublic boolean isGPU()
public boolean isForceGPU()
public MLContext.InternalProxy getInternalProxy()
public boolean isStatistics()
true
if statistics should be output, false
otherwisepublic void setStatistics(boolean statistics)
statistics
- true
if statistics should be output, false
otherwisepublic void setStatisticsMaxHeavyHitters(int maxHeavyHitters)
maxHeavyHitters
- maximum number of heavy hitters to printpublic void close()
public ProjectInfo info()
public String version()
public String buildTime()
public int getStatisticsMaxHeavyHitters()
public boolean isInitBeforeExecution()
true
if ScriptExecutor should be initialized before
execution, false
otherwisepublic void setInitBeforeExecution(boolean initBeforeExecution)
initBeforeExecution
- true
if ScriptExecutor should be initialized before
execution, false
otherwisepublic MLContext.ExecutionType getExecutionType()
public void setExecutionType(MLContext.ExecutionType executionType)
executionType
- the execution environmentCopyright © 2017 The Apache Software Foundation. All rights reserved.