Eric Chang and Rutwik Parikh. Goal: Determine the largest subset of edges in a graph such that no...

Preview:

Citation preview

Parallelizing Edmonds’ Blossom

AlgorithmEric Chang and Rutwik Parikh

Goal: Determine the largest subset of edges in a graph such that no vertex of the graph is touched by more than one edge.

Maximal Matching Problem

No blue edges share a vertex, so they form a matching. This matching happens to be maximal.

An alternating path P is a set of edges from an exposed vertex to another exposed vertex where every other edge is in the matching, M. Augmenting a path exchanges membership of P in M, increasing the size of the matching by one edge.

Augmenting Paths

A blossom is an odd-length cycle of vertices with alternating edges. A contracted blossom acts exactly as a node.

Blossom Contraction

1. Begin with an edge-less forest of only exposed vertices which act as the roots of trees that we build.

2. Add matched edge (pairs of vertices) until we connect two trees.

3. If a blossom is found (connection from tree to itself), we contract the blossom and continue adding matched edges.

4. When an alternating path is found (completing one iteration step), we augment it and begin from Step 1.

5. If no more alternating paths exist, we have found a maximal matching in the graph.

Edmonds’ Blossom Algorithm

Summary of Algorithm

We conclude each iteration step when an augmenting path is found.

Graph is permanently shrunk whenever we discover a blossom.

Forest must be reconstructed for every iteration step.

We used OpenMP on a Gates 3000 cluster machine to obtain a parallel solution using shared memory.

These machines use 6 physical cores with hyper-threading.

Our Parallel Approach

Our solution involves simply parallelizing over the vertices during forest construction in every step using dynamic scheduling.

In order to maintain correctness as we modify the forest by adding edges and contracting blossoms, we assign each vertex a lock.

Our Parallel Approach

When a matched edge is added to the graph, the lock of the lower-numbered node is required.

If Thread 0 wins node 8’s lock, edge 4-8 is added.

If Thread 1 wins node 8’s lock, edge 5-13 is added.

Locking – Adding Matched Edges

We first acquire all locks in the blossom/path, then check if it is still valid, and release locks as we modify the nodes. Below is an example of deadlock.

Thread 0 holds node 4’s lock and tries to get node 8’s lock.

Thread 1 holds node 8’s lock and tries to get node 4’s lock.

Locking – Blossoms and Paths

If there is a conflict when acquiring locks, the higher thread number stalls while the lower thread number aborts.

Thread 0 relinquishes all locks in its partial blossom.

Thread 1 finishes acquiring all nodes of the alternating path.

Locking – Blossoms and Paths

Explanation of Results

Contention vs. Locality◦ Many “for” loops make simple padding

ineffective.◦ Shared cache in hyperthreading.

Stragglers◦ Iteration loops conclude when an alternating

path is found.◦ Other threads continue to finish what they’re

working on. Blossom/Path Invalidation

◦ Occurs while waiting for lock acquisition.◦ Wasted work.

Institute of Mathematical Sciences:http://www.imsc.res.in/~meena/matching/edmonds.pdf

Lucidchart:https://www.lucidchart.com/

Wikipedia:http://en.wikipedia.org/wiki/Edmonds%27s_matching_algorithm

Wolfram|Alpha:http://demonstrations.wolfram.com/TheBlossomAlgorithmForMaximumMatching/

Resources

Thank You!