Hypergraph-based system execution scheduler. - #8
Conversation
This is very likely broken
Removal might be temporary, I can just revert commits
Most likely fails, my environment broke again.
Just realized that branches that are going to join can run how fast they want.
The scheduler would push all threads to the same transition, causing potential races.
Temporary addition, will be removed in the next commit.
|
I'm giving up on the Fibonacci Heap for now as I don't know how to implement removal without key decreases. |
|
I'm not sure if I fully grasp your modeling. Let me illustrate what I read from your wording first. 1 Build HypergraphLet's say so hyperedges are
So the systems sharing a hyperedge may conflict. 2 Build Another Graph To Represent The CompatibilityBased on
As a result, we got graph TD
A <--> C
B <--> C
And based on what you said
I think the resulting graph isn't necessarily disjoint and I just created a counterexample.
Therefore, the resulting graph is a compatibility graph instead of a conflict graph. 3 Compatibility Graph Coloringgraph TD
A[Red] <--> C[Blue]
B[Red] <--> C[Blue]
4 Add To Priority QueuesAnd the priority is set by the user right? Let's say A is greater than B here. Just a quick check, B runs after A, which is correct as both of them wants 5 Build The DAG (aka
|
|
I was wrong about the compat graph coloring. We should find cliques intead OR color the conflict graph. CounterexampleCompat graph: graph TD
A <--> B
B <--> C
C <--> D
Minimum coloring: graph TD
A[Red] <--> B[Blue]
B[Blue] <--> C[Red]
C[Red] <--> D[Blue]
A is incompatible with D since there is no edge between A and D, but Example: Clique Coveringgraph TD
A[A] <--> B[B]
B[B] <--> C[C]
C[C] <--> D[D]
We want cliques to cover all the edges. Clique family: We need to construct the clique traversal: For every adjacent clique in the traversal, we want to compute some properties: A conservative transition rule can be defined as:
The queues can therefore be derived The derived queues are totally valid as AB are compatible and CB are compatible. (reading the columns) AlgorithmsCliques TO Clique Traversal (WIP)For certain compat graphs like However, consider The cliques will be C_1={A, B}, C_2={B, D}, C_3={D, C}, C_4={C, A} The clique traversal construction is harder/impossible since it forms a cyclic structure. A linear traversal covering every clique doesn't exist under certain situations, for example the 4-cycle above. Clique Traversal TO QueuesThe Shared/Leaving/New model is enough to generalize the process. A conservative transition rule can be defined as:
Clique Family ConstructionGeneral Idea:
Let's formulate how to minimize the vertex overlaps.
Clique family: 𝓒 = {C_1, ... , C_m} 𝓒 must satisfy that E ⊆ union over C_i edges Sigma Clique Cover: scc(G) = min over 𝓒 (summation over every C∈𝓒, |C|) Goal: find a clique family 𝓒 that attains Turns out whether the individual cliques are strictly the largest doesn't matter, but We are able to derive some corollaries as well. If there is no vertex overlap & G has no isolated vertices, scc(G)=|V| And, Define clique multiplicity of a vertex: val_𝓒(v) = |{C_i : v ∈ C_i }| (summation over every C∈𝓒, |C|) = (summation over every v∈V, val_𝓒(v)) If there is no isolated vertex, then (summation over every C∈𝓒, |C|) - |V|= (summation over every v∈V, val_𝓒(v) - 1) |

In this PR, I implemented a system scheduler that automatically decides which tasks can be ran in parallel.
The Scheduler works as follows:
TODO:
Use a Fibonacci Heap in the graph coloring function as it's faster.