main
|
Last change
on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago |
|
Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c
|
-
Property mode
set to
100755
|
|
File size:
1.1 KB
|
| Rev | Line | |
|---|
| [e3f356c] | 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 |
|
|---|
| 18 | void 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 task depend(in: x) if(0) // 1st taskwait
|
|---|
| 29 | {}
|
|---|
| 30 |
|
|---|
| 31 | printf("x=%d\n",x);
|
|---|
| 32 |
|
|---|
| 33 | #pragma omp taskwait // 2nd taskwait
|
|---|
| 34 |
|
|---|
| 35 | printf("y=%d\n",y);
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 | int main(){
|
|---|
| 40 | #pragma omp parallel
|
|---|
| 41 | #pragma omp single
|
|---|
| 42 | foo();
|
|---|
| 43 |
|
|---|
| 44 | return 0;
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.