Download presentation

Presentation is loading. Please wait.

Published byAngie Tutt Modified over 2 years ago

1
Partitioning and Divide-and-Conquer Strategies ITCS 4/5145 Parallel Computing, UNC-Charlotte, B. Wilkinson, Jan 23, 2013.

2
4.1 Partitioning Partitioning simply divides the problem into parts and then compute the parts and combine results.

3
4.1 Divide and Conquer Characterized by dividing problem into sub-problems of same form as larger problem. Further divisions into still smaller sub-problems, usually done by recursion. Recursive divide and conquer amenable to parallelization because separate processes can be used for divided parts. Also usually data is naturally localized.

4
4.2 Partitioning/Divide and Conquer Examples Many possibilities. Operations on sequences of number such as simply adding them together Several sorting algorithms can often be partitioned or constructed in a recursive fashion Numerical integration

5
4.3 Partitioning a sequence of numbers into parts and adding the parts

6
4.4 Tree construction

7
4.5 Dividing a list into parts

8
4.6 Partial summation

9
Many Sorting algorithms can be parallelized by partitioning and by divide and conquer. Example Bucket sort

10
4.9 Bucket sort One “bucket” assigned to hold numbers that fall within each region. Numbers in each bucket sorted using a sequential sorting algorithm. Sequential sorting time complexity: O(nlog(n/m). Works well if the original numbers uniformly distributed across a known interval, say 0 to a - 1.

11
4.10 Parallel version of bucket sort Simple approach Assign one processor for each bucket.

12
4.11 Further Parallelization Partition sequence into m regions. Each processor assigned one region. (Hence number of processors, p, equals m.) Each processor maintains one “big” bucket for its region. Each processor maintains m “small” buckets, one for each region. Each processor separates numbers in its region into its own small buckets. All small buckets emptied into p big buckets Each big bucket sorted by its processor

13
4.12 Another parallel version of bucket sort

14
An MPI function that can be used to advantage here. Sends one data element from each process to every other process. Corresponds to multiple scatter operations, but implemented together. Should be called all-to-all scatter? all-to-all broadcast

15
4.14 From: http://www.mhpcc.edu/training/workshop/parallel_intro/MAIN.html

16
4.13 Applying “all-to-all” broadcast to emptying small buckets into big buckets Suppose 4 regions and 4 processors Small bucket Big bucket

17
4.14 “all-to-all” routine actually transfers rows of an array to columns: Transposes a matrix.

18
Numerical Integration Computing the “area under the curve.” Parallelized by divided area into smaller areas (partitioning). Can also apply divide and conquer -- repeatedly divide the areas recursively.

19
4.15 Numerical integration using rectangles Each region calculated using an approximation given by rectangles: Aligning the rectangles:

20
4.16 Numerical integration using trapezoidal method May not be better!

21
Applying Divide and Conquer

22
4.17 Adaptive Quadrature Solution adapts to shape of curve. Use three areas, A, B, and C. Computation terminated when largest of A and B sufficiently close to sum of remain two areas.

23
4.18 Adaptive quadrature with false termination. Some care might be needed in choosing when to terminate. Might cause us to terminate early, as two large regions are the same (i.e., C = 0).

24
Questions

Similar presentations

OK

Lecture 8 Jianjun Hu Department of Computer Science and Engineering University of South Carolina 2009.9. CSCE350 Algorithms and Data Structure.

Lecture 8 Jianjun Hu Department of Computer Science and Engineering University of South Carolina 2009.9. CSCE350 Algorithms and Data Structure.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on bluetooth broadcasting hardware Ppt on high voltage engineering holland Ppt on waxes are lipids Ppt on total parenteral nutrition contraindications Free download ppt on triangles for class 9 Ppt on duty roster Ppt on linked list in c Ppt on application of linear algebra in computer graphics Ppt on conservation of wildlife and natural vegetation of india Ppt on dining etiquettes