Download presentation
Presentation is loading. Please wait.
Published byDominic Rice Modified over 6 years ago
1
Case Study 2- Parallel Breadth-First Search Using OpenMP
PARALLEL PROGRAM DEVELOPMENT Case Study 2- Parallel Breadth-First Search Using OpenMP
2
Breadth-first search (BFS) is a common algorithm that you've almost certainly seen in a prior algorithms class. In this problem, you'll explore the challenges of parallelizing BFS on modern parallel machines. Please familiarize yourself with the function bfs_top_down() in bfs.cpp, which contains a sequential implementation of BFS. The code uses BFS to compute the distance to vertex 0 for all vertices in the graph. You may wish to familiarize yourself with the graph structure defined in graph.h as well as the simple array data structure vertex_set which is an array of vertices used to represent the current frontier of BFS.
3
Step 1 Please parallelize the top-down BFS. You'll need to focus on identifying parallelism, as well as inserting the appropriate synchronization to ensure correctness. We'll point out up front that you should not expect to achieve near-perfect speedups on this problem (we'll leave it to you to think about why!). A good solution in step 1 will perform approximately three times faster than the sequential starter code when using 12 threads on the six-core (but hyper-threaded) GHC machines when run on the larger random graphs.
4
Step 2 If you take a look at the step-by-step results of the top-down BFS, you'll notice that the frontier grows quite large in some steps (sometimes growing to contain a large fraction of the entire graph). This is particularly true in the rmat graphs. Think about why this behavior might cause a performance problem in the top-down BFS implementation from step 1. It suggests an alternative implementation of a breadth-first search step that may be more efficient in these situations. Instead of iterating over all vertices in the frontier and marking all vertices adjacent to the frontier, it is possible to implement BFS by having each vertex check whether it should be added to the frontier! Basic pseudocode for the algorithm is as follows: for each vertex v in graph: if v has not been visited AND v shares an incoming edge with a vertex on the frontier: add vertex v to frontier;
5
Step 3 Now that you have implemented both top-down and bottom-up parallel BFS implementations, combine the techniques to form a new hybrid algorithm that performs a faster parallel BFS than either of the two techniques alone. This hybrid approach is called a "Direction Optimization BFS".
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.