1.23
2.0
main
test-branch
| 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, h1;
|
|---|
| 16 | T *p, *q;
|
|---|
| 17 |
|
|---|
| 18 | s.h = &h; s1.h = &h1;
|
|---|
| 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; 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.