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