Batcher’s merging network Efficient Parallel Algorithms COMP308.

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

Back to Sorting – More efficient sorting algorithms.
22C:19 Discrete Structures Induction and Recursion Fall 2014 Sukumar Ghosh.
Order Analysis of Algorithms Debdeep Mukhopadhyay IIT Madras.
Lecture 3: Parallel Algorithm Design
Lecture 4 Divide and Conquer for Nearest Neighbor Problem
Comp 122, Spring 2004 Divide and Conquer (Merge Sort)
September 12, Algorithms and Data Structures Lecture III Simonas Šaltenis Nykredit Center for Database Research Aalborg University
Divide and Conquer. Recall Complexity Analysis – Comparison of algorithm – Big O Simplification From source code – Recursive.
Nattee Niparnan. Recall  Complexity Analysis  Comparison of Two Algos  Big O  Simplification  From source code  Recursive.
Overview Efficient Parallel Algorithms COMP308. COMP 308 Exam Time allowed : 2.5 hours Answer four questions (out of six). If you attempt to answer more.
Lecture 3 Nearest Neighbor Algorithms Shang-Hua Teng.
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.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lecture 9 Tuesday, 11/20/01 Parallel Algorithms Chapters 28,
1 Merge Sort Merge Sort Reading p A Sorting Pattern The most efficient sorting algorithms all seem to follow a divide-and-conquer strategy.
Mesh connected networks. Sorting algorithms Efficient Parallel Algorithms COMP308.
Lecture 6 Divide and Conquer for Nearest Neighbor Problem Shang-Hua Teng.
Sorting networks Efficient Parallel Algorithms COMP308.
Bitonic and Merging sorting networks Efficient Parallel Algorithms COMP308.
CSCI-455/552 Introduction to High Performance Computing Lecture 22.
Section Section Summary Recursive Algorithms Proving Recursive Algorithms Correct Recursion and Iteration (not yet included in overheads) Merge.
Sorting Networks Uri Zwick Tel Aviv University May 2015.
Cardinality & Sorting Networks. Cardinality constraint Appears in many practical problems: scheduling, timetabling etc’. Also takes place in the Max-Sat.
Unit 1. Sorting and Divide and Conquer. Lecture 1 Introduction to Algorithm and Sorting.
CALTECH CS137 Winter DeHon 1 CS137: Electronic Design Automation Day 12: February 6, 2006 Sorting.
Advanced Counting Techniques CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Nattee Niparnan. Recall  Complexity Analysis  Comparison of Two Algos  Big O  Simplification  From source code  Recursive.
Parallel and Distributed Algorithms Eric Vidal Reference: R. Johnsonbaugh and M. Schaefer, Algorithms (International Edition) Pearson Education.
Order Statistics. Order statistics Given an input of n values and an integer i, we wish to find the i’th largest value. There are i-1 elements smaller.
Lecture 6 Algorithm Analysis Arne Kutzner Hanyang University / Seoul Korea.
Comparison Networks Sorting Sorting binary values
Advanced Counting Techniques CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Lecture 4 Sorting Networks. Comparator comparator.
Lecture 28 CSE 331 Nov 9, Mini project report due WED.
Tim Roughgarden Introduction Merge Sort (Analysis ) Design and Analysis of Algorithms I.
Comparison Networks Sorting Sorting binary values Sorting arbitrary numbers Implementing symmetric functions.
1 Sorting Networks Sorting.
+ Even Odd Sort & Even-Odd Merge Sort Wolfie Herwald Pengfei Wang Rachel Celestine.
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.
Section Recursion 2  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
Section Recursion  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
(Proof By) Induction Recursion
Recursive Algorithms Section 5.4.
Lecture 4 Sorting Networks
Mesh connected networks. Sorting algorithms
Sorting Networks Characteristics The basic unit: a comparator
Unit 1. Sorting and Divide and Conquer
SORTING NETWORKS.
Use mathematical induction to prove that the formula is true for all natural numbers m. {image} Choose the first step of the proof from the following:
مفاهیم بهره وري.
Divide and Conquer (Merge Sort)
Sorting Algorithms Ellysa N. Kosinaya.
Algorithms and Data Structures Lecture III
Comparison Networks Sorting Sorting binary values
Lecture 27 CSE 331 Nov 3, 2017.
Bitonic and Merging sorting networks
Lecture 6 Algorithm Analysis
Applied Discrete Mathematics Week 9: Integer Properties
Lecture 6 Algorithm Analysis
Divide and Conquer (Merge Sort)
Trevor Brown CS 341: Algorithms Trevor Brown
Application: Efficiency of Algorithms II
Batcher Sorting Network, n = 4
Application: Efficiency of Algorithms II
Lecture 27 CSE 331 Nov 4, 2016.
Efficient Parallel Algorithms COMP308
Recursion.
Presentation transcript:

Batcher’s merging network Efficient Parallel Algorithms COMP308

Odd-even merging network We assume that n is exact power of 2, and we wish to merge the sorted sequence of elements on lines with those on lines We recursively construct two odd-even merging networks that merge sorted subsequences in parallel.

Structure of the network The first merges the sequence on lines with sequences on lines (the odd elements) The second merges the sequence on lines with sequences on lines (the even elements) To combine two sorted subsequences, we put a comparator between a 2i-1 and a 2i for all i=1,2,…,n

8-input network

Skeleton of the Proof Apply the zero-one principle to prove that Batcher’s sorting is correct, consider only merges of sequences of the form and In odd-even merging we send odd sequence to one merger and the even sequence to another merger. We can assume by induction that smaller mergers work correctly. The first merger can get one or two more zeros. than the second one. The outputs of these mergers are interleaved and can be 1 before 0 (dirty one).

After sorting separately on odd and even positions we will have everything sorted unless the situation like this happens Then the last final touch (correction step) cleans the sequence. The situation is subtle, the last correction does not clean for example But the dirty 1 (if there is any) should be on an even position, which is always the case