source: CIVL/examples/omp/DataRaceBench/micro-benchmarks/reductionmissing-var-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: 462 bytes
RevLine 
[36a61f3]1/* A kernel for two level parallelizable loop with reduction
2 if reduction(error) is missing, there is race condition.
3*/
4#include <stdlib.h>
5
6int main(int argc, char* argv[])
7{
8 int i,j;
9 float temp, error;
10 int len=100;
11
12 if (argc>1)
13 len = atoi(argv[1]);
14
15 float u[len][len];
16#pragma omp parallel for private (temp,i,j)
17 for (i = 0; i < len; i++)
18 for (j = 0; j < len; j++)
19 {
20 temp = u[i][j];
21 error = error + temp * temp;
22 }
23}
Note: See TracBrowser for help on using the repository browser.