Abusing a hypergraph partitioner for unweighted graph partitioning · 2012. 2. 24. · Abusing a...
Transcript of Abusing a hypergraph partitioner for unweighted graph partitioning · 2012. 2. 24. · Abusing a...
Abusing a hypergraph partitioner for unweighted graphpartitioning
B. O. Fagginger Auer R. H. Bisseling
Utrecht University
February 13, 2012
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 1 / 24
Main questions
1 Use: How good is Mondriaan partitioning for what it is meant to do,reducing communication volume?
2 Abuse: How much do we lose in speed and quality by using a moregeneral hypergraph partitioner just for graph partitioning?
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 2 / 24
Introduction
We will discuss applying the Mondriaan matrix partitioner to graphpartitioning problems.
We translate graphs → matrices.
Mondriaan translates matrices → hypergraphs, and partitions these.
Going back, this yields a partitioning of the original graph.
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 3 / 24
Adjacency set of a vertex
An undirected graph is a pair (V ,E ) with vertices v and edges E .
Edges e ∈ E are of the form e = {u, v} for u, v ∈ V .
Define the set of neighbours of a vertex v ∈ V as
Vv := {u ∈ V | {u, v} ∈ E}.
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 4 / 24
Hypergraphs
Hypergraphs generalise graphs: edges can connect any number ofvertices.
A hypergraph is a pair (V,N ) with vertices V and nets (orhyperedges) N .
Each net n ∈ N is a set of vertices: n ⊆ V.
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 5 / 24
Matrices
Pattern matrices A ∈ {0, 1}m×n can be represented by hypergraphs.
Mondriaan supports three hypergraph representations:I row-net (Catalyurek & Aykanat, 1999): columns are vertices,
rows are nets.I column-net (Catalyurek& Aykanat, 1999): rows are vertices,
columns are nets.I finegrain (Catalyurek& Aykanat, 2001): nonzeros are vertices,
rows and columns are nets.
We will use the row-net representation.
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 6 / 24
Row-net hypergraph
3
21
4 5
67
G = (V,N )
V = {1, 2, 3, 4, 5, 6, 7}N = {{1, 2}, {1, 4, 5, 6}, {4}, {3, 5, 7}}
A =
1 1 0 0 0 0 01 0 0 1 1 1 00 0 0 1 0 0 00 0 1 0 1 0 1
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 7 / 24
Mondriaan partitioner
Mondriaan is a matrix partitioner for parallel sparse matrix–densevector multiplication.
Let A ∈ Rm×n and v ∈ Rn be the matrix and input vector, and definethe output vector by
u := A v.
This multiplication is done in parallel: nonzeros of A and vectorcomponents of u and v are distributed among processors.
Mondriaan tries to minimize parallel communication, while balancingthe number of nonzeros per processor.
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 8 / 24
Column partitioning (Mondriaan in 1D mode)
u A
v
Partitioning among k = 3 processors with communication volume 4.
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 9 / 24
Column partitioning (fe tooth)
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 10 / 24
Column partitioning (fe tooth)
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 10 / 24
Column partitioning (fe tooth)
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 10 / 24
Column partitioning (fe tooth)
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 10 / 24
Hypergraph partitioning problem
Mondriaan solves the following problem internally.
Problem
Let G = (V,N ) be a hypergraph, with vertex weights ζ : V → R>0, k ∈ Nthe number of parts, and ε > 0 an imbalance factor.Find a partitioning Π : V → {1, . . . , k} that is balanced:∑
v∈V
Π(v)=i
ζ(v) ≤ (1 + ε)
⌈ζ(V)
k
⌉, (1 ≤ i ≤ k), (1)
which minimises the (λ− 1)-metric
LV(Π) :=∑n∈N
(|Π(n)| − 1). (2)
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 11 / 24
Use: Graph partitioning problem (Communication Volume)
For DIMACS, the communication volume problem is similar.
Problem
Let G = (V ,E ) be a graph, k ∈ N the number of parts, and ε > 0 animbalance factor.Find a partitioning Π : V → {1, . . . , k} that is balanced:
|{v ∈ V : Π(v) = i}| ≤ (1 + ε)
⌈|V |k
⌉, (1 ≤ i ≤ k), (3)
which minimises the communication volume
CV(Π) := max1≤i≤k
∑v∈V
Π(v)=i
|Π(Vv ) \ {Π(v)}|. (4)
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 12 / 24
Graph partitioning problem (Communication Volume)
How to use Mondriaan to solve this DIMACS problem?
Balancing and partitioning: pick V := V and ζ(v) := 1 for all v ∈ V .
We should choose nets N to match∑n∈N
(|Π(n)| − 1) and max1≤i≤k
∑v∈V
Π(v)=i
|Π(Vv ) \ {Π(v)}|.
Note that|Π(Vv ) \ {Π(v)}| = |Π(Vv ∪ {v})| − 1.
Hence, N := {Vv ∪ {v} | v ∈ V } is a good choice.
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 13 / 24
Graph partitioning problem (Communication Volume)
With V := V and N := {Vv ∪ {v} | v ∈ V }, we have
LV(Π) =∑v∈V
|Π(Vv ) \ {Π(v)}|.
Comparing this with
CV(Π) = max1≤i≤k
∑v∈V
Π(v)=i
|Π(Vv ) \ {Π(v)}|,
we find that1
kLV(Π) ≤ CV(Π) ≤ LV(Π).
Thus we minimise LV(Π), in the hope of minimising CV(Π).
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 14 / 24
Translate hypergraph to adjacency matrix
Row-net matrix representation A ∈ {0, 1}|V |×|V |:
au v :=
{1 u = v or {u, v} ∈ E ,0 otherwise,
(u, v ∈ V ).
3
21
4 5
67
A =
1 1 0 1 1 0 01 1 1 0 1 0 00 1 1 0 1 0 11 0 0 1 1 1 01 1 1 1 1 1 10 0 0 1 1 1 10 0 1 0 1 1 1
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 15 / 24
Abuse: Graph partitioning problem (Edge Cut)
The edge cut problem is easier.
Problem
Let G = (V ,E ) be a graph, k ∈ N the number of parts, and ε > 0 animbalance factor.Find a partitioning Π : V → {1, . . . , k} that is balanced:
|{v ∈ V : Π(v) = i}| ≤ (1 + ε)
⌈|V |k
⌉, (1 ≤ i ≤ k), (5)
which minimises the edge cut
EC(Π) := |{{u, v} ∈ E | Π(u) 6= Π(v)}|. (6)
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 16 / 24
Graph partitioning problem (Edge Cut)
Again: pick V := V and ζ(v) := 1 for all v ∈ V .
Note that for vertices u, v ∈ V ,
|Π({u, v})| − 1 =
{1 Π(u) 6= Π(v),0 otherwise.
Pick N := E , thenEC(Π) = LV(Π).
Thus, every edge becomes a hyperedge.
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 17 / 24
Translate hypergraph to incidence matrix
Row-net matrix representation A ∈ {0, 1}|E |×|V |:
ae v :=
{1 v ∈ e,0 otherwise,
(e ∈ E , v ∈ V ).
3
21
4 5
67
A =
1 1 0 0 0 0 01 0 0 1 0 0 01 0 0 0 1 0 00 1 0 0 1 0 00 1 1 0 0 0 00 0 1 0 1 0 00 0 0 1 1 0 00 0 1 0 0 0 10 0 0 1 0 1 00 0 0 0 1 1 00 0 0 0 1 0 10 0 0 0 0 1 1
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 18 / 24
Olympic spirit
“The most important thing in the Olympic Games is not to winbut to take part, just as the most important thing in life is notthe triumph but the struggle. The essential thing is not to haveconquered but to have fought well.” (Pierre de Coubertin)
For DIMACS challenge paper, we measure average volumesfrom a set of 5 or 10 runs, not the best from the set.
Updated version of Mondriaan 3.11 with its own partitioner.
Aim: investigate how standard Mondriaan fares on average.
For DIMACS solution challenge, we submitted the first run.
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 19 / 24
Test setup
Test set: 10th DIMACS challenge walshaw/ and matrix/ categories.
Imbalance is set to ε = 0.03 and k = 2, 4, . . . , 1024.
Test hardware: dual quad-core AMD Opteron 2378 (Mondriaan usesone core).
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 20 / 24
Results (Communication Volume)
10-2
10-1
100
101
102
103
104
105
103 104 105 106 107 108 109
Par
titio
ning
tim
e (s
)
Number of graph edges
Partitioning time (communication volume)
walshaw (2)walshaw (32)
walshaw (1024)matrix (2)
matrix (32)matrix (1024)
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 21 / 24
Results (Edge Cut)
10-2
10-1
100
101
102
103
104
105
103 104 105 106 107 108 109
Par
titio
ning
tim
e (s
)
Number of graph edges
Partitioning time (edge cut)
walshaw (2)walshaw (32)
walshaw (1024)matrix (2)
matrix (32)matrix (1024)
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 22 / 24
Results: how do we fare?
Edge cut is, on average, 21% worse than best known (Walshaw).
Communication volume imbalance,
CV(Π)
LV(Π)/k− 1,
is very small compared to its maximum k − 1. We attribute this tounbiased tie breaking in Mondriaan.
0
20
40
60
80
100
120
140
2 4 8 16 32 64 128 256 512 1024
Imba
lanc
e (%
)
Number of parts k
Communication volume imbalance
finan512144
ecology1af_shell10G3_circuit
cage15nlpkkt200
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 23 / 24
Conclusion
It is possible to abuse Mondriaan to perform graph partitioning.
Mondriaan’s average edge cut is 21% higher than the best known(Walshaw).
Partitionings generated by Mondriaan have reasonably balancedcommunication volume.
We identified future additions to Mondriaan:I net weights to allow for full generality of DIMACS challenge;I volume equaliser in matrix partitioner for a little extra gain in
communication balance.
Fagginger Auer, Bisseling (UU) Mondriaan Graph Partitioning February 13, 2012 24 / 24