source: CIVL/mods/dev.civl.com/examples/omp/dataracebench-1.3.2/micro-benchmarks/DRB166-taskdep4-orig-omp50-no.c@ cb4d4f4

main test-branch
Last change on this file since cb4d4f4 was aad342c, checked in by Stephen Siegel <siegel@…>, 3 years ago

Performing huge refactor to incorporate ABC, GMC, and SARL into CIVL repo and use Java modules.

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

  • Property mode set to 100755
File size: 1.1 KB
Line 
1/*
2!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!
3!!! Copyright (c) 2017-20, Lawrence Livermore National Security, LLC
4!!! and DataRaceBench project contributors. See the DataRaceBench/COPYRIGHT file for details.
5!!!
6!!! SPDX-License-Identifier: (BSD-3-Clause)
7!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!
8 */
9
10/* The second taskwait ensures that the second child task has completed; hence it is safe to access
11 * the y variable in the following print statement.
12 * */
13
14
15#include <stdio.h>
16#include <omp.h>
17
18void foo(){
19
20 int x = 0, y = 2;
21
22 #pragma omp task depend(inout: x) shared(x)
23 x++; //1st Child Task
24
25 #pragma omp task shared(y)
26 y--; // 2nd child task
27
28 #pragma omp taskwait depend(in: x) // 1st taskwait
29
30 printf("x=%d\n",x);
31
32 #pragma omp taskwait // 2nd taskwait
33
34 printf("y=%d\n",y);
35}
36
37
38int main(){
39 #pragma omp parallel
40 #pragma omp single
41 foo();
42
43 return 0;
44}
45
Note: See TracBrowser for help on using the repository browser.