14
Implementing Parallel Graph Algorithms: Graph coloring Created by: Avdeev Alex, Blakey Paul.

Implementing Parallel Graph Algorithms: Graph coloring Created by: Avdeev Alex, Blakey Paul

Embed Size (px)

Citation preview

Page 1: Implementing Parallel Graph Algorithms: Graph coloring Created by: Avdeev Alex, Blakey Paul

Implementing Parallel Graph Algorithms: Graph coloring

Created by: Avdeev Alex,

Blakey Paul.

Page 2: Implementing Parallel Graph Algorithms: Graph coloring Created by: Avdeev Alex, Blakey Paul

Criteria for good graph coloring algorithm:

o Coloring Quality: Number of colors needed

• Number of colors ( Kn ) = n

• Number of colors < max ( degree ( Vi ) ) + 1

o Execution time:

• Serial Algorithms

VS.

• Parallel Algorithms

A B

Page 3: Implementing Parallel Graph Algorithms: Graph coloring Created by: Avdeev Alex, Blakey Paul

Serial Graph coloring Approach:

o Greedy Multicoloring

Numbering the vertexes order in Lexicographical / BFS / Cuthill

Mckee / etc…

Iteration through the mesh: each vertex visited, colored by the

minimal color available.

o Luby Jones

Random Numbering of vertexes.

Iterate through the mesh. If possible assign the current color to

vertex.

Pick new color every iteration.

o Distance-k Graph Coloring

All vertices within the distance-K from each other has

unique colors.

Page 4: Implementing Parallel Graph Algorithms: Graph coloring Created by: Avdeev Alex, Blakey Paul

Parallel Graph Coloring:

The last decades a lot of work has been

invested into the process of parallelizing

graph coloring algorithms.

Can be divided into two kinds of

algorithms:

• Graphs divided into sub-sets, where

each sub-set sequentially colored by

Multicolor Algorithm.

• Luby Jones approach Algorithms.

Yet, none of this left the Greedy

Multicoloring Algorithm obsolete.

Page 5: Implementing Parallel Graph Algorithms: Graph coloring Created by: Avdeev Alex, Blakey Paul

Parallelizing categories:

Two kinds of approaches to Parallelizing

Coloring Algorithm:

o Local Parallelization:

The adjacent vertices of the current

vertex can be target for parallelization.

o Global Parallelization:

Divide the graph into sub-sets and color

each one of them. Each sub-set is colored

in parallel.

Page 6: Implementing Parallel Graph Algorithms: Graph coloring Created by: Avdeev Alex, Blakey Paul

Implementation optimizations done:

Numbering:

o We wanted to number the graph so we have less adjacent

vertices between different sub-sets, trying to reduce wait time

for acquiring locks belonging to different sets.

• Lexicographical

• Breadth First Search

• Random

• Cuthill Mckee Numbering

Page 7: Implementing Parallel Graph Algorithms: Graph coloring Created by: Avdeev Alex, Blakey Paul

Parallel Greedy Multicoloring:

Research & Implementation

Page 8: Implementing Parallel Graph Algorithms: Graph coloring Created by: Avdeev Alex, Blakey Paul

Our First Algorithm: Global Cuthill Mckee Numbering

o Initialize graph and Number the vertices with Cuthill Mckee Numbering approach.

o Divide graph to equal chunks.

o For each chunk do in parallel:

o Color the vertices with Multicolor algorithm:

Iteration through the mesh of chunk: each vertex visited, is colored by the minimal color possible.

• The synchronization is done by the Galois system.

Page 9: Implementing Parallel Graph Algorithms: Graph coloring Created by: Avdeev Alex, Blakey Paul

• Second Algorithm: Local Breadth First Search Graph Coloring

o Go on the graph vertexes on Breadth First Search order by pushing the first vertex to a

worklist

o And for each vertex in worklist:

o Color the vertex with the first available color (not used by adjacent vertex)

o Push adjacent vertexes to the worklist if not already pushed or colored

Page 10: Implementing Parallel Graph Algorithms: Graph coloring Created by: Avdeev Alex, Blakey Paul

• Third Algorithm: Global Random Multicoloring

o Go over the graph vertexes

o For each vertex do:

Color the vertex with the first available color (not used by adjacent vertex)

Page 11: Implementing Parallel Graph Algorithms: Graph coloring Created by: Avdeev Alex, Blakey Paul

Runtime Results:

o We received worse running

time in algorithm scheduled by

Mckee Numbering (Sorting was

required)

o RndLoc. And BFS received

much better running times

o We can see in general that as

we increase the number of

Active threads for RndLoc. And

BFS , we receive better

performance (until some upper

limit)

Page 12: Implementing Parallel Graph Algorithms: Graph coloring Created by: Avdeev Alex, Blakey Paul

Runtime Results:

o BFS Algorithm and the

Random Greedy Algorithm

receives good running time

even on BIG graphs.

Page 13: Implementing Parallel Graph Algorithms: Graph coloring Created by: Avdeev Alex, Blakey Paul

Runtime Results:

o Mckee received best coloring

quality on real and dense

graphs among the algorithms.

Page 14: Implementing Parallel Graph Algorithms: Graph coloring Created by: Avdeev Alex, Blakey Paul

Conclusions: Serial Implementations vs.Parallel Implementations:

o Color quality vary to both sides with thread number, graph structure, scheduling and chunk size, only

guarantee is that the number of colors will still be lower than graph's max degree + 1.

o BFS and Random seem to perform on the same level. On the tested graphs, BFS got lower colors and more

graphs than Random, but Random usually performed a bit faster. Cuthill Mckee gave a better color quality

than both other algorithmswhen it actually done coloring on the real world (large/non-random) graphs.

o BFS and Random improved the running with increasing the thread count as we wanted and expected, while

Cuthill Mckee sometimes did sometimes didn't.

o We concluded that the time cost needed to sort our graph vertex numbers for the "ordered" Cuthill Mckee

algorithm so we can divide chunks to threads was too much in Galois system.

o Number of colors change from run to run using the same parameters and graph.