author | Fabian Huch <huch@in.tum.de> |
Thu, 30 Nov 2023 13:44:21 +0100 | |
changeset 79083 | 2d18d481c115 |
parent 79073 | b3fee0dafd72 |
child 79084 | dd689c4ab688 |
permissions | -rw-r--r-- |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
1 |
/* Title: Pure/Tools/build_schedule.scala |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
2 |
Author: Fabian Huch, TU Muenchen |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
3 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
4 |
Build schedule generated by Heuristic methods, allowing for more efficient builds. |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
5 |
*/ |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
6 |
package isabelle |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
7 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
8 |
|
78846 | 9 |
import Host.Node_Info |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
10 |
import scala.annotation.tailrec |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
11 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
12 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
13 |
object Build_Schedule { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
14 |
val engine_name = "build_schedule" |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
15 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
16 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
17 |
/* organized historic timing information (extracted from build logs) */ |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
18 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
19 |
case class Timing_Entry(job_name: String, hostname: String, threads: Int, elapsed: Time) |
79035
6beb60b508e6
clarified timing data vs. timing entries: full top-level data view vs. dynamic partial data;
Fabian Huch <huch@in.tum.de>
parents:
79034
diff
changeset
|
20 |
case class Timing_Entries(entries: List[Timing_Entry]) { |
6beb60b508e6
clarified timing data vs. timing entries: full top-level data view vs. dynamic partial data;
Fabian Huch <huch@in.tum.de>
parents:
79034
diff
changeset
|
21 |
require(entries.nonEmpty) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
22 |
|
79035
6beb60b508e6
clarified timing data vs. timing entries: full top-level data view vs. dynamic partial data;
Fabian Huch <huch@in.tum.de>
parents:
79034
diff
changeset
|
23 |
def is_empty = entries.isEmpty |
6beb60b508e6
clarified timing data vs. timing entries: full top-level data view vs. dynamic partial data;
Fabian Huch <huch@in.tum.de>
parents:
79034
diff
changeset
|
24 |
def size = entries.length |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
25 |
|
79035
6beb60b508e6
clarified timing data vs. timing entries: full top-level data view vs. dynamic partial data;
Fabian Huch <huch@in.tum.de>
parents:
79034
diff
changeset
|
26 |
lazy val by_job = entries.groupBy(_.job_name).view.mapValues(Timing_Entries(_)).toMap |
6beb60b508e6
clarified timing data vs. timing entries: full top-level data view vs. dynamic partial data;
Fabian Huch <huch@in.tum.de>
parents:
79034
diff
changeset
|
27 |
lazy val by_threads = entries.groupBy(_.threads).view.mapValues(Timing_Entries(_)).toMap |
6beb60b508e6
clarified timing data vs. timing entries: full top-level data view vs. dynamic partial data;
Fabian Huch <huch@in.tum.de>
parents:
79034
diff
changeset
|
28 |
lazy val by_hostname = entries.groupBy(_.hostname).view.mapValues(Timing_Entries(_)).toMap |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
29 |
|
79035
6beb60b508e6
clarified timing data vs. timing entries: full top-level data view vs. dynamic partial data;
Fabian Huch <huch@in.tum.de>
parents:
79034
diff
changeset
|
30 |
def mean_time: Time = Timing_Data.mean_time(entries.map(_.elapsed)) |
6beb60b508e6
clarified timing data vs. timing entries: full top-level data view vs. dynamic partial data;
Fabian Huch <huch@in.tum.de>
parents:
79034
diff
changeset
|
31 |
def best_entry: Timing_Entry = entries.minBy(_.elapsed.ms) |
6beb60b508e6
clarified timing data vs. timing entries: full top-level data view vs. dynamic partial data;
Fabian Huch <huch@in.tum.de>
parents:
79034
diff
changeset
|
32 |
} |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
33 |
|
79035
6beb60b508e6
clarified timing data vs. timing entries: full top-level data view vs. dynamic partial data;
Fabian Huch <huch@in.tum.de>
parents:
79034
diff
changeset
|
34 |
class Timing_Data private(data: Timing_Entries, val host_infos: Host_Infos) { |
79025
f78ee2d48bf5
handle inflection point in interpolation with monotone prefix;
Fabian Huch <huch@in.tum.de>
parents:
79024
diff
changeset
|
35 |
private def inflection_point(last_mono: Int, next: Int): Int = |
f78ee2d48bf5
handle inflection point in interpolation with monotone prefix;
Fabian Huch <huch@in.tum.de>
parents:
79024
diff
changeset
|
36 |
last_mono + ((next - last_mono) / 2) |
f78ee2d48bf5
handle inflection point in interpolation with monotone prefix;
Fabian Huch <huch@in.tum.de>
parents:
79024
diff
changeset
|
37 |
|
79028
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
38 |
def best_threads(job_name: String, max_threads: Int): Int = { |
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
39 |
val worse_threads = |
79035
6beb60b508e6
clarified timing data vs. timing entries: full top-level data view vs. dynamic partial data;
Fabian Huch <huch@in.tum.de>
parents:
79034
diff
changeset
|
40 |
data.by_job.get(job_name).toList.flatMap(_.by_hostname).flatMap { |
79028
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
41 |
case (hostname, data) => |
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
42 |
val best_threads = data.best_entry.threads |
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
43 |
data.by_threads.keys.toList.sorted.find(_ > best_threads).map( |
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
44 |
inflection_point(best_threads, _)) |
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
45 |
} |
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
46 |
(max_threads :: worse_threads).min |
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
47 |
} |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
48 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
49 |
private def hostname_factor(from: String, to: String): Double = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
50 |
host_infos.host_factor(host_infos.the_host(from), host_infos.the_host(to)) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
51 |
|
79041 | 52 |
private def approximate_threads(entries_unsorted: List[(Int, Time)], threads: Int): Time = { |
53 |
val entries = entries_unsorted.sortBy(_._1) |
|
54 |
||
79036
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
55 |
def sorted_prefix[A](xs: List[A], f: A => Long): List[A] = |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
56 |
xs match { |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
57 |
case x1 :: x2 :: xs => |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
58 |
if (f(x1) <= f(x2)) x1 :: sorted_prefix(x2 :: xs, f) else x1 :: Nil |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
59 |
case xs => xs |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
60 |
} |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
61 |
|
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
62 |
def linear(p0: (Int, Time), p1: (Int, Time)): Time = { |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
63 |
val a = (p1._2 - p0._2).scale(1.0 / (p1._1 - p0._1)) |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
64 |
val b = p0._2 - a.scale(p0._1) |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
65 |
Time.ms((a.scale(threads) + b).ms max 0) |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
66 |
} |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
67 |
|
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
68 |
val mono_prefix = sorted_prefix(entries, e => -e._2.ms) |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
69 |
|
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
70 |
val is_mono = entries == mono_prefix |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
71 |
val in_prefix = mono_prefix.length > 1 && threads <= mono_prefix.last._1 |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
72 |
val in_inflection = |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
73 |
!is_mono && mono_prefix.length > 1 && threads < entries.drop(mono_prefix.length).head._1 |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
74 |
if (is_mono || in_prefix || in_inflection) { |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
75 |
// Model with Amdahl's law |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
76 |
val t_p = |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
77 |
Timing_Data.median_time(for { |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
78 |
(n, t0) <- mono_prefix |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
79 |
(m, t1) <- mono_prefix |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
80 |
if m != n |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
81 |
} yield (t0 - t1).scale(n.toDouble * m / (m - n))) |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
82 |
val t_c = |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
83 |
Timing_Data.median_time(for ((n, t) <- mono_prefix) yield t - t_p.scale(1.0 / n)) |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
84 |
|
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
85 |
def model(threads: Int): Time = t_c + t_p.scale(1.0 / threads) |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
86 |
|
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
87 |
if (is_mono || in_prefix) model(threads) |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
88 |
else { |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
89 |
val post_inflection = entries.drop(mono_prefix.length).head |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
90 |
val inflection_threads = inflection_point(mono_prefix.last._1, post_inflection._1) |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
91 |
|
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
92 |
if (threads <= inflection_threads) model(threads) |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
93 |
else linear((inflection_threads, model(inflection_threads)), post_inflection) |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
94 |
} |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
95 |
} else { |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
96 |
// Piecewise linear |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
97 |
val (p0, p1) = |
79042 | 98 |
if (entries.head._1 < threads && threads < entries.last._1) { |
99 |
val split = entries.partition(_._1 < threads) |
|
79036
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
100 |
(split._1.last, split._2.head) |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
101 |
} else { |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
102 |
val piece = if (threads < entries.head._1) entries.take(2) else entries.takeRight(2) |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
103 |
(piece.head, piece.last) |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
104 |
} |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
105 |
|
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
106 |
linear(p0, p1) |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
107 |
} |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
108 |
} |
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
109 |
|
79037
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
110 |
private def unify_hosts(job_name: String, on_host: String): List[(Int, Time)] = { |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
111 |
def unify(hostname: String, data: Timing_Entries) = |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
112 |
data.mean_time.scale(hostname_factor(hostname, on_host)) |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
113 |
|
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
114 |
for { |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
115 |
data <- data.by_job.get(job_name).toList |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
116 |
(threads, data) <- data.by_threads |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
117 |
entries = data.by_hostname.toList.map(unify) |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
118 |
} yield threads -> Timing_Data.median_time(entries) |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
119 |
} |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
120 |
|
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
121 |
def estimate_threads(job_name: String, hostname: String, threads: Int): Option[Time] = { |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
122 |
for { |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
123 |
data <- data.by_job.get(job_name) |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
124 |
data <- data.by_hostname.get(hostname) |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
125 |
entries = data.by_threads.toList.map((threads, data) => threads -> data.mean_time) |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
126 |
time <- data.by_threads.get(threads).map(_.mean_time).orElse( |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
127 |
if (data.by_threads.size < 2) None else Some(approximate_threads(entries, threads))) |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
128 |
} yield time |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
129 |
} |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
130 |
|
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
131 |
def global_threads_factor(from: Int, to: Int): Double = { |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
132 |
def median(xs: Iterable[Double]): Double = xs.toList.sorted.apply(xs.size / 2) |
79036
be42ba4b4672
split actual approximation from data handling;
Fabian Huch <huch@in.tum.de>
parents:
79035
diff
changeset
|
133 |
|
79037
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
134 |
val estimates = |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
135 |
for { |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
136 |
(hostname, data) <- data.by_hostname |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
137 |
job_name <- data.by_job.keys |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
138 |
from_time <- estimate_threads(job_name, hostname, from) |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
139 |
to_time <- estimate_threads(job_name, hostname, to) |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
140 |
} yield from_time.ms.toDouble / to_time.ms |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
141 |
|
79037
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
142 |
if (estimates.nonEmpty) median(estimates) |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
143 |
else { |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
144 |
// unify hosts |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
145 |
val estimates = |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
146 |
for { |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
147 |
(job_name, data) <- data.by_job |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
148 |
hostname = data.by_hostname.keys.head |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
149 |
entries = unify_hosts(job_name, hostname) |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
150 |
if entries.length > 1 |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
151 |
} yield |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
152 |
approximate_threads(entries, from).ms.toDouble / approximate_threads(entries, to).ms |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
153 |
|
79037
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
154 |
if (estimates.nonEmpty) median(estimates) |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
155 |
else from.toDouble / to.toDouble |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
156 |
} |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
157 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
158 |
|
79026
6585acdd6505
clarified time estimation: does not use config;
Fabian Huch <huch@in.tum.de>
parents:
79025
diff
changeset
|
159 |
def estimate(job_name: String, hostname: String, threads: Int): Time = |
79035
6beb60b508e6
clarified timing data vs. timing entries: full top-level data view vs. dynamic partial data;
Fabian Huch <huch@in.tum.de>
parents:
79034
diff
changeset
|
160 |
data.by_job.get(job_name) match { |
79038
cd7c1acc9cf2
better estimation for unknown jobs;
Fabian Huch <huch@in.tum.de>
parents:
79037
diff
changeset
|
161 |
case None => |
cd7c1acc9cf2
better estimation for unknown jobs;
Fabian Huch <huch@in.tum.de>
parents:
79037
diff
changeset
|
162 |
// no data for job, take average of other jobs for given threads |
cd7c1acc9cf2
better estimation for unknown jobs;
Fabian Huch <huch@in.tum.de>
parents:
79037
diff
changeset
|
163 |
val job_estimates = data.by_job.keys.flatMap(estimate_threads(_, hostname, threads)) |
cd7c1acc9cf2
better estimation for unknown jobs;
Fabian Huch <huch@in.tum.de>
parents:
79037
diff
changeset
|
164 |
if (job_estimates.nonEmpty) Timing_Data.mean_time(job_estimates) |
cd7c1acc9cf2
better estimation for unknown jobs;
Fabian Huch <huch@in.tum.de>
parents:
79037
diff
changeset
|
165 |
else { |
cd7c1acc9cf2
better estimation for unknown jobs;
Fabian Huch <huch@in.tum.de>
parents:
79037
diff
changeset
|
166 |
// no other job to estimate from, use global curve to approximate any other job |
cd7c1acc9cf2
better estimation for unknown jobs;
Fabian Huch <huch@in.tum.de>
parents:
79037
diff
changeset
|
167 |
val (threads1, data1) = data.by_threads.head |
cd7c1acc9cf2
better estimation for unknown jobs;
Fabian Huch <huch@in.tum.de>
parents:
79037
diff
changeset
|
168 |
data1.mean_time.scale(global_threads_factor(threads1, threads)) |
cd7c1acc9cf2
better estimation for unknown jobs;
Fabian Huch <huch@in.tum.de>
parents:
79037
diff
changeset
|
169 |
} |
cd7c1acc9cf2
better estimation for unknown jobs;
Fabian Huch <huch@in.tum.de>
parents:
79037
diff
changeset
|
170 |
|
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
171 |
case Some(data) => |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
172 |
data.by_threads.get(threads) match { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
173 |
case None => // interpolate threads |
79037
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
174 |
estimate_threads(job_name, hostname, threads).getOrElse { |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
175 |
// per machine, try to approximate config for threads |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
176 |
val approximated = |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
177 |
for { |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
178 |
hostname1 <- data.by_hostname.keys |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
179 |
estimate <- estimate_threads(job_name, hostname1, threads) |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
180 |
factor = hostname_factor(hostname1, hostname) |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
181 |
} yield estimate.scale(factor) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
182 |
|
79037
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
183 |
if (approximated.nonEmpty) Timing_Data.mean_time(approximated) |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
184 |
else { |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
185 |
// no single machine where config can be approximated, unify data points |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
186 |
val unified_entries = unify_hosts(job_name, hostname) |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
187 |
|
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
188 |
if (unified_entries.length > 1) approximate_threads(unified_entries, threads) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
189 |
else { |
79037
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
190 |
// only single data point, use global curve to approximate |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
191 |
val (job_threads, job_time) = unified_entries.head |
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
192 |
job_time.scale(global_threads_factor(job_threads, threads)) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
193 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
194 |
} |
79037
1b3a6cc4a2bf
clarified and tuned timing estimation;
Fabian Huch <huch@in.tum.de>
parents:
79036
diff
changeset
|
195 |
} |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
196 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
197 |
case Some(data) => // time for job/thread exists, interpolate machine |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
198 |
data.by_hostname.get(hostname).map(_.mean_time).getOrElse { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
199 |
Timing_Data.median_time( |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
200 |
data.by_hostname.toList.map((hostname1, data) => |
78888 | 201 |
data.mean_time.scale(hostname_factor(hostname1, hostname)))) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
202 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
203 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
204 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
205 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
206 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
207 |
object Timing_Data { |
79039 | 208 |
def median_time(obs: List[Time]): Time = obs.sortBy(_.ms).apply(obs.length / 2) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
209 |
def mean_time(obs: Iterable[Time]): Time = Time.ms(obs.map(_.ms).sum / obs.size) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
210 |
|
78934
5553a86a1091
proper dummy timing entries;
Fabian Huch <huch@in.tum.de>
parents:
78933
diff
changeset
|
211 |
private def dummy_entries(host: Host, host_factor: Double) = |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
212 |
List( |
78934
5553a86a1091
proper dummy timing entries;
Fabian Huch <huch@in.tum.de>
parents:
78933
diff
changeset
|
213 |
Timing_Entry("dummy", host.info.hostname, 1, Time.minutes(5).scale(host_factor)), |
5553a86a1091
proper dummy timing entries;
Fabian Huch <huch@in.tum.de>
parents:
78933
diff
changeset
|
214 |
Timing_Entry("dummy", host.info.hostname, 8, Time.minutes(1).scale(host_factor))) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
215 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
216 |
def make( |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
217 |
host_infos: Host_Infos, |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
218 |
build_history: List[(Build_Log.Meta_Info, Build_Log.Build_Info)], |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
219 |
): Timing_Data = { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
220 |
val hosts = host_infos.hosts |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
221 |
val measurements = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
222 |
for { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
223 |
(meta_info, build_info) <- build_history |
79083 | 224 |
build_host = meta_info.get(Build_Log.Prop.build_host) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
225 |
(job_name, session_info) <- build_info.sessions.toList |
78933
4f940d7293ea
use only finished sessions in timing data;
Fabian Huch <huch@in.tum.de>
parents:
78932
diff
changeset
|
226 |
if build_info.finished_sessions.contains(job_name) |
79083 | 227 |
hostname <- session_info.hostname.orElse(build_host).toList |
228 |
host <- hosts.find(_.info.hostname == hostname).toList |
|
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
229 |
threads = session_info.threads.getOrElse(host.info.num_cpus) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
230 |
} yield (job_name, hostname, threads) -> session_info.timing.elapsed |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
231 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
232 |
val entries = |
78934
5553a86a1091
proper dummy timing entries;
Fabian Huch <huch@in.tum.de>
parents:
78933
diff
changeset
|
233 |
if (measurements.isEmpty) { |
5553a86a1091
proper dummy timing entries;
Fabian Huch <huch@in.tum.de>
parents:
78933
diff
changeset
|
234 |
val default_host = host_infos.hosts.sorted(host_infos.host_speeds).head |
5553a86a1091
proper dummy timing entries;
Fabian Huch <huch@in.tum.de>
parents:
78933
diff
changeset
|
235 |
host_infos.hosts.flatMap(host => |
5553a86a1091
proper dummy timing entries;
Fabian Huch <huch@in.tum.de>
parents:
78933
diff
changeset
|
236 |
dummy_entries(host, host_infos.host_factor(default_host, host))) |
5553a86a1091
proper dummy timing entries;
Fabian Huch <huch@in.tum.de>
parents:
78933
diff
changeset
|
237 |
} |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
238 |
else |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
239 |
measurements.groupMap(_._1)(_._2).toList.map { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
240 |
case ((job_name, hostname, threads), timings) => |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
241 |
Timing_Entry(job_name, hostname, threads, median_time(timings)) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
242 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
243 |
|
79035
6beb60b508e6
clarified timing data vs. timing entries: full top-level data view vs. dynamic partial data;
Fabian Huch <huch@in.tum.de>
parents:
79034
diff
changeset
|
244 |
new Timing_Data(Timing_Entries(entries), host_infos) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
245 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
246 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
247 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
248 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
249 |
/* host information */ |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
250 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
251 |
case class Host(info: isabelle.Host.Info, build: Build_Cluster.Host) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
252 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
253 |
object Host_Infos { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
254 |
def dummy: Host_Infos = |
78846 | 255 |
new Host_Infos( |
256 |
List(Host(isabelle.Host.Info("dummy", Nil, 8, Some(1.0)), Build_Cluster.Host("dummy")))) |
|
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
257 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
258 |
def apply(build_hosts: List[Build_Cluster.Host], db: SQL.Database): Host_Infos = { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
259 |
def get_host(build_host: Build_Cluster.Host): Host = { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
260 |
val info = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
261 |
isabelle.Host.read_info(db, build_host.name).getOrElse( |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
262 |
error("No benchmark for " + quote(build_host.name))) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
263 |
Host(info, build_host) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
264 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
265 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
266 |
new Host_Infos(build_hosts.map(get_host)) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
267 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
268 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
269 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
270 |
class Host_Infos private(val hosts: List[Host]) { |
79040 | 271 |
require(hosts.nonEmpty) |
272 |
||
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
273 |
private val by_hostname = hosts.map(host => host.info.hostname -> host).toMap |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
274 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
275 |
def host_factor(from: Host, to: Host): Double = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
276 |
from.info.benchmark_score.get / to.info.benchmark_score.get |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
277 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
278 |
val host_speeds: Ordering[Host] = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
279 |
Ordering.fromLessThan((host1, host2) => host_factor(host1, host2) > 1) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
280 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
281 |
def the_host(hostname: String): Host = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
282 |
by_hostname.getOrElse(hostname, error("Unknown host " + quote(hostname))) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
283 |
def the_host(node_info: Node_Info): Host = the_host(node_info.hostname) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
284 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
285 |
def num_threads(node_info: Node_Info): Int = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
286 |
if (node_info.rel_cpus.nonEmpty) node_info.rel_cpus.length |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
287 |
else the_host(node_info).info.num_cpus |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
288 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
289 |
def available(state: Build_Process.State): Resources = { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
290 |
val allocated = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
291 |
state.running.values.map(_.node_info).groupMapReduce(the_host)(List(_))(_ ::: _) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
292 |
Resources(this, allocated) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
293 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
294 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
295 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
296 |
|
79029 | 297 |
/* offline tracking of job configurations and resource allocations */ |
298 |
||
299 |
object Config { |
|
300 |
def from_job(job: Build_Process.Job): Config = Config(job.name, job.node_info) |
|
301 |
} |
|
302 |
||
303 |
case class Config(job_name: String, node_info: Node_Info) { |
|
304 |
def job_of(start_time: Time): Build_Process.Job = |
|
305 |
Build_Process.Job(job_name, "", "", node_info, Date(start_time), None) |
|
306 |
} |
|
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
307 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
308 |
case class Resources( |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
309 |
host_infos: Host_Infos, |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
310 |
allocated_nodes: Map[Host, List[Node_Info]] |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
311 |
) { |
78973
d91e131840a0
timing heuristic: parallelize more aggressively to utilize hosts fully;
Fabian Huch <huch@in.tum.de>
parents:
78972
diff
changeset
|
312 |
def unused_nodes(threads: Int): List[Node_Info] = { |
d91e131840a0
timing heuristic: parallelize more aggressively to utilize hosts fully;
Fabian Huch <huch@in.tum.de>
parents:
78972
diff
changeset
|
313 |
val fully_allocated = |
d91e131840a0
timing heuristic: parallelize more aggressively to utilize hosts fully;
Fabian Huch <huch@in.tum.de>
parents:
78972
diff
changeset
|
314 |
host_infos.hosts.foldLeft(this) { case (resources, host) => |
d91e131840a0
timing heuristic: parallelize more aggressively to utilize hosts fully;
Fabian Huch <huch@in.tum.de>
parents:
78972
diff
changeset
|
315 |
if (!resources.available(host, threads)) resources |
d91e131840a0
timing heuristic: parallelize more aggressively to utilize hosts fully;
Fabian Huch <huch@in.tum.de>
parents:
78972
diff
changeset
|
316 |
else resources.allocate(resources.next_node(host, threads)) |
d91e131840a0
timing heuristic: parallelize more aggressively to utilize hosts fully;
Fabian Huch <huch@in.tum.de>
parents:
78972
diff
changeset
|
317 |
} |
d91e131840a0
timing heuristic: parallelize more aggressively to utilize hosts fully;
Fabian Huch <huch@in.tum.de>
parents:
78972
diff
changeset
|
318 |
val used_nodes = allocated_nodes.values.flatten.toSet |
d91e131840a0
timing heuristic: parallelize more aggressively to utilize hosts fully;
Fabian Huch <huch@in.tum.de>
parents:
78972
diff
changeset
|
319 |
fully_allocated.allocated_nodes.values.flatten.toList.filterNot(used_nodes.contains) |
d91e131840a0
timing heuristic: parallelize more aggressively to utilize hosts fully;
Fabian Huch <huch@in.tum.de>
parents:
78972
diff
changeset
|
320 |
} |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
321 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
322 |
def allocated(host: Host): List[Node_Info] = allocated_nodes.getOrElse(host, Nil) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
323 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
324 |
def allocate(node: Node_Info): Resources = { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
325 |
val host = host_infos.the_host(node) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
326 |
copy(allocated_nodes = allocated_nodes + (host -> (node :: allocated(host)))) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
327 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
328 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
329 |
def try_allocate_tasks( |
78971
f930d24f1548
scheduled build: allocate cpus more aggressively, to avoid idle threads;
Fabian Huch <huch@in.tum.de>
parents:
78970
diff
changeset
|
330 |
hosts: List[(Host, Int)], |
f930d24f1548
scheduled build: allocate cpus more aggressively, to avoid idle threads;
Fabian Huch <huch@in.tum.de>
parents:
78970
diff
changeset
|
331 |
tasks: List[(Build_Process.Task, Int, Int)], |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
332 |
): (List[Config], Resources) = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
333 |
tasks match { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
334 |
case Nil => (Nil, this) |
78971
f930d24f1548
scheduled build: allocate cpus more aggressively, to avoid idle threads;
Fabian Huch <huch@in.tum.de>
parents:
78970
diff
changeset
|
335 |
case (task, min_threads, max_threads) :: tasks => |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
336 |
val (config, resources) = |
78971
f930d24f1548
scheduled build: allocate cpus more aggressively, to avoid idle threads;
Fabian Huch <huch@in.tum.de>
parents:
78970
diff
changeset
|
337 |
hosts.find((host, _) => available(host, min_threads)) match { |
f930d24f1548
scheduled build: allocate cpus more aggressively, to avoid idle threads;
Fabian Huch <huch@in.tum.de>
parents:
78970
diff
changeset
|
338 |
case Some((host, host_max_threads)) => |
f930d24f1548
scheduled build: allocate cpus more aggressively, to avoid idle threads;
Fabian Huch <huch@in.tum.de>
parents:
78970
diff
changeset
|
339 |
val free_threads = host.info.num_cpus - ((host.build.jobs - 1) * host_max_threads) |
f930d24f1548
scheduled build: allocate cpus more aggressively, to avoid idle threads;
Fabian Huch <huch@in.tum.de>
parents:
78970
diff
changeset
|
340 |
val node_info = next_node(host, (min_threads max free_threads) min max_threads) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
341 |
(Some(Config(task.name, node_info)), allocate(node_info)) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
342 |
case None => (None, this) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
343 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
344 |
val (configs, resources1) = resources.try_allocate_tasks(hosts, tasks) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
345 |
(configs ++ config, resources1) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
346 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
347 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
348 |
def next_node(host: Host, threads: Int): Node_Info = { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
349 |
val numa_node_num_cpus = host.info.num_cpus / (host.info.numa_nodes.length max 1) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
350 |
def explicit_cpus(node_info: Node_Info): List[Int] = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
351 |
if (node_info.rel_cpus.nonEmpty) node_info.rel_cpus else (0 until numa_node_num_cpus).toList |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
352 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
353 |
val used_nodes = allocated(host).groupMapReduce(_.numa_node)(explicit_cpus)(_ ::: _) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
354 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
355 |
val available_nodes = host.info.numa_nodes |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
356 |
val numa_node = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
357 |
if (!host.build.numa) None |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
358 |
else available_nodes.sortBy(n => used_nodes.getOrElse(Some(n), Nil).length).headOption |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
359 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
360 |
val used_cpus = used_nodes.getOrElse(numa_node, Nil).toSet |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
361 |
val available_cpus = (0 until numa_node_num_cpus).filterNot(used_cpus.contains).toList |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
362 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
363 |
val rel_cpus = if (available_cpus.length >= threads) available_cpus.take(threads) else Nil |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
364 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
365 |
Node_Info(host.info.hostname, numa_node, rel_cpus) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
366 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
367 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
368 |
def available(host: Host, threads: Int): Boolean = { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
369 |
val used = allocated(host) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
370 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
371 |
if (used.length >= host.build.jobs) false |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
372 |
else { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
373 |
if (host.info.numa_nodes.length <= 1) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
374 |
used.map(host_infos.num_threads).sum + threads <= host.info.num_cpus |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
375 |
else { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
376 |
def node_threads(n: Int): Int = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
377 |
used.filter(_.numa_node.contains(n)).map(host_infos.num_threads).sum |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
378 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
379 |
host.info.numa_nodes.exists( |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
380 |
node_threads(_) + threads <= host.info.num_cpus / host.info.numa_nodes.length) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
381 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
382 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
383 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
384 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
385 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
386 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
387 |
/* schedule generation */ |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
388 |
|
79073
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
389 |
object Schedule { |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
390 |
case class Node(job_name: String, node_info: Node_Info, start: Date, duration: Time) { |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
391 |
def end: Date = Date(start.time + duration) |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
392 |
} |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
393 |
|
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
394 |
type Graph = isabelle.Graph[String, Node] |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
395 |
} |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
396 |
|
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
397 |
case class Schedule(start: Date, graph: Schedule.Graph) { |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
398 |
def end: Date = |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
399 |
if (graph.is_empty) start |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
400 |
else graph.maximals.map(graph.get_node).map(_.end).maxBy(_.unix_epoch) |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
401 |
|
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
402 |
def duration: Time = end.time - start.time |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
403 |
} |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
404 |
|
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
405 |
case class State(build_state: Build_Process.State, current_time: Time, finished: Schedule) { |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
406 |
def start(config: Config): State = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
407 |
copy(build_state = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
408 |
build_state.copy(running = build_state.running + |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
409 |
(config.job_name -> config.job_of(current_time)))) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
410 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
411 |
def step(timing_data: Timing_Data): State = { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
412 |
val remaining = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
413 |
build_state.running.values.toList.map { job => |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
414 |
val elapsed = current_time - job.start_date.time |
79026
6585acdd6505
clarified time estimation: does not use config;
Fabian Huch <huch@in.tum.de>
parents:
79025
diff
changeset
|
415 |
val threads = timing_data.host_infos.num_threads(job.node_info) |
6585acdd6505
clarified time estimation: does not use config;
Fabian Huch <huch@in.tum.de>
parents:
79025
diff
changeset
|
416 |
val predicted = timing_data.estimate(job.name, job.node_info.hostname, threads) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
417 |
val remaining = if (elapsed > predicted) Time.zero else predicted - elapsed |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
418 |
job -> remaining |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
419 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
420 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
421 |
if (remaining.isEmpty) error("Schedule step without running sessions") |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
422 |
else { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
423 |
val (job, elapsed) = remaining.minBy(_._2.ms) |
79073
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
424 |
val now = current_time + elapsed |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
425 |
val node = Schedule.Node(job.name, job.node_info, job.start_date, now - job.start_date.time) |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
426 |
|
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
427 |
val preds = |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
428 |
build_state.sessions.graph.imm_preds(job.name).filter(finished.graph.defined) |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
429 |
val graph = |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
430 |
preds.foldLeft(finished.graph.new_node(job.name, node))(_.add_edge(_, job.name)) |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
431 |
|
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
432 |
val build_state1 = build_state.remove_running(job.name).remove_pending(job.name) |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
433 |
State(build_state1, now, finished.copy(graph = graph)) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
434 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
435 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
436 |
|
79073
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
437 |
def is_finished: Boolean = build_state.pending.isEmpty && build_state.running.isEmpty |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
438 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
439 |
|
78932 | 440 |
trait Scheduler { |
78928
6c2c60b852e0
move timing data into scheduler for more efficient heuristics (e.g., with pre-calculated values);
Fabian Huch <huch@in.tum.de>
parents:
78888
diff
changeset
|
441 |
def next(state: Build_Process.State): List[Config] |
79073
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
442 |
def build_schedule(build_state: Build_Process.State): Schedule |
78931
26841d3c568c
performance tuning for build schedule: explicit schedule generation, without mixing heuristics;
Fabian Huch <huch@in.tum.de>
parents:
78930
diff
changeset
|
443 |
} |
26841d3c568c
performance tuning for build schedule: explicit schedule generation, without mixing heuristics;
Fabian Huch <huch@in.tum.de>
parents:
78930
diff
changeset
|
444 |
|
79027
d08fb157e300
use proper max threads (limited by available hardware) in heuristics;
Fabian Huch <huch@in.tum.de>
parents:
79026
diff
changeset
|
445 |
abstract class Heuristic(timing_data: Timing_Data, max_threads_limit: Int) extends Scheduler { |
79019
4df053d29215
introduced path heuristic abstraction;
Fabian Huch <huch@in.tum.de>
parents:
78976
diff
changeset
|
446 |
val host_infos = timing_data.host_infos |
79028
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
447 |
val ordered_hosts = host_infos.hosts.sorted(host_infos.host_speeds) |
79027
d08fb157e300
use proper max threads (limited by available hardware) in heuristics;
Fabian Huch <huch@in.tum.de>
parents:
79026
diff
changeset
|
448 |
val max_threads = host_infos.hosts.map(_.info.num_cpus).max min max_threads_limit |
79019
4df053d29215
introduced path heuristic abstraction;
Fabian Huch <huch@in.tum.de>
parents:
78976
diff
changeset
|
449 |
|
79028
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
450 |
def best_time(job_name: String): Time = { |
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
451 |
val host = ordered_hosts.last |
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
452 |
val threads = timing_data.best_threads(job_name, max_threads) min host.info.num_cpus |
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
453 |
timing_data.estimate(job_name, host.info.hostname, threads) |
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
454 |
} |
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
455 |
|
79073
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
456 |
def build_schedule(build_state: Build_Process.State): Schedule = { |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
457 |
@tailrec |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
458 |
def simulate(state: State): State = |
79073
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
459 |
if (state.is_finished) state |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
460 |
else { |
78932 | 461 |
val state1 = next(state.build_state).foldLeft(state)(_.start(_)).step(timing_data) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
462 |
simulate(state1) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
463 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
464 |
|
79073
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
465 |
val start = Date.now() |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
466 |
val end_state = simulate(State(build_state, start.time, Schedule(start, Graph.empty))) |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
467 |
|
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
468 |
end_state.finished |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
469 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
470 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
471 |
|
78931
26841d3c568c
performance tuning for build schedule: explicit schedule generation, without mixing heuristics;
Fabian Huch <huch@in.tum.de>
parents:
78930
diff
changeset
|
472 |
class Meta_Heuristic(heuristics: List[Heuristic]) extends Scheduler { |
26841d3c568c
performance tuning for build schedule: explicit schedule generation, without mixing heuristics;
Fabian Huch <huch@in.tum.de>
parents:
78930
diff
changeset
|
473 |
require(heuristics.nonEmpty) |
26841d3c568c
performance tuning for build schedule: explicit schedule generation, without mixing heuristics;
Fabian Huch <huch@in.tum.de>
parents:
78930
diff
changeset
|
474 |
|
79073
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
475 |
def best_result(state: Build_Process.State): (Heuristic, Schedule) = |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
476 |
heuristics.map(heuristic => |
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
477 |
heuristic -> heuristic.build_schedule(state)).minBy(_._2.duration.ms) |
78931
26841d3c568c
performance tuning for build schedule: explicit schedule generation, without mixing heuristics;
Fabian Huch <huch@in.tum.de>
parents:
78930
diff
changeset
|
478 |
|
26841d3c568c
performance tuning for build schedule: explicit schedule generation, without mixing heuristics;
Fabian Huch <huch@in.tum.de>
parents:
78930
diff
changeset
|
479 |
def next(state: Build_Process.State): List[Config] = best_result(state)._1.next(state) |
26841d3c568c
performance tuning for build schedule: explicit schedule generation, without mixing heuristics;
Fabian Huch <huch@in.tum.de>
parents:
78930
diff
changeset
|
480 |
|
79073
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
481 |
def build_schedule(state: Build_Process.State): Schedule = best_result(state)._2 |
78931
26841d3c568c
performance tuning for build schedule: explicit schedule generation, without mixing heuristics;
Fabian Huch <huch@in.tum.de>
parents:
78930
diff
changeset
|
482 |
} |
26841d3c568c
performance tuning for build schedule: explicit schedule generation, without mixing heuristics;
Fabian Huch <huch@in.tum.de>
parents:
78930
diff
changeset
|
483 |
|
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
484 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
485 |
/* heuristics */ |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
486 |
|
79027
d08fb157e300
use proper max threads (limited by available hardware) in heuristics;
Fabian Huch <huch@in.tum.de>
parents:
79026
diff
changeset
|
487 |
abstract class Path_Heuristic( |
d08fb157e300
use proper max threads (limited by available hardware) in heuristics;
Fabian Huch <huch@in.tum.de>
parents:
79026
diff
changeset
|
488 |
timing_data: Timing_Data, |
d08fb157e300
use proper max threads (limited by available hardware) in heuristics;
Fabian Huch <huch@in.tum.de>
parents:
79026
diff
changeset
|
489 |
sessions_structure: Sessions.Structure, |
d08fb157e300
use proper max threads (limited by available hardware) in heuristics;
Fabian Huch <huch@in.tum.de>
parents:
79026
diff
changeset
|
490 |
max_threads_limit: Int |
d08fb157e300
use proper max threads (limited by available hardware) in heuristics;
Fabian Huch <huch@in.tum.de>
parents:
79026
diff
changeset
|
491 |
) extends Heuristic(timing_data, max_threads_limit) { |
78929
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
492 |
/* pre-computed properties for efficient heuristic */ |
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
493 |
|
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
494 |
type Node = String |
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
495 |
|
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
496 |
val build_graph = sessions_structure.build_graph |
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
497 |
val all_maximals = build_graph.maximals.toSet |
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
498 |
val maximals_preds = |
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
499 |
all_maximals.map(node => node -> build_graph.all_preds(List(node)).toSet).toMap |
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
500 |
|
79028
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
501 |
val best_times = build_graph.keys.map(node => node -> best_time(node)).toMap |
78974 | 502 |
val remaining_time_ms = build_graph.node_height(best_times(_).ms) |
78929
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
503 |
|
78974 | 504 |
def elapsed_times(node: Node): Map[Node, Time] = |
505 |
build_graph.reachable_length(best_times(_).ms, build_graph.imm_succs, List(node)).map( |
|
506 |
(node, ms) => node -> Time.ms(ms)) |
|
78929
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
507 |
|
78974 | 508 |
def path_times(node: Node): Map[Node, Time] = { |
78929
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
509 |
val maximals = all_maximals.intersect(build_graph.all_succs(List(node)).toSet) |
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
510 |
val elapsed_time = elapsed_times(node) |
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
511 |
|
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
512 |
maximals |
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
513 |
.flatMap(node => maximals_preds(node).map(_ -> elapsed_time(node))) |
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
514 |
.groupMapReduce(_._1)(_._2)(_ max _) |
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
515 |
} |
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
516 |
|
78972
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
517 |
def parallel_paths(minimals: Set[Node], pred: Node => Boolean = _ => true): Int = { |
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
518 |
def start(node: Node): (Node, Time) = node -> best_times(node) |
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
519 |
|
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
520 |
def pass_time(elapsed: Time)(node: Node, time: Time): (Node, Time) = |
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
521 |
node -> (time - elapsed) |
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
522 |
|
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
523 |
def parallel_paths(running: Map[Node, Time]): (Int, Map[Node, Time]) = |
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
524 |
if (running.isEmpty) (0, running) |
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
525 |
else { |
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
526 |
def get_next(node: Node): List[Node] = |
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
527 |
build_graph.imm_succs(node).filter(pred).filter( |
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
528 |
build_graph.imm_preds(_).intersect(running.keySet).isEmpty).toList |
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
529 |
|
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
530 |
val (next, elapsed) = running.minBy(_._2.ms) |
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
531 |
val (remaining, finished) = |
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
532 |
running.toList.map(pass_time(elapsed)).partition(_._2 > Time.zero) |
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
533 |
|
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
534 |
val running1 = |
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
535 |
remaining.map(pass_time(elapsed)).toMap ++ |
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
536 |
finished.map(_._1).flatMap(get_next).map(start) |
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
537 |
val (res, running2) = parallel_paths(running1) |
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
538 |
(res max running1.size, running2) |
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
539 |
} |
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
540 |
|
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
541 |
parallel_paths(minimals.map(start).toMap)._1 |
7a39f151e9a7
proper parallel paths for timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
78971
diff
changeset
|
542 |
} |
79019
4df053d29215
introduced path heuristic abstraction;
Fabian Huch <huch@in.tum.de>
parents:
78976
diff
changeset
|
543 |
} |
78929
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
544 |
|
79019
4df053d29215
introduced path heuristic abstraction;
Fabian Huch <huch@in.tum.de>
parents:
78976
diff
changeset
|
545 |
class Timing_Heuristic( |
4df053d29215
introduced path heuristic abstraction;
Fabian Huch <huch@in.tum.de>
parents:
78976
diff
changeset
|
546 |
threshold: Time, |
4df053d29215
introduced path heuristic abstraction;
Fabian Huch <huch@in.tum.de>
parents:
78976
diff
changeset
|
547 |
timing_data: Timing_Data, |
4df053d29215
introduced path heuristic abstraction;
Fabian Huch <huch@in.tum.de>
parents:
78976
diff
changeset
|
548 |
sessions_structure: Sessions.Structure, |
79027
d08fb157e300
use proper max threads (limited by available hardware) in heuristics;
Fabian Huch <huch@in.tum.de>
parents:
79026
diff
changeset
|
549 |
max_threads_limit: Int = 8 |
d08fb157e300
use proper max threads (limited by available hardware) in heuristics;
Fabian Huch <huch@in.tum.de>
parents:
79026
diff
changeset
|
550 |
) extends Path_Heuristic(timing_data, sessions_structure, max_threads_limit) { |
79019
4df053d29215
introduced path heuristic abstraction;
Fabian Huch <huch@in.tum.de>
parents:
78976
diff
changeset
|
551 |
val critical_path_nodes = |
4df053d29215
introduced path heuristic abstraction;
Fabian Huch <huch@in.tum.de>
parents:
78976
diff
changeset
|
552 |
build_graph.keys.map(node => |
4df053d29215
introduced path heuristic abstraction;
Fabian Huch <huch@in.tum.de>
parents:
78976
diff
changeset
|
553 |
node -> path_times(node).filter((_, time) => time > threshold).keySet).toMap |
78929
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
554 |
|
78928
6c2c60b852e0
move timing data into scheduler for more efficient heuristics (e.g., with pre-calculated values);
Fabian Huch <huch@in.tum.de>
parents:
78888
diff
changeset
|
555 |
def next(state: Build_Process.State): List[Config] = { |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
556 |
val resources = host_infos.available(state) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
557 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
558 |
def best_threads(task: Build_Process.Task): Int = |
79028
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
559 |
timing_data.best_threads(task.name, max_threads) |
78971
f930d24f1548
scheduled build: allocate cpus more aggressively, to avoid idle threads;
Fabian Huch <huch@in.tum.de>
parents:
78970
diff
changeset
|
560 |
|
79028
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
561 |
val rev_ordered_hosts = ordered_hosts.reverse.map(_ -> max_threads) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
562 |
|
79021
1c91e884035d
properly incorporate running tasks into timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
79020
diff
changeset
|
563 |
val resources0 = host_infos.available(state.copy(running = Map.empty)) |
1c91e884035d
properly incorporate running tasks into timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
79020
diff
changeset
|
564 |
val max_parallel = parallel_paths(state.ready.map(_.name).toSet) |
1c91e884035d
properly incorporate running tasks into timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
79020
diff
changeset
|
565 |
val fully_parallelizable = max_parallel <= resources0.unused_nodes(max_threads).length |
78973
d91e131840a0
timing heuristic: parallelize more aggressively to utilize hosts fully;
Fabian Huch <huch@in.tum.de>
parents:
78972
diff
changeset
|
566 |
|
d91e131840a0
timing heuristic: parallelize more aggressively to utilize hosts fully;
Fabian Huch <huch@in.tum.de>
parents:
78972
diff
changeset
|
567 |
if (fully_parallelizable) { |
79020
ef76705bf402
clarified ready vs. next ready;
Fabian Huch <huch@in.tum.de>
parents:
79019
diff
changeset
|
568 |
val all_tasks = state.next_ready.map(task => (task, best_threads(task), best_threads(task))) |
79028
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
569 |
resources.try_allocate_tasks(rev_ordered_hosts, all_tasks)._1 |
78971
f930d24f1548
scheduled build: allocate cpus more aggressively, to avoid idle threads;
Fabian Huch <huch@in.tum.de>
parents:
78970
diff
changeset
|
570 |
} |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
571 |
else { |
79021
1c91e884035d
properly incorporate running tasks into timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
79020
diff
changeset
|
572 |
val critical_nodes = state.ready.toSet.flatMap(task => critical_path_nodes(task.name)) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
573 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
574 |
val (critical, other) = |
79020
ef76705bf402
clarified ready vs. next ready;
Fabian Huch <huch@in.tum.de>
parents:
79019
diff
changeset
|
575 |
state.next_ready.sortBy(task => remaining_time_ms(task.name)).reverse.partition(task => |
78974 | 576 |
critical_nodes.contains(task.name)) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
577 |
|
78971
f930d24f1548
scheduled build: allocate cpus more aggressively, to avoid idle threads;
Fabian Huch <huch@in.tum.de>
parents:
78970
diff
changeset
|
578 |
val critical_tasks = critical.map(task => (task, best_threads(task), best_threads(task))) |
f930d24f1548
scheduled build: allocate cpus more aggressively, to avoid idle threads;
Fabian Huch <huch@in.tum.de>
parents:
78970
diff
changeset
|
579 |
val other_tasks = other.map(task => (task, 1, best_threads(task))) |
f930d24f1548
scheduled build: allocate cpus more aggressively, to avoid idle threads;
Fabian Huch <huch@in.tum.de>
parents:
78970
diff
changeset
|
580 |
|
79021
1c91e884035d
properly incorporate running tasks into timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
79020
diff
changeset
|
581 |
val critical_minimals = critical_nodes.intersect(state.ready.map(_.name).toSet) |
1c91e884035d
properly incorporate running tasks into timing heuristic;
Fabian Huch <huch@in.tum.de>
parents:
79020
diff
changeset
|
582 |
val max_critical_parallel = parallel_paths(critical_minimals, critical_nodes.contains) |
79028
6bada416ba55
clarified timing data operations: proper estimation (instead of known points);
Fabian Huch <huch@in.tum.de>
parents:
79027
diff
changeset
|
583 |
val (critical_hosts, other_hosts) = rev_ordered_hosts.splitAt(max_critical_parallel) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
584 |
|
78971
f930d24f1548
scheduled build: allocate cpus more aggressively, to avoid idle threads;
Fabian Huch <huch@in.tum.de>
parents:
78970
diff
changeset
|
585 |
val (configs1, resources1) = resources.try_allocate_tasks(critical_hosts, critical_tasks) |
f930d24f1548
scheduled build: allocate cpus more aggressively, to avoid idle threads;
Fabian Huch <huch@in.tum.de>
parents:
78970
diff
changeset
|
586 |
val (configs2, _) = resources1.try_allocate_tasks(other_hosts, other_tasks) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
587 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
588 |
configs1 ::: configs2 |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
589 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
590 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
591 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
592 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
593 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
594 |
/* process for scheduled build */ |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
595 |
|
78928
6c2c60b852e0
move timing data into scheduler for more efficient heuristics (e.g., with pre-calculated values);
Fabian Huch <huch@in.tum.de>
parents:
78888
diff
changeset
|
596 |
abstract class Scheduled_Build_Process( |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
597 |
build_context: Build.Context, |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
598 |
build_progress: Progress, |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
599 |
server: SSH.Server, |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
600 |
) extends Build_Process(build_context, build_progress, server) { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
601 |
protected val start_date = Date.now() |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
602 |
|
78928
6c2c60b852e0
move timing data into scheduler for more efficient heuristics (e.g., with pre-calculated values);
Fabian Huch <huch@in.tum.de>
parents:
78888
diff
changeset
|
603 |
def init_scheduler(timing_data: Timing_Data): Scheduler |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
604 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
605 |
/* global resources with common close() operation */ |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
606 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
607 |
private final lazy val _log_store: Build_Log.Store = Build_Log.store(build_options) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
608 |
private final lazy val _log_database: SQL.Database = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
609 |
try { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
610 |
val db = _log_store.open_database(server = this.server) |
78851 | 611 |
_log_store.init_database(db) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
612 |
db |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
613 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
614 |
catch { case exn: Throwable => close(); throw exn } |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
615 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
616 |
override def close(): Unit = { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
617 |
super.close() |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
618 |
Option(_log_database).foreach(_.close()) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
619 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
620 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
621 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
622 |
/* previous results via build log */ |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
623 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
624 |
override def open_build_cluster(): Build_Cluster = { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
625 |
val build_cluster = super.open_build_cluster() |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
626 |
build_cluster.init() |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
627 |
if (build_context.master && build_context.max_jobs > 0) { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
628 |
val benchmark_options = build_options.string("build_hostname") = hostname |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
629 |
Benchmark.benchmark(benchmark_options, progress) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
630 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
631 |
build_cluster.benchmark() |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
632 |
build_cluster |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
633 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
634 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
635 |
private val timing_data: Timing_Data = { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
636 |
val cluster_hosts: List[Build_Cluster.Host] = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
637 |
if (build_context.max_jobs == 0) build_context.build_hosts |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
638 |
else { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
639 |
val local_build_host = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
640 |
Build_Cluster.Host( |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
641 |
hostname, jobs = build_context.max_jobs, numa = build_context.numa_shuffling) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
642 |
local_build_host :: build_context.build_hosts |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
643 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
644 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
645 |
val host_infos = Host_Infos(cluster_hosts, _host_database) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
646 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
647 |
val build_history = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
648 |
for { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
649 |
log_name <- _log_database.execute_query_statement( |
79064 | 650 |
Build_Log.private_data.meta_info_table.select(List(Build_Log.Column.log_name)), |
651 |
List.from[String], res => res.string(Build_Log.Column.log_name)) |
|
79062
6977fb0153fb
clarified modules: Build_Log.private_data provides raw data access without transaction_lock;
wenzelm
parents:
79042
diff
changeset
|
652 |
meta_info <- Build_Log.private_data.read_meta_info(_log_database, log_name) |
6977fb0153fb
clarified modules: Build_Log.private_data provides raw data access without transaction_lock;
wenzelm
parents:
79042
diff
changeset
|
653 |
build_info = |
6977fb0153fb
clarified modules: Build_Log.private_data provides raw data access without transaction_lock;
wenzelm
parents:
79042
diff
changeset
|
654 |
Build_Log.private_data.read_build_info(_log_database, log_name, cache = _log_store.cache) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
655 |
} yield (meta_info, build_info) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
656 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
657 |
Timing_Data.make(host_infos, build_history) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
658 |
} |
78928
6c2c60b852e0
move timing data into scheduler for more efficient heuristics (e.g., with pre-calculated values);
Fabian Huch <huch@in.tum.de>
parents:
78888
diff
changeset
|
659 |
private val scheduler = init_scheduler(timing_data) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
660 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
661 |
def write_build_log(results: Build.Results, state: Build_Process.State.Results): Unit = { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
662 |
val sessions = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
663 |
for { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
664 |
(session_name, result) <- state.toList |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
665 |
if !result.current |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
666 |
} yield { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
667 |
val info = build_context.sessions_structure(session_name) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
668 |
val entry = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
669 |
if (!results.cancelled(session_name)) { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
670 |
val status = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
671 |
if (result.ok) Build_Log.Session_Status.finished |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
672 |
else Build_Log.Session_Status.failed |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
673 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
674 |
Build_Log.Session_Entry( |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
675 |
chapter = info.chapter, |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
676 |
groups = info.groups, |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
677 |
hostname = Some(result.node_info.hostname), |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
678 |
threads = Some(timing_data.host_infos.num_threads(result.node_info)), |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
679 |
timing = result.process_result.timing, |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
680 |
sources = Some(result.output_shasum.digest.toString), |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
681 |
status = Some(status)) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
682 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
683 |
else |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
684 |
Build_Log.Session_Entry( |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
685 |
chapter = info.chapter, |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
686 |
groups = info.groups, |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
687 |
status = Some(Build_Log.Session_Status.cancelled)) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
688 |
session_name -> entry |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
689 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
690 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
691 |
val settings = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
692 |
Build_Log.Settings.all_settings.map(_.name).map(name => |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
693 |
name -> Isabelle_System.getenv(name)) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
694 |
val props = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
695 |
List( |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
696 |
Build_Log.Prop.build_id.name -> build_context.build_uuid, |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
697 |
Build_Log.Prop.build_engine.name -> build_context.engine.name, |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
698 |
Build_Log.Prop.build_host.name -> hostname, |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
699 |
Build_Log.Prop.build_start.name -> Build_Log.print_date(start_date)) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
700 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
701 |
val meta_info = Build_Log.Meta_Info(props, settings) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
702 |
val build_info = Build_Log.Build_Info(sessions.toMap) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
703 |
val log_name = Build_Log.log_filename(engine = engine_name, date = start_date) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
704 |
|
79062
6977fb0153fb
clarified modules: Build_Log.private_data provides raw data access without transaction_lock;
wenzelm
parents:
79042
diff
changeset
|
705 |
Build_Log.private_data.update_sessions( |
6977fb0153fb
clarified modules: Build_Log.private_data provides raw data access without transaction_lock;
wenzelm
parents:
79042
diff
changeset
|
706 |
_log_database, _log_store.cache.compress, log_name.file_name, build_info) |
6977fb0153fb
clarified modules: Build_Log.private_data provides raw data access without transaction_lock;
wenzelm
parents:
79042
diff
changeset
|
707 |
Build_Log.private_data.update_meta_info(_log_database, log_name.file_name, meta_info) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
708 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
709 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
710 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
711 |
/* build process */ |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
712 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
713 |
case class Cache(state: Build_Process.State, configs: List[Config], estimate: Date) { |
78975
4a5d35b35aeb
better invalidation for schedule cache (only on relevant changes);
Fabian Huch <huch@in.tum.de>
parents:
78974
diff
changeset
|
714 |
def is_current(state: Build_Process.State): Boolean = |
4a5d35b35aeb
better invalidation for schedule cache (only on relevant changes);
Fabian Huch <huch@in.tum.de>
parents:
78974
diff
changeset
|
715 |
this.state.pending.nonEmpty && this.state.results == state.results |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
716 |
def is_current_estimate(estimate: Date): Boolean = |
78975
4a5d35b35aeb
better invalidation for schedule cache (only on relevant changes);
Fabian Huch <huch@in.tum.de>
parents:
78974
diff
changeset
|
717 |
Math.abs((this.estimate.time - estimate.time).ms) < Time.minutes(1).ms |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
718 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
719 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
720 |
private var cache = Cache(Build_Process.State(), Nil, Date.now()) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
721 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
722 |
override def next_node_info(state: Build_Process.State, session_name: String): Node_Info = { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
723 |
val configs = |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
724 |
if (cache.is_current(state)) cache.configs |
78928
6c2c60b852e0
move timing data into scheduler for more efficient heuristics (e.g., with pre-calculated values);
Fabian Huch <huch@in.tum.de>
parents:
78888
diff
changeset
|
725 |
else scheduler.next(state) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
726 |
configs.find(_.job_name == session_name).get.node_info |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
727 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
728 |
|
78969
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
729 |
def is_current(state: Build_Process.State, session_name: String): Boolean = |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
730 |
state.ancestor_results(session_name) match { |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
731 |
case Some(ancestor_results) if ancestor_results.forall(_.current) => |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
732 |
val sources_shasum = state.sessions(session_name).sources_shasum |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
733 |
|
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
734 |
val input_shasum = |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
735 |
if (ancestor_results.isEmpty) ML_Process.bootstrap_shasum() |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
736 |
else SHA1.flat_shasum(ancestor_results.map(_.output_shasum)) |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
737 |
|
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
738 |
val store_heap = |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
739 |
build_context.build_heap || Sessions.is_pure(session_name) || |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
740 |
state.sessions.iterator.exists(_.ancestors.contains(session_name)) |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
741 |
|
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
742 |
store.check_output( |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
743 |
_database_server, session_name, |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
744 |
session_options = build_context.sessions_structure(session_name).options, |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
745 |
sources_shasum = sources_shasum, |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
746 |
input_shasum = input_shasum, |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
747 |
fresh_build = build_context.fresh_build, |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
748 |
store_heap = store_heap)._1 |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
749 |
case _ => false |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
750 |
} |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
751 |
|
78970
5d38b72a1a66
finalize scheduled build only on master node;
Fabian Huch <huch@in.tum.de>
parents:
78969
diff
changeset
|
752 |
override def next_jobs(state: Build_Process.State): List[String] = { |
5d38b72a1a66
finalize scheduled build only on master node;
Fabian Huch <huch@in.tum.de>
parents:
78969
diff
changeset
|
753 |
val finalize_limit = if (build_context.master) Int.MaxValue else 0 |
5d38b72a1a66
finalize scheduled build only on master node;
Fabian Huch <huch@in.tum.de>
parents:
78969
diff
changeset
|
754 |
|
79020
ef76705bf402
clarified ready vs. next ready;
Fabian Huch <huch@in.tum.de>
parents:
79019
diff
changeset
|
755 |
if (progress.stopped) state.next_ready.map(_.name).take(finalize_limit) |
78975
4a5d35b35aeb
better invalidation for schedule cache (only on relevant changes);
Fabian Huch <huch@in.tum.de>
parents:
78974
diff
changeset
|
756 |
else if (cache.is_current(state)) cache.configs.map(_.job_name).filterNot(state.is_running) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
757 |
else { |
79020
ef76705bf402
clarified ready vs. next ready;
Fabian Huch <huch@in.tum.de>
parents:
79019
diff
changeset
|
758 |
val current = state.next_ready.filter(task => is_current(state, task.name)) |
78970
5d38b72a1a66
finalize scheduled build only on master node;
Fabian Huch <huch@in.tum.de>
parents:
78969
diff
changeset
|
759 |
if (current.nonEmpty) current.map(_.name).take(finalize_limit) |
78969
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
760 |
else { |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
761 |
val start = Time.now() |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
762 |
val next = scheduler.next(state) |
79073
b3fee0dafd72
generated build schedule explicitly (e.g., for further analysis);
Fabian Huch <huch@in.tum.de>
parents:
79064
diff
changeset
|
763 |
val estimate = Date(Time.now() + scheduler.build_schedule(state).duration) |
78969
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
764 |
val elapsed = Time.now() - start |
78884 | 765 |
|
78976 | 766 |
val timing_msg = if (elapsed.is_relevant) " (took " + elapsed.message + ")" else "" |
78969
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
767 |
progress.echo_if(build_context.master && !cache.is_current_estimate(estimate), |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
768 |
"Estimated completion: " + estimate + timing_msg) |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
769 |
|
78969
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
770 |
val configs = next.filter(_.node_info.hostname == hostname) |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
771 |
cache = Cache(state, configs, estimate) |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
772 |
configs.map(_.job_name) |
1b05c2b10c9f
finalize current sessions before generating schedule;
Fabian Huch <huch@in.tum.de>
parents:
78968
diff
changeset
|
773 |
} |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
774 |
} |
78970
5d38b72a1a66
finalize scheduled build only on master node;
Fabian Huch <huch@in.tum.de>
parents:
78969
diff
changeset
|
775 |
} |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
776 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
777 |
override def run(): Build.Results = { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
778 |
val results = super.run() |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
779 |
if (build_context.master) write_build_log(results, snapshot().results) |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
780 |
results |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
781 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
782 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
783 |
|
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
784 |
class Engine extends Build.Engine(engine_name) { |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
785 |
override def open_build_process( |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
786 |
context: Build.Context, |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
787 |
progress: Progress, |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
788 |
server: SSH.Server |
78928
6c2c60b852e0
move timing data into scheduler for more efficient heuristics (e.g., with pre-calculated values);
Fabian Huch <huch@in.tum.de>
parents:
78888
diff
changeset
|
789 |
): Build_Process = |
6c2c60b852e0
move timing data into scheduler for more efficient heuristics (e.g., with pre-calculated values);
Fabian Huch <huch@in.tum.de>
parents:
78888
diff
changeset
|
790 |
new Scheduled_Build_Process(context, progress, server) { |
6c2c60b852e0
move timing data into scheduler for more efficient heuristics (e.g., with pre-calculated values);
Fabian Huch <huch@in.tum.de>
parents:
78888
diff
changeset
|
791 |
def init_scheduler(timing_data: Timing_Data): Scheduler = { |
6c2c60b852e0
move timing data into scheduler for more efficient heuristics (e.g., with pre-calculated values);
Fabian Huch <huch@in.tum.de>
parents:
78888
diff
changeset
|
792 |
val heuristics = |
78929
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
793 |
List(5, 10, 20).map(minutes => |
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
794 |
Timing_Heuristic( |
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
795 |
Time.minutes(minutes), |
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
796 |
timing_data, |
df323f23dfde
performance tuning for timing heuristic: pre-calculate graph operations;
Fabian Huch <huch@in.tum.de>
parents:
78928
diff
changeset
|
797 |
context.build_deps.sessions_structure)) |
78931
26841d3c568c
performance tuning for build schedule: explicit schedule generation, without mixing heuristics;
Fabian Huch <huch@in.tum.de>
parents:
78930
diff
changeset
|
798 |
new Meta_Heuristic(heuristics) |
78928
6c2c60b852e0
move timing data into scheduler for more efficient heuristics (e.g., with pre-calculated values);
Fabian Huch <huch@in.tum.de>
parents:
78888
diff
changeset
|
799 |
} |
6c2c60b852e0
move timing data into scheduler for more efficient heuristics (e.g., with pre-calculated values);
Fabian Huch <huch@in.tum.de>
parents:
78888
diff
changeset
|
800 |
} |
78845
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
801 |
} |
ff96d94957cb
add module for faster scheduled builds;
Fabian Huch <huch@in.tum.de>
parents:
diff
changeset
|
802 |
} |