source: CIVL/examples/omp/canonicalForLoops.c@ 7d77e64

main test-branch
Last change on this file since 7d77e64 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 715 bytes
Line 
1#ifdef _CIVL
2#include <civlc.cvh>
3#endif
4#include <omp.h>
5#include <stdio.h>
6
7int 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.