Assignment 01 Retake
Assignment 01 Retake
(a) The code given below cannot be parallelized due to multiple dependencies. Draw the dependency
graph showing all data-dependences, output-dependences, and anti-dependences.
for i = 1 to 50
A[i] = B[i-1] + C[i]
B[i] = A[i+2] + C[i]
s = s + C[i]
(b) Modify the code given in (a) to remove the dependencies (where possible) and draw the updated
dependency graph showing all data-dependences, output-dependences, and anti-dependences.
(c) Can this code now be parallelized? If yes, write the parallel code.