1.23
2.0
acw/focus-triggers
main
test-branch
| Line | |
|---|
| 1 | // This x should be not lastprivate since it is live-in
|
|---|
| 2 | // x is both live-in and live-out, and written, cannot be reduction
|
|---|
| 3 | //
|
|---|
| 4 | // So, the loop cannot be parallelized
|
|---|
| 5 | #include <stdio.h>
|
|---|
| 6 | #include <stdlib.h>
|
|---|
| 7 |
|
|---|
| 8 | int main(int argc, char* argv[])
|
|---|
| 9 | {
|
|---|
| 10 | int len=100;
|
|---|
| 11 |
|
|---|
| 12 | if (argc>1)
|
|---|
| 13 | len = atoi(argv[1]);
|
|---|
| 14 |
|
|---|
| 15 | int a[len];
|
|---|
| 16 | int i,x=10;
|
|---|
| 17 |
|
|---|
| 18 | #pragma omp parallel for
|
|---|
| 19 | for (i=0;i<len;i++)
|
|---|
| 20 | {
|
|---|
| 21 | a[i] = x;
|
|---|
| 22 | x=i;
|
|---|
| 23 | }
|
|---|
| 24 | printf("x=%d, a[0]=%d\n",x,a[0]);
|
|---|
| 25 | return 0;
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.