source:
CIVL/mods/dev.civl.com/examples/omp/simplifier/structNoAlias.c@
cb4d4f4
| Last change on this file since cb4d4f4 was aad342c, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 303 bytes | |
| Rev | Line | |
|---|---|---|
| [e80ab56] | 1 | #include "omp.h" |
| 2 | #define N 10 | |
| 3 | ||
| 4 | typedef struct { | |
| 5 | int a[N]; | |
| 6 | int b[N]; | |
| 7 | } T; | |
| 8 | ||
| 9 | int main() { | |
| 10 | T s; | |
| 11 | T *p, *q; | |
| 12 | ||
| 13 | p = &s; q = p; | |
| 14 | for (int i = 0; i < N; i++) | |
| 15 | p->b[i] = 0; | |
| 16 | #pragma omp parallel for firstprivate(p, q) shared(s) | |
| 17 | for (int i = 0; i < N; i++) { | |
| 18 | p->a[i] += q->b[i]; | |
| 19 | } | |
| 20 | } |
Note:
See TracBrowser
for help on using the repository browser.
