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