Mercurial > hg > CbC > CbC_gcc
comparison libgomp/testsuite/libgomp.c/omp_workshare3.c @ 0:a06113de4d67
first commit
author | kent <kent@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 17 Jul 2009 14:47:48 +0900 |
parents | |
children | 04ced10e8804 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:a06113de4d67 |
---|---|
1 /* { dg-do compile } */ | |
2 | |
3 /****************************************************************************** | |
4 * OpenMP Example - Combined Parallel Loop Work-sharing - C/C++ Version | |
5 * FILE: omp_workshare3.c | |
6 * DESCRIPTION: | |
7 * This example attempts to show use of the parallel for construct. However | |
8 * it will generate errors at compile time. Try to determine what is causing | |
9 * the error. See omp_workshare4.c for a corrected version. | |
10 * SOURCE: Blaise Barney 5/99 | |
11 * LAST REVISED: 03/03/2002 | |
12 ******************************************************************************/ | |
13 | |
14 #include <omp.h> | |
15 #include <stdio.h> | |
16 #define N 50 | |
17 #define CHUNKSIZE 5 | |
18 | |
19 main () { | |
20 | |
21 int i, chunk, tid; | |
22 float a[N], b[N], c[N]; | |
23 | |
24 /* Some initializations */ | |
25 for (i=0; i < N; i++) | |
26 a[i] = b[i] = i * 1.0; | |
27 chunk = CHUNKSIZE; | |
28 | |
29 #pragma omp parallel for \ | |
30 shared(a,b,c,chunk) \ | |
31 private(i,tid) \ | |
32 schedule(static,chunk) | |
33 { /* { dg-error "expected" } */ | |
34 tid = omp_get_thread_num(); | |
35 for (i=0; i < N; i++) | |
36 { | |
37 c[i] = a[i] + b[i]; | |
38 printf("tid= %d i= %d c[i]= %f\n", tid, i, c[i]); | |
39 } | |
40 } /* end of parallel for construct */ | |
41 | |
42 return 0; | |
43 } |