Sorting: Parallel Compare Exchange Operation A parallel compare-exchange operation. Processes P i and P j send their elements to each other. Process P.

Slides:



Advertisements
Similar presentations
II Extreme Models Study the two extremes of parallel computation models: Abstract SM (PRAM); ignores implementation issues Concrete circuit model; incorporates.
Advertisements

Parallel Sorting Sathish Vadhiyar. Sorting  Sorting n keys over p processors  Sort and move the keys to the appropriate processor so that every key.
Lecture 3: Parallel Algorithm Design
AVL Trees1 Part-F2 AVL Trees v z. AVL Trees2 AVL Tree Definition (§ 9.2) AVL trees are balanced. An AVL Tree is a binary search tree such that.
ALGORITMOS DE ORDENACIÓN EN PARALELO
Batcher’s merging network Efficient Parallel Algorithms COMP308.
Lecture16: Heap Sort Bohyung Han CSE, POSTECH CSED233: Data Structures (2014F)
Parallel Implementation of BWT Under the Guidance of : Prof. Kolin Paul Presented By: Lalchand Gaurav Jain.
Sequence Alignment in DNA Under the Guidance of : Prof. Kolin Paul Presented By: Lalchand Gaurav Jain.
Advanced Topics in Algorithms and Data Structures Lecture 6.1 – pg 1 An overview of lecture 6 A parallel search algorithm A parallel merging algorithm.
Advanced Topics in Algorithms and Data Structures Page 1 Parallel merging through partitioning The partitioning strategy consists of: Breaking up the given.
1 Tuesday, November 14, 2006 “UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever.
Sorting Algorithms CS 524 – High-Performance Computing.
1 Friday, November 17, 2006 “In the confrontation between the stream and the rock, the stream always wins, not through strength but by perseverance.” -H.
1 Lecture 11 Sorting Parallel Computing Fall 2008.
Parallel Merging Advanced Algorithms & Data Structures Lecture Theme 15 Prof. Dr. Th. Ottmann Summer Semester 2006.
© 2004 Goodrich, Tamassia Merge Sort1 Quick-Sort     29  9.
Sorting Algorithms: Topic Overview
CS 584. Sorting n One of the most common operations n Definition: –Arrange an unordered collection of elements into a monotonically increasing or decreasing.
Sorting Algorithms Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar To accompany the text ``Introduction to Parallel Computing'', Addison Wesley,
CS 584. Sorting n One of the most common operations n Definition: –Arrange an unordered collection of elements into a monotonically increasing or decreasing.
Bitonic and Merging sorting networks Efficient Parallel Algorithms COMP308.
CSCI-455/552 Introduction to High Performance Computing Lecture 22.
Sorting Networks Uri Zwick Tel Aviv University May 2015.
MergeSort Source: Gibbs & Tamassia. 2 MergeSort MergeSort is a divide and conquer method of sorting.
Lecture 29 CSE 331 Nov 11, To be strictly enforced For the rest of the semester on Fridays SUBMIT your HOMEWORKS by 1:10 PM.
Lecture 12: Parallel Sorting Shantanu Dutt ECE Dept. UIC.
1 Parallel Sorting Algorithms. 2 Potential Speedup O(nlogn) optimal sequential sorting algorithm Best we can expect based upon a sequential sorting algorithm.
Outline  introduction  Sorting Networks  Bubble Sort and its Variants 2.
Divide-and-Conquer1 7 2  9 4   2  2 79  4   72  29  94  4.
Lecture 6 Algorithm Analysis Arne Kutzner Hanyang University / Seoul Korea.
Parallel Algorithms Patrick Cozzi University of Pennsylvania CIS Fall 2013.
Chapter 12 Binary Search and QuickSort Fundamentals of Java.
Lecture 4 Sorting Networks. Comparator comparator.
1 Parallel Sorting Algorithm. 2 Bitonic Sequence A bitonic sequence is defined as a list with no more than one LOCAL MAXIMUM and no more than one LOCAL.
“Sorting networks and their applications”, AFIPS Proc. of 1968 Spring Joint Computer Conference, Vol. 32, pp
Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar
Reducing number of operations: The joy of algebraic transformations CS498DHP Program Optimization.
Data Structures and Algorithms in Parallel Computing Lecture 8.
1 Sorting Networks Sorting.
+ Even Odd Sort & Even-Odd Merge Sort Wolfie Herwald Pengfei Wang Rachel Celestine.
Parallel Programming - Sorting David Monismith CS599 Notes are primarily based upon Introduction to Parallel Programming, Second Edition by Grama, Gupta,
Chapter 9: Sorting1 Sorting & Searching Ch. # 9. Chapter 9: Sorting2 Chapter Outline  What is sorting and complexity of sorting  Different types of.
QuickSort. Yet another sorting algorithm! Usually faster than other algorithms on average, although worst-case is O(n 2 ) Divide-and-conquer: –Divide:
Unit-8 Sorting Algorithms Prepared By:-H.M.PATEL.
Sort Algorithm.
Chapter 11 Sorting Acknowledgement: These slides are adapted from slides provided with Data Structures and Algorithms in C++, Goodrich, Tamassia and Mount.
Sorting Chapter 14.
Lecture 4 Sorting Networks
NEW SORTING ALGORITHMS
Auburn University COMP8330/7330/7336 Advanced Parallel and Distributed Computing Interconnection Networks (Part 2) Dr.
Sorting Networks Characteristics The basic unit: a comparator
7.1 What is a Sorting Network?
SORTING NETWORKS.
MergeSort Source: Gibbs & Tamassia.
Merge Sort Merge sort is a recursive algorithm for sorting that decomposes the large problem.
Bitonic Sorting and Its Circuit Design
MSIS 655 Advanced Business Applications Programming
Parallel Computing Spring 2010
1 Lecture 13 CS2013.
Bitonic and Merging sorting networks
Lecture 6 Algorithm Analysis
Lecture 6 Algorithm Analysis
Quick-Sort 2/25/2019 2:22 AM Quick-Sort     2
Quick-Sort 4/8/ :20 AM Quick-Sort     2 9  9
Merge Sort 4/10/ :25 AM Merge Sort 7 2   7  2   4  4 9
Sorting Algorithms - Rearranging a list of numbers into increasing (strictly non-decreasing) order. Sorting number is important in applications as it can.
Quick-Sort 4/25/2019 8:10 AM Quick-Sort     2
Parallel Sorting Algorithms
CS203 Lecture 15.
Presentation transcript:

Sorting: Parallel Compare Exchange Operation A parallel compare-exchange operation. Processes P i and P j send their elements to each other. Process P i keeps min{a i,a j }, and P j keeps max{a i, a j }.

Sorting Networks: Bitonic Sort A bitonic sorting network sorts n elements in Θ(log 2 n) time. A bitonic sequence has two tones - increasing and decreasing, or vice versa. Any cyclic rotation of such networks is also considered bitonic.  1,2,4,7,6,0  is a bitonic sequence, because it first increases and then decreases.  8,9,2,1,0,4  is another bitonic sequence, because it is a cyclic shift of  0,4,8,9,2,1 . The kernel of the network is the rearrangement of a bitonic sequence into a sorted sequence.

Sorting Networks: Bitonic Sort Let s =  a 0,a 1,…,a n-1  be a bitonic sequence such that a 0 ≤ a 1 ≤ ··· ≤ a n/2-1 and a n/2 ≥ a n/2+1 ≥ ··· ≥ a n-1. Consider the following subsequences of s : s 1 =  min{a 0,a n/2 },min{a 1,a n/2+1 },…,min{a n/2-1,a n-1 }  s 2 =  max{a 0,a n/2 },max{a 1,a n/2+1 },…,max{a n/2-1,a n-1 }  Note that s 1 and s 2 are both bitonic and each element of s 1 is less than every element in s 2. We can apply the procedure recursively on s 1 and s 2 to get the sorted sequence.

Sorting Networks: Bitonic Sort Merging a 16 -element bitonic sequence through a series of log 16 bitonic splits.

Sorting Networks: Bitonic Sort We can easily build a sorting network to implement this bitonic merge algorithm. Such a network is called a bitonic merging network. The network contains log n columns. Each column contains n/2 comparators and performs one step of the bitonic merge. We denote a bitonic merging network with n inputs by  BM [n]. Replacing the  comparators by Ө comparators results in a decreasing output sequence; such a network is denoted by Ө BM [n].

Sorting Networks: Bitonic Sort How do we sort an unsorted sequence using a bitonic merge? We must first build a single bitonic sequence from the given sequence. A sequence of length 2 is a bitonic sequence. A bitonic sequence of length 4 can be built by sorting the first two elements using  BM[ 2 ] and next two, using Ө BM[ 2 ]. This process can be repeated to generate larger bitonic sequences.

Sorting Networks: Bitonic Sort A schematic representation of a network that converts an input sequence into a bitonic sequence. In this example,  BM[ k ] and Ө BM[ k ] denote bitonic merging networks of input size k that use  and Ө comparators, respectively. The last merging network (  BM[ 16 ] ) sorts the input. In this example, n = 16.

Sorting Networks: Bitonic Sort The comparator network that transforms an input sequence of 16 unordered numbers into a bitonic sequence.

Sorting Networks: Bitonic Sort The depth of the network is Θ(log 2 n). Each stage of the network contains n/2 comparators. A serial implementation of the network would have complexity Θ(nlog 2 n).