source: CIVL/examples/omp/DataRaceBench/micro-benchmarks/outeronly2-orig-no.c@ af3b8e4

1.23 2.0 main test-branch
Last change on this file since af3b8e4 was 36a61f3, checked in by Ziqing Luo <ziqing@…>, 9 years ago

Commit DataRaceBench into CIVL examples

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

  • Property mode set to 100644
File size: 459 bytes
Line 
1/* Only the outmost loop can be parallelized.
2
3 The inner loop has loop carried anti data dependence.
4 However, the loop is not parallelized so no race condition.
5
6 Source: based on AutoPar's regression test.
7 */
8int n=100, m=100;
9double b[100][100];
10
11void foo()
12{
13 int i,j;
14#pragma omp parallel for private(j)
15 for (i=0;i<n;i++)
16 for (j=1;j<m;j++) // Be careful about bounds of j
17 b[i][j]=b[i][j-1];
18}
19
20int main()
21{
22 foo();
23 return 0;
24}
Note: See TracBrowser for help on using the repository browser.