Determine the loopcarried interiteration dependencies in the

Determine the loopcarried (interiteration) dependencies in the following loop and rewrite it so that it is parallel.

for (i = 1; i<=99; i++) {

a[i] = b[i] + c[i];   /S1/

b[i] = a[i] + d[i];   /S2/

a[i+1] = a[i] + e[i];   /S3/

}

Solution

loop1: for (i = 1; i<=99; i++) {

  a[i] = b[i] + c[i]; /S1/

}

loop2: for (i = 1; i<=99; i++) {

  b[i] = a[i] + d[i];   /S2/

}

loop3: for (i = 1; i<=99; i++) {

  a[i+1] = a[i] + e[i];   /S3/

}

Determine the loopcarried (interiteration) dependencies in the following loop and rewrite it so that it is parallel. for (i = 1; i<=99; i++) { a[i] = b[i] +

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site