Package org.apache.sysds.runtime.controlprogram.parfor.opt

# 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 enum`
`OptNode.ExecType`
`static enum`
`OptNode.NodeType`
`static enum`
`OptNode.ParamType`

## Constructor Summary

Constructors
Constructor
Description
`OptNode(OptNode.NodeType type)`
`OptNode(OptNode.NodeType ntype, OptNode.ExecType etype)`

## Method Summary

Modifier and Type
Method
Description
`void`
`addChild(OptNode child)`
`void`
`addChilds(List<OptNode> childs)`
`void`
`addParam(OptNode.ParamType ptype, String val)`
`void`
`checkAndCleanupLeafNodes()`
`void`
`checkAndCleanupRecursiveFunc(Set<String> stack)`
`boolean`
`exchangeChild(OptNode oldNode, OptNode newNode)`
`String`
`explain(int level, boolean withDetails)`
Explain tool: prints the hierarchical plan to `stdout`.
`int`
`getBeginLine()`
`List<OptNode>`
`getChilds()`
`int`
`getEndLine()`
`OptNode.ExecType`
`getExecType()`
`long`
`getID()`
`String`
`getInstructionName()`
`int`
`getK()`
`long`
`getMaxC(long N)`
`long`
`getMaxProblemSize()`
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.NodeType`
`getNodeType()`
`String`
`getParam(OptNode.ParamType type)`
`Collection<OptNode>`
`getRelevantNodeList()`
`int`
`getTotalK()`
`boolean`
`hasNestedParallelism(boolean flagNested)`
`boolean`
`hasNestedPartitionReads(boolean flagNested)`
`boolean`
`hasOnlySimpleChilds()`
`boolean`
`isCPOnly()`
Determines if all program blocks and instructions exhibit the execution type CP.
`boolean`
`isLeaf()`
`boolean`
`isNodeType(OptNode.NodeType... types)`
`boolean`
`isRecursive()`
`void`
`setBeginLine(int line)`
`void`
`setChilds(List<OptNode> childs)`
`void`
`setEndLine(int line)`
`void`
`setExecType(OptNode.ExecType type)`
`void`
`setID(long id)`
`void`
`setK(int k)`
`void`
`setLineNumbers(int begin, int end)`
`void`
`setNodeType(OptNode.NodeType type)`
`void`
`setParams(HashMap<OptNode.ParamType,String> params)`
`void`
`setSerialParFor()`
Set the plan to a parallel degree of 1 (serial execution).
`int`
`size()`
Gets the number of plan nodes.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### OptNode

public OptNode(OptNode.NodeType type)

### OptNode

public OptNode(OptNode.NodeType ntype, OptNode.ExecType etype)

## Method Details

### 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)

### addChilds

public void addChilds(List<OptNode> childs)

### setChilds

public void setChilds(List<OptNode> childs)

### getChilds

public List<OptNode> getChilds()

### getK

public int getK()

### setK

public void setK(int k)

### exchangeChild

public boolean exchangeChild(OptNode oldNode, OptNode newNode)

### 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()

### checkAndCleanupRecursiveFunc

public void checkAndCleanupRecursiveFunc(Set<String> stack)

### explain

public String explain(int level, boolean withDetails)
Explain tool: prints the hierarchical plan to `stdout`.

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