main
test-branch
| Line | |
|---|
| 1 | #include <civlc.cvh>
|
|---|
| 2 | #ifndef BAD
|
|---|
| 3 | #define OFFSET 0
|
|---|
| 4 | #else
|
|---|
| 5 | #define OFFSET 1
|
|---|
| 6 | #endif
|
|---|
| 7 |
|
|---|
| 8 | int main () {
|
|---|
| 9 | int x[4] = {1, 2, 3, 4};
|
|---|
| 10 | int y = 10;
|
|---|
| 11 |
|
|---|
| 12 | #pragma omp parallel sections firstprivate(y) shared(x)
|
|---|
| 13 | {
|
|---|
| 14 | {
|
|---|
| 15 | x[0] = x[0 + OFFSET] + y;
|
|---|
| 16 | }
|
|---|
| 17 | #pragma omp section
|
|---|
| 18 | {
|
|---|
| 19 | x[1] = x[1 + OFFSET] + y;
|
|---|
| 20 | }
|
|---|
| 21 | #pragma omp section
|
|---|
| 22 | {
|
|---|
| 23 | x[2] = x[2 + OFFSET] + y;
|
|---|
| 24 | }
|
|---|
| 25 | #pragma omp section
|
|---|
| 26 | {
|
|---|
| 27 | x[3] = x[3 + OFFSET] + y;
|
|---|
| 28 | }
|
|---|
| 29 | }
|
|---|
| 30 | return 0;
|
|---|
| 31 | } |
|---|
Note:
See
TracBrowser
for help on using the repository browser.