Consider the following multithreaded algorithm for performing pairwise addition on n-element arrays A[1 . . n] and
Question:
SUM-ARRAYS (A, B, C)
a. Rewrite the parallel loop in SUM-ARRAYS using nested parallelism (spawn and sync) in the manner of MAT-VEC-MAIN-LOOP. Analyze the parallelism of your implementation.
Consider the following alternative implementation of the parallel loop, which contains a value grain-size to be specified:
SUM-ARRAYS² (A, B, C)
ADD-SUBARRAY (A, B, C, I, j)
b. Suppose that we set grain-size = 1. What is the parallelism of this implementation?
c. Give a formula for the span of SUM-ARRAYS² in terms of n and grain-size. Derive the best value for grain-size to maximize parallelism.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Question Posted: