0% found this document useful (0 votes)
39 views20 pages

Ch4 Partitioning

The document discusses partitioning and divide-and-conquer strategies for solving problems in parallel. It describes partitioning as dividing a problem into parts, while divide-and-conquer involves recursively breaking a problem into identical subproblems. Many problems can be solved this way, such as adding sequences of numbers, sorting algorithms, and numerical integration.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views20 pages

Ch4 Partitioning

The document discusses partitioning and divide-and-conquer strategies for solving problems in parallel. It describes partitioning as dividing a problem into parts, while divide-and-conquer involves recursively breaking a problem into identical subproblems. Many problems can be solved this way, such as adding sequences of numbers, sorting algorithms, and numerical integration.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Partitioning

and Divide-and-Conquer Strategies


‫المسائل التفرعية‬
‫التي تعتمد في حلها على التجزئة وطريقة فرق تسد‬

Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. Allen, @ 2004 Pearson Education Inc. All rights reserved.
Partitioning
Partitioning simply divides the problem into parts.

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.

Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. Allen, @ 2004 Pearson Education Inc. All rights reserved. 4.1
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

Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. Allen, @ 2004 Pearson Education Inc. All rights reserved. 4.2
Partitioning a sequence of numbers
into parts and adding the parts

Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. Allen, @ 2004 Pearson Education Inc. All rights reserved. 4.3
Adding Sequence of numbers

Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. Allen, @ 2004 Pearson Education Inc. All rights reserved. 4.3
Adding Sequence of numbers (using broadcasting)

Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. Allen, @ 2004 Pearson Education Inc. All rights reserved. 4.3
Adding Sequence of numbers (using scatter)

Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. Allen, @ 2004 Pearson Education Inc. All rights reserved. 4.3
Divide and Conquer
Adding Sequence of numbers (divide and conquer –
sequential recursive call)

Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. Allen, @ 2004 Pearson Education Inc. All rights reserved. 4.4
Divide and Conquer

Tree construction

Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. Allen, @ 2004 Pearson Education Inc. All rights reserved. 4.4
Adding Sequence of numbers (divide and conquer – parallel)

Dividing a list into parts

Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. Allen, @ 2004 Pearson Education Inc. All rights reserved. 4.5
Adding Sequence of numbers (divide and conquer – parallel)
Partial summation

Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. Allen, @ 2004 Pearson Education Inc. All rights reserved. 4.6
Adding Sequence of numbers (divide and conquer – parallel)

Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. Allen, @ 2004 Pearson Education Inc. All rights reserved. 4.6
Adding Sequence of numbers (divide and conquer – parallel)

Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. Allen, @ 2004 Pearson Education Inc. All rights reserved. 4.6
Quadtree

Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. Allen, @ 2004 Pearson Education Inc. All rights reserved. 4.7
Parallelizing Mergesort
Using tree allocation of processes

Slides for Parallel


Programming 15
Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. Allen, @ 2004 Pearson Education Inc. All rights reserved.
Numerical integration using trapezoidal

Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. Allen, @ 2004 Pearson Education Inc. All rights reserved. 4.15
Static Assignment

Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. Allen, @ 2004 Pearson Education Inc. All rights reserved. 4.17
Static Assignment

Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. Allen, @ 2004 Pearson Education Inc. All rights reserved. 4.17
Static Assignment

Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. Allen, @ 2004 Pearson Education Inc. All rights reserved. 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 .

Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M. Allen, @ 2004 Pearson Education Inc. All rights reserved. 4.17

You might also like