Share
Explore BrainMass

Directed acyclic graph (DAG) of a code

Explain, how to draw a DAG for following loop:

do i=1, 10, 1
x(i)=a(i)-b(i)
y(i)=a(i)+b(i)
d(i)=x(i)/(1+y(i))
end do

Solution Preview

Following response aims at guiding you to draw a DAG not just for the given loop, but similar code as well.
Notation "A --> B" indicates that B waits for the completion of A.

For each of the 10 different values of i, loop bodies (Li) can be executed in parallel, because Li steps are a function of just "i", i.e. Li blocks executions are not ...

Solution Summary

Response elaborates the process, so as to guide the reader to draw a DAG not just for the given "do ... end do" loop, but similar code as well.

$2.19