1.23
2.0
main
test-branch
| Rev | Line | |
|---|
| [59eb487] | 1 | #include <omp.h>
|
|---|
| 2 | #include <stdio.h>
|
|---|
| 3 |
|
|---|
| 4 | int main (int argc, char * argv[]){
|
|---|
| 5 | double a[3];
|
|---|
| 6 | double b[3];
|
|---|
| 7 | double c[3];
|
|---|
| 8 | int zero = 0;
|
|---|
| 9 | int three = 3;
|
|---|
| 10 | int one = 1;
|
|---|
| 11 | int i;
|
|---|
| 12 |
|
|---|
| 13 | #pragma omp parallel
|
|---|
| 14 | {
|
|---|
| 15 | #pragma omp for
|
|---|
| 16 | for(i=zero; three > i; i+=one)
|
|---|
| 17 | a[i] = i;
|
|---|
| 18 | }
|
|---|
| 19 | #pragma omp parallel
|
|---|
| 20 | {
|
|---|
| 21 | #pragma omp for
|
|---|
| 22 | for(int j=three; j > zero; j = j - 1){
|
|---|
| 23 | b[three - j] = three - j;
|
|---|
| 24 | }
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | #pragma omp parallel
|
|---|
| 28 | {
|
|---|
| 29 | #pragma omp for
|
|---|
| 30 | for(int j=three; j >= one; j--){
|
|---|
| 31 | c[three - j] = three - j;
|
|---|
| 32 | }
|
|---|
| 33 | }
|
|---|
| 34 |
|
|---|
| 35 | //Properties checking
|
|---|
| 36 | for(int j = 0; j<three; j++){
|
|---|
| 37 | $assert a[j] == b[j];
|
|---|
| 38 | $assert b[j] == j;
|
|---|
| 39 | $assert c[j] == b[j];
|
|---|
| 40 | }
|
|---|
| 41 | return 0;
|
|---|
| 42 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.