Xiao-zhen-Liu commented on code in PR #3550:
URL: https://github.com/apache/texera/pull/3550#discussion_r2286868166
##########
core/amber/src/main/scala/edu/uci/ics/amber/engine/architecture/scheduling/CostBasedScheduleGenerator.scala:
##########
@@ -601,16 +589,31 @@ class CostBasedScheduleGenerator(
}
/**
- * The cost function used by the search. Takes a region plan, generates one
or more (to be done in the future)
- * schedules based on the region plan, and calculates the cost of the
schedule(s) using Cost Estimator. Uses the cost
- * of the best schedule (currently only considers one schedule) as the cost
of the region plan.
+ * Takes a region DAG, generates one or more (to be done in the future)
schedules based on the region DAG, allocates
+ * resources to each region in the region DAG, and calculates the cost of
the schedule(s) using Cost Estimator. Uses
+ * the cost of the best schedule (currently only considers one schedule) as
the cost of the region DAG.
*
* @return A cost determined by the cost estimator.
*/
- private def evaluate(regionPlan: RegionPlan): Double = {
+ private def allocateResourcesAndEvaluateCost(
+ regionDAG: DirectedAcyclicGraph[Region, RegionLink]
+ ): Double = {
+ val regionPlan =
+ RegionPlan(regionDAG.vertexSet().asScala.toSet,
regionDAG.edgeSet().asScala.toSet)
val schedule = generateScheduleFromRegionPlan(regionPlan)
// In the future we may allow multiple regions in a level and split the
resources.
- schedule.map(level => level.map(region => costEstimator.estimate(region,
1)).sum).sum
+ schedule
+ .map(level =>
+ level
+ .map(region => {
+ val (newRegion, regionCost) =
costEstimator.allocateResourcesAndEstimateCost(region, 1)
Review Comment:
Done
##########
core/amber/src/main/scala/edu/uci/ics/amber/engine/architecture/scheduling/CostEstimator.scala:
##########
@@ -73,14 +85,21 @@ class DefaultCostEstimator(
case Some(_) =>
}
- override def estimate(region: Region, resourceUnits: Int): Double = {
- this.operatorEstimatedTimeOption match {
+ override def allocateResourcesAndEstimateCost(
+ region: Region,
+ resourceUnits: Int
+ ): (Region, Double) = {
+ // Currently the dummy cost from resourceAllocator is discarded.
+ val (newRegion, _) = resourceAllocator.allocate(region)
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]