Data Structures and Algorithms in Parallel Computing Lecture 8.

Slides:



Advertisements
Similar presentations
Lecture 3: Parallel Algorithm Design
Advertisements

1 Parallel Parentheses Matching Plus Some Applications.
Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M
CSCI-455/552 Introduction to High Performance Computing Lecture 11.
Partitioning and Divide-and-Conquer Strategies ITCS 4/5145 Parallel Computing, UNC-Charlotte, B. Wilkinson, Jan 23, 2013.
Nov 10, Fall 2009IAT 8001 Binary Search Sorting. Nov 10, Fall 2009IAT 8002 Search  Often want to search for an item in a list  In an unsorted list,
Jun 23, 2014IAT 2651 Binary Search Sorting. Jun 23, 2014IAT 2652 Search  Frequently wish to organize data to support search –Eg. Search for single item.
Lecture 7-2 : Distributed Algorithms for Sorting Courtesy : Michael J. Quinn, Parallel Programming in C with MPI and OpenMP (chapter 14)
Lecture 12: Revision Lecture Dr John Levine Algorithms and Complexity March 27th 2006.
Parallel Sorting Algorithms Comparison Sorts if (A>B) { temp=A; A=B; B=temp; } Potential Speed-up –Optimal Comparison Sort: O(N lg N) –Optimal Parallel.
CS 206 Introduction to Computer Science II 12 / 09 / 2009 Instructor: Michael Eckmann.
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.
Chapter 10 in textbook. Sorting Algorithms
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.
Wednesday, 11/25/02, Slide #1 CS 106 Intro to CS 1 Wednesday, 11/25/02  QUESTIONS??  Today:  More on sorting. Advanced sorting algorithms.  Complexity:
General Computer Science for Engineers CISC 106 James Atlas Computer and Information Sciences 10/23/2009.
1 Lecture 11 Sorting Parallel Computing Fall 2008.
CSCI 4440 / 8446 Parallel Computing Three Sorting Algorithms.
Sorting Chapter 10.
Sorting Algorithms: Topic Overview
Wednesday, 11/13/02, Slide #1 CS 106 Intro to CS 1 Wednesday, 11/13/02  QUESTIONS??  Today:  More on searching a list; binary search  Sorting a list;
CS 584. Sorting n One of the most common operations n Definition: –Arrange an unordered collection of elements into a monotonically increasing or decreasing.
CS 104 Introduction to Computer Science and Graphics Problems Data Structure & Algorithms (3) Recurrence Relation 11/11 ~ 11/14/2008 Yang Song.
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.
Nov 21, Fall 2006IAT 8001 Binary Search Sorting. Nov 21, Fall 2006IAT 8002 Search  Often want to search for an item in a list  In an unsorted list,
Sorting Chapter 10. Chapter 10: Sorting2 Chapter Objectives To learn how to use the standard sorting methods in the Java API To learn how to implement.
CSCI-455/552 Introduction to High Performance Computing Lecture 22.
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.
1 Sorting Algorithms - Rearranging a list of numbers into increasing (strictly non-decreasing) order. ITCS4145/5145, Parallel Programming B. Wilkinson.
Parallel Programming in C with MPI and OpenMP
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.
Adaptive Parallel Sorting Algorithms in STAPL Olga Tkachyshyn, Gabriel Tanase, Nancy M. Amato
Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M
Merge Sort. What Is Sorting? To arrange a collection of items in some specified order. Numerical order Lexicographical order Input: sequence of numbers.
Sorting Chapter 10. Chapter Objectives  To learn how to use the standard sorting methods in the Java API  To learn how to implement the following sorting.
COT 5405 Spring 2009 Discussion Session 3. Introduction Our weekly discussion class are like organized TA office hours. Here we encourage students to.
1. 2 Sorting Algorithms - rearranging a list of numbers into increasing (strictly nondecreasing) order.
CS 284a, 29 October 1997 Copyright (c) , John Thornley1 CS 284a Lecture Tuesday, 29 October, 1997.
Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M
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
CSE 340: Review (at last!) Measuring The Complexity Complexity is a function of the size of the input O() Ω() Θ() Complexity Analysis “same order” Order.
Sorting Quick, Merge & Radix Divide-and-conquer Technique subproblem 2 of size n/2 subproblem 1 of size n/2 a solution to subproblem 1 a solution to.
Parallel Programming - Sorting David Monismith CS599 Notes are primarily based upon Introduction to Parallel Programming, Second Edition by Grama, Gupta,
Unit-8 Sorting Algorithms Prepared By:-H.M.PATEL.
CSCI-455/552 Introduction to High Performance Computing Lecture 21.
Sorting: Parallel Compare Exchange Operation A parallel compare-exchange operation. Processes P i and P j send their elements to each other. Process P.
Merge Sort 1/12/2018 5:48 AM Merge Sort 7 2   7  2  2 7
Lecture 3: Parallel Algorithm Design
Sorting Quiz questions
Parallel Sorting Algorithms
Divide and Conquer.
MergeSort Source: Gibbs & Tamassia.
Bitonic Sorting and Its Circuit Design
Parallel Computing Spring 2010
Sorting.
Numerical Algorithms Quiz questions
Parallel Sorting Algorithms
Parallel Sorting Algorithms
Merge Sort 2/23/ :15 PM 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.
Sorting Chapter 10.
Divide & Conquer Sorting
Parallel Sorting Algorithms
Merge Sort 5/30/2019 7:52 AM Merge Sort 7 2   7  2  2 7
Presentation transcript:

Data Structures and Algorithms in Parallel Computing Lecture 8

Parallel sorting Sorting is a problem that admits a variety of parallel solutions Goal – Sorting a sequence of values in increasing order using n processors Why in parallel? – Frequent operation in many applications – Best sequential algorithm is O(n log n) – In parallel on n processors we can aim for O(log n)

Compare and swap with message exchange Sequential version requires comparing and swapping values Parallel version requires an extra communication step

Method 1 P 1 send A to P 2 P 2 compares B with A and sends to P 1 the min(A,B)

Method 2 P 1 sends A to P 2 P 2 sends B to P 1 P 1 does A = min(A, B) P 2 does B = max(A, B)

Data partitioning – n numbers and p processors – n/p numbers assigned to each processor Method 1

Data partitioning Method 2

Algorithms Bubblesort Mergesort Quicksort Bitonic sort

Sequential bubblesort

Parallel bubblesort Run multiple iterations in parallel

Parallel mergesort Divide and conquer technique

Parallel quicksort

Bitonic sort Bitonic sequences – complexity: O(log 2n) – a sequence is bitonic if it contains two sequences, one increasing and one decreasing, i.e. a 1 a i+1 > a i+2 >... > a n – for some i such that (0 ≤ i ≤ n) – a sequence is bitonic if the property described is attained by a circular rotation to the right of its elements.

Bitonic sorting network Unsorted sequence  bitonic sequence  sorted sequence

Example

What’s next? Parallel computational geometry Parallel numerical algorithms …