Package org.apache.sysds.hops.fedplanner
Class FederatedPlanCostEstimator
- java.lang.Object
-
- org.apache.sysds.hops.fedplanner.FederatedPlanCostEstimator
-
public class FederatedPlanCostEstimator extends Object
Cost estimator for federated execution plans. Calculates computation, memory access, and network transfer costs for federated operations. Works in conjunction with FederatedMemoTable to evaluate different execution plan variants.
-
-
Constructor Summary
Constructors Constructor Description FederatedPlanCostEstimator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
computeHopCost(FederatedMemoTable.HopCommon hopCommon)
Computes the cost associated with a given Hop node.static void
getChildCosts(FederatedMemoTable.HopCommon hopCommon, FederatedMemoTable memoTable, List<Hop> inputHops, double[][] childCumulativeCost, double[] childForwardingCost)
static LinkedHashMap<FederatedMemoTable.FedPlan,Boolean>
resolveConflictFedPlan(FederatedMemoTable memoTable, LinkedHashMap<Long,List<FederatedMemoTable.FedPlan>> conflictFedPlanLinkedMap, double[] cumulativeAdditionalCost)
Resolves conflicts in federated plans where different plans have different FederatedOutput types.
-
-
-
Method Detail
-
getChildCosts
public static void getChildCosts(FederatedMemoTable.HopCommon hopCommon, FederatedMemoTable memoTable, List<Hop> inputHops, double[][] childCumulativeCost, double[] childForwardingCost)
-
computeHopCost
public static double computeHopCost(FederatedMemoTable.HopCommon hopCommon)
Computes the cost associated with a given Hop node. This method calculates both the self cost and the forwarding cost for the Hop, taking into account its type and the number of parent nodes.- Parameters:
hopCommon
- The HopCommon object containing the Hop and its properties.- Returns:
- The self cost of the Hop.
-
resolveConflictFedPlan
public static LinkedHashMap<FederatedMemoTable.FedPlan,Boolean> resolveConflictFedPlan(FederatedMemoTable memoTable, LinkedHashMap<Long,List<FederatedMemoTable.FedPlan>> conflictFedPlanLinkedMap, double[] cumulativeAdditionalCost)
Resolves conflicts in federated plans where different plans have different FederatedOutput types. This function traverses the list of conflicting plans in reverse order to ensure that conflicts are resolved from the bottom-up, allowing for consistent federated output types across the plan. It calculates additional costs for each potential resolution and updates the cumulative additional cost.- Parameters:
memoTable
- The FederatedMemoTable containing all federated plan variants.conflictFedPlanLinkedMap
- A map of plan IDs to lists of parent plans with conflicting federated outputs.cumulativeAdditionalCost
- An array to store the cumulative additional cost incurred by resolving conflicts.- Returns:
- A LinkedHashMap of resolved federated plans, marked with a boolean indicating resolution status.
-
-