Package org.apache.sysds.hops.cost
Class HopRel
- java.lang.Object
-
- org.apache.sysds.hops.cost.HopRel
-
public class HopRel extends Object
HopRel provides a representation of the relation between a hop, the cost of setting a given FederatedOutput value, and the input dependency with the given FederatedOutput value. The HopRel class is used when building and selecting an optimal federated execution plan in IPAPassRewriteFederatedPlan. The input dependency is needed to hold the valid and optimal FederatedOutput values for the inputs.
-
-
Constructor Summary
Constructors Constructor Description HopRel(Hop associatedHop, FEDInstruction.FederatedOutput fedOut, FTypes.FType fType, MemoTable hopRelMemo, ArrayList<Hop> inputs)
Constructs a HopRel with input dependency and cost estimate based on entries in hopRelMemo.HopRel(Hop associatedHop, FEDInstruction.FederatedOutput fedOut, FTypes.FType fType, MemoTable hopRelMemo, List<Hop> inputs, List<FTypes.FType> inputDependency)
HopRel(Hop associatedHop, FEDInstruction.FederatedOutput fedOut, MemoTable hopRelMemo)
Constructs a HopRel with input dependency and cost estimate based on entries in hopRelMemo.HopRel(Hop associatedHop, FEDInstruction.FederatedOutput fedOut, MemoTable hopRelMemo, ArrayList<Hop> inputs)
Constructs a HopRel with input dependency and cost estimate based on entries in hopRelMemo.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCostPointer(long hopID)
Adds hopID to set of hops pointing to this HopRel.boolean
existingCostPointer(long currentHopID)
Checks if another Hop is refering to this HopRel in memo table.double
getCost()
Get total cost as doubleFederatedCost
getCostObject()
Get cost objectTypes.ExecType
getExecType()
FEDInstruction.FederatedOutput
getFederatedOutput()
FTypes.FType
getFType()
Hop
getHopRef()
List<HopRel>
getInputDependency()
boolean
hasFederatedOutput()
boolean
hasLocalOutput()
void
setFType(FTypes.FType fType)
String
toString()
-
-
-
Constructor Detail
-
HopRel
public HopRel(Hop associatedHop, FEDInstruction.FederatedOutput fedOut, MemoTable hopRelMemo)
Constructs a HopRel with input dependency and cost estimate based on entries in hopRelMemo.- Parameters:
associatedHop
- hop associated with this HopRelfedOut
- FederatedOutput value assigned to this HopRelhopRelMemo
- memo table storing other HopRels including the inputs of associatedHop
-
HopRel
public HopRel(Hop associatedHop, FEDInstruction.FederatedOutput fedOut, MemoTable hopRelMemo, ArrayList<Hop> inputs)
Constructs a HopRel with input dependency and cost estimate based on entries in hopRelMemo.- Parameters:
associatedHop
- hop associated with this HopRelfedOut
- FederatedOutput value assigned to this HopRelhopRelMemo
- memo table storing other HopRels including the inputs of associatedHopinputs
- hop inputs which input dependencies and cost is based on
-
HopRel
public HopRel(Hop associatedHop, FEDInstruction.FederatedOutput fedOut, FTypes.FType fType, MemoTable hopRelMemo, ArrayList<Hop> inputs)
Constructs a HopRel with input dependency and cost estimate based on entries in hopRelMemo.- Parameters:
associatedHop
- hop associated with this HopRelfedOut
- FederatedOutput value assigned to this HopRelfType
- Federated Type of the output of this hopRelhopRelMemo
- memo table storing other HopRels including the inputs of associatedHopinputs
- hop inputs which input dependencies and cost is based on
-
HopRel
public HopRel(Hop associatedHop, FEDInstruction.FederatedOutput fedOut, FTypes.FType fType, MemoTable hopRelMemo, List<Hop> inputs, List<FTypes.FType> inputDependency)
-
-
Method Detail
-
addCostPointer
public void addCostPointer(long hopID)
Adds hopID to set of hops pointing to this HopRel. By storing the hopID it can later be determined if the cost stored in this HopRel is already used as input cost in another HopRel.- Parameters:
hopID
- added to set of stored cost pointers
-
existingCostPointer
public boolean existingCostPointer(long currentHopID)
Checks if another Hop is refering to this HopRel in memo table. A reference from a HopRel with same Hop ID is allowed, so this ID is ignored when checking references.- Parameters:
currentHopID
- to ignore when checking references- Returns:
- true if another Hop refers to this HopRel in memo table
-
hasLocalOutput
public boolean hasLocalOutput()
-
hasFederatedOutput
public boolean hasFederatedOutput()
-
getFederatedOutput
public FEDInstruction.FederatedOutput getFederatedOutput()
-
getHopRef
public Hop getHopRef()
-
getFType
public FTypes.FType getFType()
-
setFType
public void setFType(FTypes.FType fType)
-
getExecType
public Types.ExecType getExecType()
-
getCost
public double getCost()
Get total cost as double- Returns:
- cost as double
-
getCostObject
public FederatedCost getCostObject()
Get cost object- Returns:
- cost object
-
-