Class OptNode
- java.lang.Object
-
- org.apache.sysds.runtime.controlprogram.parfor.opt.OptNode
-
public class OptNode extends Object
Internal representation of a plan alternative for program blocks and instructions in order to enable efficient and simple recursive enumeration and plan changes. This is only used within the optimizer and therefore not visible to any other component.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOptNode.ExecTypestatic classOptNode.NodeTypestatic classOptNode.ParamType
-
Constructor Summary
Constructors Constructor Description OptNode(OptNode.NodeType type)OptNode(OptNode.NodeType ntype, OptNode.ExecType etype)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChild(OptNode child)voidaddChilds(ArrayList<OptNode> childs)voidaddParam(OptNode.ParamType ptype, String val)voidcheckAndCleanupLeafNodes()voidcheckAndCleanupRecursiveFunc(Set<String> stack)booleanexchangeChild(OptNode oldNode, OptNode newNode)Stringexplain(int level, boolean withDetails)Explain tool: prints the hierarchical plan tostdout.intgetBeginLine()ArrayList<OptNode>getChilds()intgetEndLine()OptNode.ExecTypegetExecType()longgetID()StringgetInstructionName()intgetK()longgetMaxC(long N)longgetMaxProblemSize()Determines the maximum problem size, in terms of the maximum total number of inner loop iterations, of the entire subtree.Collection<OptNode>getNodeList()Collection<OptNode>getNodeList(OptNode.ExecType et)OptNode.NodeTypegetNodeType()StringgetParam(OptNode.ParamType type)Collection<OptNode>getRelevantNodeList()intgetTotalK()booleanhasNestedParallelism(boolean flagNested)booleanhasNestedPartitionReads(boolean flagNested)booleanhasOnlySimpleChilds()booleanisCPOnly()Determines if all program blocks and instructions exhibit the execution type CP.booleanisLeaf()booleanisNodeType(OptNode.NodeType... types)booleanisRecursive()voidsetBeginLine(int line)voidsetChilds(ArrayList<OptNode> childs)voidsetEndLine(int line)voidsetExecType(OptNode.ExecType type)voidsetID(long id)voidsetK(int k)voidsetLineNumbers(int begin, int end)voidsetNodeType(OptNode.NodeType type)voidsetParams(HashMap<OptNode.ParamType,String> params)voidsetSerialParFor()Set the plan to a parallel degree of 1 (serial execution).intsize()Gets the number of plan nodes.
-
-
-
Constructor Detail
-
OptNode
public OptNode(OptNode.NodeType type)
-
OptNode
public OptNode(OptNode.NodeType ntype, OptNode.ExecType etype)
-
-
Method Detail
-
getNodeType
public OptNode.NodeType getNodeType()
-
setNodeType
public void setNodeType(OptNode.NodeType type)
-
isNodeType
public boolean isNodeType(OptNode.NodeType... types)
-
getExecType
public OptNode.ExecType getExecType()
-
setExecType
public void setExecType(OptNode.ExecType type)
-
setID
public void setID(long id)
-
getID
public long getID()
-
addParam
public void addParam(OptNode.ParamType ptype, String val)
-
setParams
public void setParams(HashMap<OptNode.ParamType,String> params)
-
getParam
public String getParam(OptNode.ParamType type)
-
getBeginLine
public int getBeginLine()
-
setBeginLine
public void setBeginLine(int line)
-
getEndLine
public int getEndLine()
-
setEndLine
public void setEndLine(int line)
-
setLineNumbers
public void setLineNumbers(int begin, int end)
-
addChild
public void addChild(OptNode child)
-
getK
public int getK()
-
setK
public void setK(int k)
-
isLeaf
public boolean isLeaf()
-
hasOnlySimpleChilds
public boolean hasOnlySimpleChilds()
-
getInstructionName
public String getInstructionName()
-
isRecursive
public boolean isRecursive()
-
getNodeList
public Collection<OptNode> getNodeList()
-
getNodeList
public Collection<OptNode> getNodeList(OptNode.ExecType et)
-
getRelevantNodeList
public Collection<OptNode> getRelevantNodeList()
-
setSerialParFor
public void setSerialParFor()
Set the plan to a parallel degree of 1 (serial execution).
-
size
public int size()
Gets the number of plan nodes.- Returns:
- number of plan nodes
-
isCPOnly
public boolean isCPOnly()
Determines if all program blocks and instructions exhibit the execution type CP.- Returns:
- true of all program blocks and instructions execute on CP
-
getTotalK
public int getTotalK()
-
getMaxC
public long getMaxC(long N)
-
hasNestedParallelism
public boolean hasNestedParallelism(boolean flagNested)
-
hasNestedPartitionReads
public boolean hasNestedPartitionReads(boolean flagNested)
-
checkAndCleanupLeafNodes
public void checkAndCleanupLeafNodes()
-
explain
public String explain(int level, boolean withDetails)
Explain tool: prints the hierarchical plan tostdout.- Parameters:
level- depth to print?withDetails- if true, explain details- Returns:
- string explanation
-
getMaxProblemSize
public long getMaxProblemSize()
Determines the maximum problem size, in terms of the maximum total number of inner loop iterations, of the entire subtree.- Returns:
- maximum problem size
-
-