source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB167-taskdep5-orig-omp50-no.f95

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.3 KB
Line 
1!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!
2!!! Copyright (c) 2017-20, Lawrence Livermore National Security, LLC
3!!! and DataRaceBench project contributors. See the DataRaceBench/COPYRIGHT file for details.
4!!!
5!!! SPDX-License-Identifier: (BSD-3-Clause)
6!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!
7
8!The second taskwait ensures that the second child task has completed; hence it is safe to access
9!the y variable in the following print statement.
10
11program DRB167_taskdep5_orig_no_omp50
12 use omp_lib
13 implicit none
14
15 !$omp parallel
16 !$omp single
17 call foo()
18 !$omp end single
19 !$omp end parallel
20contains
21 subroutine foo()
22 implicit none
23 integer :: x, y
24 x = 0
25 y = 2
26
27 !$omp task depend(inout: x) shared(x)
28 x = x+1 !!1st Child Task
29 !$omp end task
30
31 !$omp task shared(y)
32 y = y-x !!2nd child task
33 !$omp end task
34
35 !$omp taskwait depend(in: x) !!1st taskwait
36
37 print*, "x=", x
38
39 !$omp taskwait !!2nd taskwait
40
41 print*, "y=", y
42
43 end subroutine
44end program
Note: See TracBrowser for help on using the repository browser.