1.23
2.0
acw/focus-triggers
main
test-branch
| Line | |
|---|
| 1 | #include <omp.h>
|
|---|
| 2 | #include <stdio.h>
|
|---|
| 3 | int N=2;
|
|---|
| 4 | int main() {
|
|---|
| 5 | int a[N], b[N];
|
|---|
| 6 | #pragma omp parallel
|
|---|
| 7 | {
|
|---|
| 8 | int i, tid=omp_get_thread_num();
|
|---|
| 9 | #pragma omp for nowait
|
|---|
| 10 | for (i=0; i<N; i++) {
|
|---|
| 11 | $atomic{ printf("Thread %d writes a[%d]\n", tid, i); a[i]=i; }
|
|---|
| 12 | }
|
|---|
| 13 | #pragma omp for
|
|---|
| 14 | for (i=0; i<N; i++) {
|
|---|
| 15 | $atomic{ printf("Thread %d reads a[%d]\n", tid, i); b[i]=2*a[i]; }
|
|---|
| 16 | }
|
|---|
| 17 | }
|
|---|
| 18 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.