source: CIVL/examples/omp/atomics/atomic_default.c@ cc8e265

1.23 2.0 main test-branch
Last change on this file since cc8e265 was 5bea123, checked in by Ziqing Luo <ziqing@…>, 7 years ago

Implemented the transformation of OpenMP atomic operations

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

  • Property mode set to 100644
File size: 435 bytes
Line 
1#include<assert.h>
2
3int main() {
4 int x = 0;
5 int y = 0;
6#pragma omp parallel sections
7 {
8 #pragma omp section
9 {
10 #pragma omp atomic
11 x++;
12 }
13 #pragma omp section
14 {
15 #pragma omp atomic
16 x = x + y;
17 }
18 #pragma omp section
19 {
20 #pragma omp atomic
21 x += y;
22 }
23 #pragma omp section
24 {
25 #pragma omp atomic
26 x = y + x;
27 }
28 }
29 assert (x == 0 || x == 1);
30}
Note: See TracBrowser for help on using the repository browser.