source: CIVL/examples/omp/simple/parallelfor.c.s@ bb03188

main test-branch
Last change on this file since bb03188 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 100755
File size: 838 bytes
Line 
1#include <omp.h>
2
3#define N 10
4
5int main (int argc, char *argv[]) {
6 double a[N], b[N];
7 int i, sum;
8
9
10
11// This omp construct is completely eliminated
12/*
13#pragma omp parallel for
14 for (i=0; i < N-1; i++)
15 b[i+1] = a[i+1] + 2*i;
16 */
17
18// These nested omp constructs are completely eliminated
19{
20 for (i=0; i < N-1; i++)
21 b[i+1] = a[i+1] + 2*i;
22}
23
24 /*
25#pragma omp parallel for
26 for (i=0; i < N; i++) {
27 a[i] = 0.0;
28 b[i] = a[i];
29 b[i] = a[i] + b[i];
30 }
31
32#pragma omp parallel for
33 for (i=0; i < N-1; i++)
34 a[i+1] = a[1+i] + 1;
35 //a[i+2-1] = a[(-2*3) + 2*i - i + 7] + 1;
36
37
38#pragma omp parallel for private(sum)
39 for (i=0; i < N; i++)
40 sum = sum + i;
41
42#pragma omp parallel for
43 for (i=0; i < N; i++)
44 sum = sum + i;
45 */
46
47}
Note: See TracBrowser for help on using the repository browser.