source: CIVL/examples/omp/DataRaceBench/micro-benchmarks/reductionmissing-orig-yes.c@ e5cec5ae

1.23 2.0 main test-branch
Last change on this file since e5cec5ae 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: 468 bytes
Line 
1/* A kernel for two level parallelizable loop with reduction
2 if reduction(error) is missing, there is race condition.
3*/
4#include <stdio.h>
5int main(int argc, char* argv[])
6{
7 int i,j;
8 float temp, error;
9 int len=100;
10
11 float u[100][100];
12#pragma omp parallel for private (temp,i,j)
13 for (i = 0; i < len; i++)
14 for (j = 0; j < len; j++)
15 {
16 temp = u[i][j];
17 error = error + temp * temp;
18 }
19 printf ("error = %f\n", error);
20 return 0;
21}
Note: See TracBrowser for help on using the repository browser.