@@ -551,13 +551,13 @@ current estimated per-processor compute pressure, and transfer costs for each
551
551
`Chunk` argument to `task`. Returns `(procs, costs)`, with `procs` sorted in
552
552
order of ascending cost.
553
553
"""
554
- function estimate_task_costs (state, procs, task)
554
+ function estimate_task_costs (state, procs, task; sig = nothing )
555
555
sorted_procs = Vector {Processor} (undef, length (procs))
556
556
costs = Dict {Processor,Float64} ()
557
- estimate_task_costs! (sorted_procs, costs, state, procs, task)
557
+ estimate_task_costs! (sorted_procs, costs, state, procs, task; sig )
558
558
return sorted_procs, costs
559
559
end
560
- @reuse_scope function estimate_task_costs! (sorted_procs, costs, state, procs, task)
560
+ @reuse_scope function estimate_task_costs! (sorted_procs, costs, state, procs, task; sig = nothing )
561
561
tx_rate = state. transfer_rate[]
562
562
563
563
# Find all Chunks
569
569
end
570
570
end
571
571
572
+ # Estimate the cost of executing the task itself
573
+ if sig === nothing
574
+ sig = signature (task. f, task. inputs)
575
+ end
576
+ est_time_util = get (state. signature_time_cost, sig, 1000 ^ 3 )
577
+
572
578
# Estimate total cost for executing this task on each candidate processor
573
579
for proc in procs
574
580
gproc = get_parent (proc)
582
588
tx_cost = impute_sum (affinity (chunk)[2 ] for chunk in chunks_filt)
583
589
584
590
# Estimate total cost to move data and get task running after currently-scheduled tasks
585
- est_time_util = get (state. worker_time_pressure[gproc. pid], proc, 0 )
586
- costs[proc] = est_time_util + (tx_cost/ tx_rate)
591
+ est_business = get (state. worker_time_pressure[get_parent (proc). pid], proc, 0 )
592
+
593
+ # Add fixed cost for cross-worker task transfer (esimated at 1ms)
594
+ # TODO : Actually estimate/benchmark this
595
+ task_xfer_cost = gproc. pid != myid () ? 1_000_000 : 0 # 1ms
596
+
597
+ # Compute final cost
598
+ costs[proc] = est_time_util + est_business + (tx_cost/ tx_rate) + task_xfer_cost
587
599
end
588
600
chunks_cleanup ()
589
601
0 commit comments