source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB117-taskwait-waitonlychild-orig-yes.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 thread encountering the taskwait directive at line 22 only waits for its child task
9!(line 14-21) to complete. It does not wait for its descendant tasks (line 16-19). Data Race pairs, sum@36:13 and sum@36:13.
10
11program DRB117_taskwait_waitonlychild_orig_yes
12 use omp_lib
13 implicit none
14
15 integer, dimension(:), allocatable :: a, psum
16 integer :: sum, i
17
18 allocate(a(4))
19 allocate(psum(4))
20
21 !$omp parallel num_threads(2)
22 !$omp do schedule(dynamic, 1)
23 do i = 1, 4
24 a(i) = i
25 end do
26 !$omp end do
27
28 !$omp single
29 !$omp task
30 !$omp task
31 psum(2) = a(3)+a(4)
32 !$omp end task
33 psum(1) = a(1)+a(2)
34 !$omp end task
35 !$omp taskwait
36 sum = psum(2)+psum(1)
37 !$omp end single
38 !$omp end parallel
39
40 print*,'sum =',sum
41
42 deallocate(a,psum)
43end program
Note: See TracBrowser for help on using the repository browser.