Upload
others
View
18
Download
0
Embed Size (px)
Citation preview
1 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
EngineeringGraph Partitioning AlgorithmsVitaly Osipov, Peter Sanders, Christian Schulz
KIT – Universitat des Landes Baden-Wurttemberg undnationales Großforschungszentrum in der Helmholtz-Gemeinschaft www.kit.edu
Overview
2 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
IntroductionMultilevel AlgorithmsAdvanced TechniquesEvolutionary TechniquesExperimentsSummary
Simulation - FEM
3 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Simulation space is discretizedinto a meshSolution of partial differentialequations are approximated bylinear equationsNumber of vertices canbecome quite large→ time and memoryParallel processing required
The Common Parallel Approach
4 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Mesh partitioned via dual graph1. Each volume (data, calculation) is
represented by a vertex2. Interdependencies are represented by
edges
All PE’s get same amount of workCommunication is expensive
Graph Partitioning Problem:Partition a graph into (almost) equally sized blocks, such that thenumber of edges connecting vertices from different blocks is minimal.
ε-Balanced Graph Partitioning
5 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Partition graph G = (V ,E , c : V → R>0,ω : E → R>0)into k disjoint blocks s.t.
total node weight of each block ≤ 1 + ε
ktotal node weight
total weight of cut edges as small as possible
Applications:linear equation systems, VLSI design, route planning, . . .
Multi-Level Graph Partitioning
6 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Successful in existing systems:Metis, Scotch, Jostle,. . . , KaPPa, KaSPar, KaFFPa, KaFFPaE
Advanced TechniquesTalk Today
7 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Edge RatingsHigh Quality MatchingsFlow Based RefinementsMore Localized Local SearchF-cycles for Graph Partitioningn-Level Approach
Graph PartitioningMatching Selection
8 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Goals:1. large edge weights sparsify2. large #edges few levels3. uniform node weights “represent” input4. small node degrees “represent” input unclear objective gap to approx. weighted matchingwhich only considers 1.,2.
Our Solution:Apply approx. weighted matching to general edge rating function
input graph
...
contract
match
Graph PartitioningEdge Ratings
9 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
ω(u, v)
expansion(u, v) :=ω(u, v)
c(u) + c(v)
expansion∗(u, v) :=ω(u, v)c(u)c(v)
expansion∗2(u, v) :=ω(u, v)2
c(u)c(v)
innerOuter(u, v) :=ω(u, v)
Out(v) + Out(u)− 2ω(u, v)
expansion∗2−adist(u, v) :=expansion∗2(u, v)
φu,v
where c = node weight, ω =edge weight,Out(u) := ∑u,v∈E ω(u, v)
Flows as Local ImprovementTwo Blocks
10 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
V1V2B
Gs t
∂1B ∂2B
area B, such that each (s, t)-min cut is ε-balanced cut in Ge.g. 2 times BFS (left, right)
stop the BFS, if size would exceed (1 + ε) c(V )2 − c(V2)
⇒ c(V2new) ≤ c(V2) + (1 + ε) c(V )2 − c(V2)
Flows as Local ImprovementTwo Blocks
11 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
s t
B
GV1
V2
obtain optimal cut in Bsince each cut in B yields a feasible partition→ improved two-partitionadvanced techniques possible and necessary
Example100x100 Grid
12 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
ExampleConstructed Flow Problem (using BFS)
13 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
ExampleApply Max-Flow Min-Cut
14 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
ExampleOutput Improved Partition
15 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Local Improvement for k -partitionsUsing Flows?
16 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
on each pair of blocks
input graph
...
initial
...
outputpartition
local improvement
partitioning
match
contract uncontract
More Localized Local Search
17 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Idea: KaPPa, KaSPar ⇒ more local searches are betterTypical: k -way local search initialized with complete boundaryLocalization:
1. complete boundary⇒ maintained todo list T2. initialize search with single node v ∈rnd T3. iterate until T = ∅
each node moved at most once
More Localized Local Search
17 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Idea: KaPPa, KaSPar ⇒ more local searches are betterTypical: k -way local search initialized with complete boundaryLocalization:
1. complete boundary⇒ maintained todo list T2. initialize search with single node v ∈rnd T3. iterate until T = ∅
each node moved at most once
More Localized Local Search
17 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Idea: KaPPa, KaSPar ⇒ more local searches are betterTypical: k -way local search initialized with complete boundaryLocalization:
1. complete boundary⇒ maintained todo list T2. initialize search with single node v ∈rnd T3. iterate until T = ∅
each node moved at most once
More Localized Local Search
17 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Idea: KaPPa, KaSPar ⇒ more local searches are betterTypical: k -way local search initialized with complete boundaryLocalization:
1. complete boundary⇒ maintained todo list T2. initialize search with single node v ∈rnd T3. iterate until T = ∅
each node moved at most once
More Localized Local Search
17 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Idea: KaPPa, KaSPar ⇒ more local searches are betterTypical: k -way local search initialized with complete boundaryLocalization:
1. complete boundary⇒ maintained todo list T2. initialize search with single node v ∈rnd T3. iterate until T = ∅
each node moved at most once
More Localized Local Search
17 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Idea: KaPPa, KaSPar ⇒ more local searches are betterTypical: k -way local search initialized with complete boundaryLocalization:
1. complete boundary⇒ maintained todo list T2. initialize search with single node v ∈rnd T3. iterate until T = ∅
each node moved at most once
More Localized Local Search
17 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Idea: KaPPa, KaSPar ⇒ more local searches are betterTypical: k -way local search initialized with complete boundaryLocalization:
1. complete boundary⇒ maintained todo list T2. initialize search with single node v ∈rnd T3. iterate until T = ∅
each node moved at most once
More Localized Local Search
17 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Idea: KaPPa, KaSPar ⇒ more local searches are betterTypical: k -way local search initialized with complete boundaryLocalization:
1. complete boundary⇒ maintained todo list T2. initialize search with single node v ∈rnd T3. iterate until T = ∅
each node moved at most once
More Localized Local Search
17 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Idea: KaPPa, KaSPar ⇒ more local searches are betterTypical: k -way local search initialized with complete boundaryLocalization:
1. complete boundary⇒ maintained todo list T2. initialize search with single node v ∈rnd T3. iterate until T = ∅
each node moved at most once
More Localized Local Search
17 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Idea: KaPPa, KaSPar ⇒ more local searches are betterTypical: k -way local search initialized with complete boundaryLocalization:
1. complete boundary⇒ maintained todo list T2. initialize search with single node v ∈rnd T3. iterate until T = ∅
each node moved at most once
More Localized Local Search
17 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Idea: KaPPa, KaSPar ⇒ more local searches are betterTypical: k -way local search initialized with complete boundaryLocalization:
1. complete boundary⇒ maintained todo list T2. initialize search with single node v ∈rnd T3. iterate until T = ∅
each node moved at most once
More Localized Local Search
17 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Idea: KaPPa, KaSPar ⇒ more local searches are betterTypical: k -way local search initialized with complete boundaryLocalization:
1. complete boundary⇒ maintained todo list T2. initialize search with single node v ∈rnd T3. iterate until T = ∅
each node moved at most once
Global SearchIterated Multilevel [Walshaw 2004]
18 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
contract
input graph
match
... ...local improvement
partitioning
initialuncontractcontract
...
uncontract
local improvement...
match
don’t contract cut edgesno new initial partitioning neededrandom tiebreaking neededlocal improvement has to assure ≤ cuts
Global SearchV-Cycles
19 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Co
arse
nin
gU
nco
arsenin
g
Graph not partitioned
Graph partitioned
Global SearchF-Cycles
20 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Un
coarsen
ingC
oar
sen
ing
Graph not partitioned
Graph partitioned
Sequential Graph PartitioningKarlsruhe Sequential Partitioner
21 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
1. Contractioncontract a single edge between two levels
possibly n levelsfinegrained contraction consequtive levels are very similarno matching algorithm required
use of different edge ratings uniform distribution of node weightspriority queue defines the order of edges to be contracted
2. Local Searchefficent stopping criterion avoid quadratic runtime
3. GeneralTrial Trees improve quality by independent trials
KaSParLocal Search
22 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Nodes unmarked, active, markedactive nodes
compute gains of moving from one block toanotherchoose the maximum gain
when movedactive markedcan’t become active anymoreunmarked neighbours of marked active
v
u
⇒
v
u
KaSParLocal Search - Stopping Criteria
23 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
touching each node on each level leadsto Ω(n2) runtime⇒ need flexible stopping criteriagains in each step identicallydistributed, independent randomvariables
expectation µvariance σ2
compute µ and σ2 from previous stepsstop after p steps if pµ2 > ασ2 + β
v
u
⇒
v
u
KaSParMemory Overhead
24 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
addressable PQ based on pairing heaps used for contractiondynamic graph data structure
1
2
3
4
5
104
105
106
107
108
me
mo
ry o
verh
ea
d
m
Sequential Graph PartitioningKarlsruhe Fast Flow Partitioner
25 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Focus: Local and Global SearchLocal Search:
1. Flow Based Improvement Methods2. More Localized FM Algorithm (inspired by KaSPar)
Global Search:1. V-cycles and F-cycles similar to methods used in multigrid
V1V2B
Gs t
∂1B ∂2B
contract
input graph
match
... ...local improvement
partitioning
initialuncontractcontract
...
uncontract
local improvement...
match
DistributedEvolutionary Graph Partitioning
26 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Evolutionary Algorithms:highly inspired by biologypopulation of individualsselection, mutation, recombination, ...
Goal: Integrate KaFFPa in an Evolutionary StrategyEvolutionary Graph Partitioning:
individuals ↔ partitionsfitness ↔ edge cut
Parallelization→ quality records in a few minutes for small graphs
Evolutionary AlgorithmsGeneral Structure
27 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
procedure steady-state-EAcreate initial population Pwhile stopping criterion not fulfilled
select parents P1, P2 from Pcombine P1 with P2 to create offspring omutate offspring oevict individual in population using o
return the fittest individual that occurred
Combine
28 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
match
contract
two individuals P1, P2:don’t contract cut edges of P1 or P2
until no matchable edge is leftcoarsest graph↔ Q-graph of overlay→ exchanging good parts is easyinital solution: use better of both parents
ExampleTwo Individuals P1, P2
29 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
ExampleOverlay of P1, P2
30 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
⇒
ExampleMultilevel Combine of P1, P2
31 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
match
contract
⇒
Exchanging good parts is easyCoarsest Level
32 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
>> <
>> <
G
v1
v2
v3
v4 >> <
>> <
G
v1
v2
v3
v4
>> large weight, < small weightstart with the better partition (red, P2)move v4 to the opposite blockintegrated into multilevel scheme (+local search on each level)
ExampleResult of P1, P2
33 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
⇒
Parallelization
34 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
each PE has its own island (a local population)locally: perform combine and mutation operationscommunicate analog to randomized rumor spreading
1. rumor↔ currently best local partition2. local best partition changed → send it to O(log P) random PEs3. asynchronous communication (MPI Isend)
Experimental ResultsComparison with Other Systems
35 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Geometric mean, imbalance ε = 0.03:11 graphs (78K–18M nodes) ×k ∈ 2,4,8,16,64
Algorithm large graphsBest Avg. t[s]
KaFFPa strong 12 053 12 182 121.22KaSPar strong 12 450 +3% 87.12KaFFPa eco 12 763 +6% 3.82Scotch 14 218 +20% 3.55KaFFa fast 15 124 +24% 0.98kMetis 15 167 +33% 0.83
Repeating Scotch as long as KaSPar strong run and choosing thebest result 12.1% larger cutsWalshaw instances, road networks, Florida Sparse MatrixCollection, random Delaunay triangulations, random geometricgraphs
QualityEvolutionary Graph Partitioning
36 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
blocks k KaFFPaEimprovement overreps. of KaFFPa
2 0.2%4 1.0%8 1.5%
16 2.7%32 3.4%64 3.3%
128 3.9%256 3.7%
overall 2.5%
2h time, 32 cores per graph and k , geom. mean
Quality
37 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
1 5 20 100 500
7900
8100
8300
k=64
normalized time tn
mea
n m
in c
ut Repetitions
KaFFPaE
Walshaw Benchmark
38 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
runtime is not an issue614 instances (ε ∈ 1%,3%,5%)focus on partition quality
Algorithm < ≤KaPPa 131 189KaSPar 155 238KaFFPa 317 435KaFFPaE 300 470
overall quality records ≤:ε ≤1% 78%3% 92%5% 94%
Summary
39 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
input graph
OutputPartition
contract
... ...
match
distr.evol. Alg.
partitioning
initial
local improvement
uncontract
Cycles a la multigridW−F−V−
[ALENEX12]
+
flows etc.
MultilevelGraph Partitioning
Outlook
40 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Further Material in the Paper(s)F-cycles, High Quality Matchings, ....Different combine and mutation operatorsSpecialization to road networks (Buffoon)Many more details and experiments ...
Future Workother objective functions
currently via selection criterionconnectivity? f (P) := f (P) + χP not connected · |E |
integrate other partitionersgraph clusteringopen source release
41 Vitaly Osipov, Peter Sanders, Christian Schulz:Engineering Graph Partitioning Algorithms
Department of InformaticsInstitute for Theoretical Computer Science, Algorithmics II
Thank you!
Contact: [email protected]@kit.edu