CS256 Applied Theory of Computation

Similar documents
Design of Parallel Algorithms. Communication Algorithms

In the game of Chess a queen can move any number of spaces in any linear direction: horizontally, vertically, or along a diagonal.


Overview: Routing and Communication Costs

MA/CSSE 473 Day 13. Student Questions. Permutation Generation. HW 6 due Monday, HW 7 next Thursday, Tuesday s exam. Permutation generation

Overview: Routing and Communication Costs Store-and-Forward Routing Mechanisms and Communication Costs (Static) Cut-Through Routing/Wormhole Routing

Lecture 2.3: Symmetric and alternating groups

Basic Communication Operations (cont.) Alexandre David B2-206

A virtually nonblocking self-routing permutation network which routes packets in O(log 2 N) time

arxiv: v1 [cs.cc] 21 Jun 2017

Homework Assignment #1

An Optimal (d 1)-Fault-Tolerant All-to-All Broadcasting Scheme for d-dimensional Hypercubes

New Sliding Puzzle with Neighbors Swap Motion

Arrays. Independent Part. Contents. Programming with Java Module 3. 1 Bowling Introduction Task Intermediate steps...

Digital Electronics 8. Multiplexer & Demultiplexer

Randomized Algorithms

Hypercube Networks-III

Transactions Briefs. Sorter Based Permutation Units for Media-Enhanced Microprocessors

ECE 242 Data Structures and Algorithms. Simple Sorting II. Lecture 5. Prof.

Counting Things Solutions

Inputs. Outputs. Outputs. Inputs. Outputs. Inputs

Tac Due: Sep. 26, 2012

! Denver, CO! Demystifying Computing with Magic, continued

Free Cell Solver. Copyright 2001 Kevin Atkinson Shari Holstege December 11, 2001

Instruction Cards Sample

School of Computing and Information Technology. ASSIGNMENT 1 (Individual) CSCI 103 Algorithms and Problem Solving. Session 2, April - June 2017

Rotational Puzzles on Graphs

Rubik's Magic Transforms

MIDTERM REVIEW INDU 421 (Fall 2013)

Theory of Probability - Brett Bernstein

Bead Sort: A Natural Sorting Algorithm

ETSI TS V1.1.2 ( )

TOURNAMENT ROUND. Round 1

Solution Algorithm to the Sam Loyd (n 2 1) Puzzle

Tribute to Martin Gardner: Combinatorial Card Problems

Adventures with Rubik s UFO. Bill Higgins Wittenberg University

Mathematics of Magic Squares and Sudoku

Random. Bart Massey Portland State University Open Source Bridge Conf. June 2014

Chapter 4 The Data Encryption Standard

Layout design III. Chapter 6. Layout generation MCRAFT BLOCPLAN LOGIC

Past questions from the last 6 years of exams for programming 101 with answers.

CSCI 1590 Intro to Computational Complexity

Mathematics Competition Practice Session 6. Hagerstown Community College: STEM Club November 20, :00 pm - 1:00 pm STC-170

Figure 1: The Game of Fifteen

HOMEWORK ASSIGNMENT 5

Chained Permutations. Dylan Heuer. North Dakota State University. July 26, 2018

Stupid Columnsort Tricks Dartmouth College Department of Computer Science, Technical Report TR

Similarity & Link Analysis. Stony Brook University CSE545, Fall 2016

Further Mathematics Support Programme

Chapter 1: Digital logic

Student Outcomes. Lesson Notes. Classwork. Opening Exercise (6 minutes)

Digital Image Processing. Digital Image Fundamentals II 12 th June, 2017

ENGR170 Assignment Problem Solving with Recursion Dr Michael M. Marefat

CHAPTER 5 DESIGN OF COMBINATIONAL LOGIC CIRCUITS IN QCA

((( ))) CS 19: Discrete Mathematics. Please feel free to ask questions! Getting into the mood. Pancakes With A Problem!

Second Annual University of Oregon Programming Contest, 1998

Counting in Algorithms

Know your Algorithm! Architectural Trade-offs in the Implementation of a Viterbi Decoder. Matthias Kamuf,

CENTRALIZED BUFFERING AND LOOKAHEAD WAVELENGTH CONVERSION IN MULTISTAGE INTERCONNECTION NETWORKS

4 + 3 = 7 10= Starting at the bigger number and counting on. Progression in Calculations

Common Mistakes. Quick sort. Only choosing one pivot per iteration. At each iteration, one pivot per sublist should be chosen.

From Shared Memory to Message Passing

I.M.O. Winter Training Camp 2008: Invariants and Monovariants

Asst. Prof. Thavatchai Tayjasanant, PhD. Power System Research Lab 12 th Floor, Building 4 Tel: (02)

ECS 20 (Spring 2013) Phillip Rogaway Lecture 1

CS101 Lecture 28: Sorting Algorithms. What You ll Learn Today

Diffracting Trees and Layout

JINX - 2 Players / 15 Minutes

Game, Set, and Match Carl W. Lee September 2016

An ordered collection of counters in rows or columns, showing multiplication facts.

Disclaimer. Primer. Agenda. previous work at the EIT Department, activities at Ericsson

English Version. Instructions: Team Contest

Heuristic Search with Pre-Computed Databases

Shuffling with ordered cards

Link State Routing. Brad Karp UCL Computer Science. CS 3035/GZ01 3 rd December 2013

Topspin: Oval-Track Puzzle, Taking Apart The Topspin One Tile At A Time

Parking and Railroad Cars

Ecient Multichip Partial Concentrator Switches. Thomas H. Cormen. Laboratory for Computer Science. Massachusetts Institute of Technology

Encoders. Lecture 23 5

CSE 312: Foundations of Computing II Quiz Section #1: Counting

Chapter 3 Novel Digital-to-Analog Converter with Gamma Correction for On-Panel Data Driver

CS 473G: Combinatorial Algorithms, Fall 2005 Homework 0. I understand the Homework Instructions and FAQ.

Southeastern European Regional Programming Contest Bucharest, Romania Vinnytsya, Ukraine October 21, Problem A Concerts

Perfect Shuffles TEACHER NOTES MATH NSPIRED. Math Objectives. Vocabulary. About the Lesson. TI-Nspire Navigator System

Question Score Max Cover Total 149

Color each numeral card. Count the objects in each group. Then color the group of objects the same color as the numeral card that it matches.

MA/CSSE 473 Day 14. Permutations wrap-up. Subset generation. (Horner s method) Permutations wrap up Generating subsets of a set

Counting Things. Tom Davis March 17, 2006

Image Forgery. Forgery Detection Using Wavelets

Optimal Circuits for Streamed Linear Permutations Using RAM

2014 ACM ICPC Southeast USA Regional Programming Contest. 15 November, Division 1

Problem name: Cipher Input File: CipherIn.txt T H E W E A T H E R I S S O N I C E T H A T W E W A N T T O P L A Y

Problem Set 7: Network Flows Fall 2018

Block Ciphers Security of block ciphers. Symmetric Ciphers

The mathematics of the flip and horseshoe shuffles

An Interconnect-Centric Approach to Cyclic Shifter Design

CHAPTER 1 INTRODUCTION

CS 457 Lecture 16 Routing Continued. Spring 2010

Lectures: Feb 27 + Mar 1 + Mar 3, 2017

Chapter 5 Backtracking. The Backtracking Technique The n-queens Problem The Sum-of-Subsets Problem Graph Coloring The 0-1 Knapsack Problem

Transcription:

CS256 Applied Theory of Computation Parallel Computation III John E Savage

Overview Mapping normal algorithms to meshes Shuffle operations on linear arrays Shuffle operations on two-dimensional arrays Routing in networks PRAM Lecture 21 Parallel Computation III CS256 @John E Savage 2

Mapping Normal Algorithms to Meshes Normal algorithms work well on hypercubes Because hypercubes are expensive, we map normal algorithms to 1-D and 2-D arrays, which are not. Shuffle and unshuffle operations are key to the translation of normal algorithms to meshes. A shuffle operation on a deck of card: split the deck in half and interlace the two sets of cards. Example on 8 = 2 3 elements: Original 0 1 2 3 4 5 6 7 Shuffled 0 4 1 5 2 6 3 7 Lecture 21 Parallel Computation III CS256 @John E Savage 3

Shuffle Operations on Linear Arrays Consider shuffle of n = 2 d items on 1-D arrays. Can be done by a sequence of swaps of adjacent elements on the array, as shown. Lecture 21 Parallel Computation III CS256 @John E Savage 4

Shuffle Operations on Linear Arrays Could you write a small program for each array processor using the integer it contains as well as the cell number to decide when to swap and when to terminate? Number of steps: n 1 where n = 2 d-1 Unshuffle: reverse shuffle steps Lecture 21 Parallel Computation III CS256 @John E Savage 5

Shuffle Operations and Hypercube Adjacency Original 0 1 2 3 4 5 6 7 Shuffled 0 4 1 5 2 6 3 7 Represent the eight integers in binary Original 000 001 010 011 100 101 110 111 Shuffled 000 100 001 101 010 110 011 111 In original, elements i and i+1 for i even differ in the least significant bit. When shuffled, they differ in most significant bit. Swapping linearly adjacent elements simulates hypercube swapping. Lecture 21 Parallel Computation III CS256 @John E Savage 6

Ascending Normal Algorithm Simulated on a Linear Array A normal algorithm swaps values in processors whose indices differ in one bit. 000 001 010 011 100 101 110 111 Implement swap across first dimension by Swap between even-odd neighbors. Implement swap across second dimension by Unshuffle; shuffle blocks of four elements Swap between even-odd neighbors; unshuffle. 000 010 001 011 100 110 101 111 Lecture 21 Parallel Computation III CS256 @John E Savage 7

Ascending Normal Algorithm Simulated on a Linear Array Implement swap across third dimension by Unshuffle; shuffle blocks of eight elements Swap between even-odd neighbors 000 100 001 101 010 110 011 111 Lecture 21 Parallel Computation III CS256 @John E Savage 8

Normal Ascending Algorithm on Linear Array Running time on dd hypercube Shuffles: 2(2 k-1-1) for k = 2, 3,, d. Total 2(2 d d -1) Swaps: d Lecture 21 Parallel Computation III CS256 @John E Savage 9

Ascending Normal Algorithms on a Two-Dimensional Array Consider m m array {(r,c)} in row major order Lecture 21 Parallel Computation III CS256 @John E Savage 10

Ascending Normal Algorithms on a Two-Dimensional Array Treat an index as cm+r. All normal alg. exchanges can be done by doing shuffles on rows followed by shuffles on columns. Map n = 2 2d vertices onto 2 d 2 d array. Elements (r,c) and (r,c+1) agree in d msb s Elements (r+1,c) and (r,c) agree in d lsb s. Ascending algorithm uses shuffles on rows followed by shuffles on columns. Algorithm uses O( n) steps, n=m 2. Lecture 21 Parallel Computation III CS256 @John E Savage 11

Normal Algorithms on Cube- Connected Cycles Consider CCC simulating d- dimensional hypercube Let each ring have length d 2 k 2d. Simulate msb s of ascending algorithm on rings. Rotate and swap on ring to simulate asc. alg. on lsbs. Running time is O(d). Lecture 21 Parallel Computation III CS256 @John E Savage 12

Routing on Networks Data movement on networks is challenging: Contention introduces delay Permutation routing: each input to a unique output. Local routing network: messages have destination address. Network switches use only this information to route messages. A sorting network, such as Batcher s bitonic sorter (Sect. 6.8.1) is a local permutation-routing network. Lecture 21 Parallel Computation III CS256 @John E Savage 13

Global Routing Networks Global routing networks have knowledge of destinations for each message. Global permutation routing networks have unique destination for each message. Permutations determined by switch positions. Benes permutation network formed by placing FFT graphs back-to-back and replacing nodes with switches. Lecture 21 Parallel Computation III CS256 @John E Savage 14

Benes Permutation Network Lecture 21 Parallel Computation III CS256 @John E Savage 15

PRAM Model The PRAM is an abstract programming model Processors operate synchronously, reading from memory, executing locally, and writing to memory. Lecture 21 Parallel Computation III CS256 @John E Savage 16

PRAM Model Four types: EREW, ERCW, CREW, CRCW R read, W write, E exclusive, C common Can Boolean functions be computed quickly? How can a function be represented? Can we use concurrency to good advantage? Is this use of concurrency realistic? Lecture 21 Parallel Computation III CS256 @John E Savage 17