Presentation is loading. Please wait.

Presentation is loading. Please wait.

Auburn University http://www.eng.auburn.edu/~xqin COMP7330/7336 Advanced Parallel and Distributed Computing Parallel Odd-Even Sort Algorithm Dr. Xiao.

Similar presentations


Presentation on theme: "Auburn University http://www.eng.auburn.edu/~xqin COMP7330/7336 Advanced Parallel and Distributed Computing Parallel Odd-Even Sort Algorithm Dr. Xiao."— Presentation transcript:

1 Auburn University http://www.eng.auburn.edu/~xqin
COMP7330/7336 Advanced Parallel and Distributed Computing Parallel Odd-Even Sort Algorithm Dr. Xiao Qin Auburn University 50 Minutes: Slides 1-10 Slides are adopted from Drs. Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar

2 Odd-Even Sort Algorithm
A.K.A: odd–even transposition sort or brick sort A simple sorting algorithm for parallel processors with local interconnections Related to bubble sort One buffer one data type.

3 Bubble Sort Sort: Q1: How to design a parallel bubble sort algorithm? One buffer one data type.

4 Odd-Even Sort: Basic Idea
Compare all (odd, even)-indexed pairs of adjacent elements in the list If a pair is in the wrong order, then the elements are switched. The next step repeats this for (even, odd)-indexed pairs (of adjacent elements). Then it alternates between (odd, even) and (even, odd) steps until the list is sorted. One buffer one data type.

5 Example: Odd-Even Sort
Indices: Num: Complete in 8 phases. Fig on page 396

6 Odd-Even Transposition: An Example
Sorting n = 8 elements, using the odd-even transposition sort algorithm. During each phase, n = 8 elements are compared.

7 Sequential odd-even transposition sort algorithm

8 Sequential Odd-Even Transposition Q2: What is its complexity?
After n phases of odd-even exchanges, the sequence is sorted. Each phase of the algorithm (either odd or even) requires Θ(n) comparisons. Serial complexity is Θ(n2). Asymptotical bounds

9 Parallel Odd-Even Transposition (Q3: How to design?)
Consider the one item per processor case. There are n iterations, in each iteration, each processor does one compare-exchange. The parallel run time of this formulation is Θ(n). This is cost optimal with respect to the base serial algorithm but not the optimal one. Question and discussions

10 Parallel Odd-Even Transposition
Element i is residing on process Pi

11 Parallel Odd-Even Transposition
Consider a block of n/p elements per processor. The first step is a local sort. In each subsequent step, the compare exchange operation is replaced by the compare split operation. The parallel run time of the formulation is

12 Parallel Odd-Even Transposition
The parallel formulation is cost-optimal for p = O(log n). The isoefficiency function of this parallel formulation is Θ(p2p).


Download ppt "Auburn University http://www.eng.auburn.edu/~xqin COMP7330/7336 Advanced Parallel and Distributed Computing Parallel Odd-Even Sort Algorithm Dr. Xiao."

Similar presentations


Ads by Google