1.23
2.0
main
test-branch
| Line | |
|---|
| 1 | /* Only the outmost loop can be parallelized.
|
|---|
| 2 |
|
|---|
| 3 | The inner loop has loop carried anti data dependence.
|
|---|
| 4 | However, the loop is not parallelized so no race condition.
|
|---|
| 5 |
|
|---|
| 6 | Source: based on AutoPar's regression test.
|
|---|
| 7 | */
|
|---|
| 8 | int n=100, m=100;
|
|---|
| 9 | double b[100][100];
|
|---|
| 10 |
|
|---|
| 11 | void foo()
|
|---|
| 12 | {
|
|---|
| 13 | int i,j;
|
|---|
| 14 | #pragma omp parallel for private(j)
|
|---|
| 15 | for (i=0;i<n;i++)
|
|---|
| 16 | for (j=1;j<m;j++) // Be careful about bounds of j
|
|---|
| 17 | b[i][j]=b[i][j-1];
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | int main()
|
|---|
| 21 | {
|
|---|
| 22 | foo();
|
|---|
| 23 | return 0;
|
|---|
| 24 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.