source:
CIVL/mods/dev.civl.com/examples/omp/simplifier/structAlias3.c@
cb4d4f4
| Last change on this file since cb4d4f4 was aad342c, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 362 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; | |
| 15 | H h; | |
| 16 | T *p, *q; | |
| 17 | ||
| 18 | p = &s; q = p; | |
| 19 | p->h = &h; | |
| 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; j++) { | |
| 23 | p->h->b[i][j] = q->h->b[i + 1][j]; | |
| 24 | } | |
| 25 | } |
Note:
See TracBrowser
for help on using the repository browser.
