source: CIVL/examples/omp/DataRaceBench/micro-benchmarks/pireduction-orig-no.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: 288 bytes
Line 
1// Classic PI calculation using reduction
2#define num_steps 2000000000
3
4int main(int argc, char** argv)
5{
6 double pi = 0;
7 int i;
8#pragma omp parallel for reduction(+:pi)
9 for (i = 0; i < num_steps; i++) {
10 pi += 1.0 / (i * 4.0 + 1.0);
11 }
12 pi = pi * 4.0;
13 return 0;
14}
15
Note: See TracBrowser for help on using the repository browser.