Question: Problem 3 Setup Computational science is replete with algorithms that require the entries of an array to be filled in with values that depend on
Problem
Setup
Computational science is replete with algorithms that require the entries of an array to be filled in with values that
depend on the values of certain already computed neighboring entries, along with other information that does not
change over the course of the computation. The pattern of neighboring entries does not change during the computation
and is called a stencil. For example, the longest common subsequence algorithm from a previous module, where the
value in entry depends only on the values in and as well as the elements
and within the two sequences given as inputs. The input sequences are fixed, but the algorithm fills in the two
dimensional array so that it computes entry after computing all three entries and
This problem examines how to use recursive spawning to parallelize a simple stencil calculation on an array
in which the value placed into entry depends only on values in where i and and of
course, or In other words, the value in an entry depends only on values in entries that are above it
andor to its left, along with static information outside of the array. Furthermore, we assume throughout this problem
that once the entries upon which depends have been filled in the entry can be computed in time.
Partition the array A into four subarrays as follows:
We can immediately fill in subarray recursively, since it does not depends on the entries in the other three
subarrays. Once the computation of finishes, we can fill in and recursively in parallel, because although
they both depend on they do not depend on each other. Finally, we can fill in recursively.
Part A
Give parallel pseudocode that performs this simple stencil calculation using a divideandconquer algorithm
SIMPLESTENCIL based on the setup and the decomposition of Dont worry about the details of the base case,
which depends on the specific stencil. Give and solve recurrences for the work and span of this algorithm in terms of
What is the parallelism?
Part B
Modify your solution to part A to divide an array into nine subarrays, again recursing with as
much parallelism as possible. Analyze this algorithm. How much more or less parallelism does this algorithm have
compared with the algorithm from part A
Part C
Generalize your solutions to parts A and B as follows. Choose an integer Divide an array into
subarrays, each of size recursing with as much parallelism as possible. In terms of and what are the
work, span, and parallelism of this algorithm? Argue that, using this approach, the parallelism must be for any
choice of
TIP
For this argument, show that the exponent of in the parallelism is strictly less than for any choice of
Part D
Give pseudocode for a parallel algorithm for this simple stencil calculation that achieves parallelism.
Argue using notions of work and span that the problem has inherent parallelism. Unfortunely, simple forkjoin
parallelism does not let you achieve this maximal parallelism.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
