Docsity

Exam 3 for Parallel Algorithms | COSC 612, Quizzes of Algorithms and Programming

Partial preview of the text

Download Exam 3 for Parallel Algorithms | COSC 612 and more Quizzes Algorithms and Programming in PDF only on Docsity!

COSC 612 FA09 Test #3 Name: Open books/notes/internet.

  1. Given the unsorted sequence of 8 data items: 11, 21, 4, 8, 2, 9, 13, 1, show the ā€œcomparator networkā€ and the ā€œbitonic merging networkā€ with labeled wires that will produce the sorted sequence.
  1. Page 386 states that when the bitonic sorting network is implemented on a serial computing, one obtains a (n logn log^2 n) sorting algorithm. In 50 words or less, explain where each term (ā€˜n’, ā€˜log n’, ā€˜log n’) comes from.
  2. In the hypercube implementation of the bitonic sort, the parallel run time is (n loglog^2 n) In 50 words or less, explain what can be done in parallel, and why does that reduce the run time by n?
  1. The finite difference method is similar to a an image smoothing solution, where each pixel value is replaced by the average of a 9 element neighborhood:

f(r, c) = (1/9) (  i=r-1 r+1^ ( j=c-1 c+1^ f(i, j) ) )

Or, written out as a window, where f(r, c) is the center element: 1 1 1 1 1 1 1 1 1 Suppose you have a 9 X 9 image. In this problem, Pi communicates data to Pj. The time to communicate 1 pixel value from Pi to Pj is the same as the time to communicate n pixel values from Pi to Pj (n is any number of pixel values). However, when Pi is communicating with Pj, Pi cannot communicate with Pk at the same time. So, for example if Pi has to send a pixel to Pj and a pixel to Pk, that takes two time ticks. The time to communicate is one tick. a. You have 81 PEs. Each PE is responsible for computing the smoothed value of one pixel. Maximizing parallelism in the communications, how many communication ticks are necessary? Show your thinking for partial credit.

b. You have 3 PEs. Each PE is responsible for computing the smoothed value of a contiguous column of pixels. P0: columns 0 - 2; P1: columns 3 - 5, P2: columns 6 - 8. Maximizing parallelism in the communications, how many communication ticks are necessary? Show your thinking for partial credit.