source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB158-missingtaskbarrier-orig-gpu-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.1 KB
RevLine 
[e3f356c]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!Depend clause at line 29 and 33 will ensure that there is no data race.
9
10module DRB158
11 integer :: a, i
12 integer :: x(64), y(64)
13end module
14
15program DRB158_missingtaskbarrier_orig_gpu_no
16 use omp_lib
17 use DRB158
18 implicit none
19
20 do i = 1, 64
21 x(i) = 0
22 y(i) = 3
23 end do
24
25 a = 5
26
27 !$omp target map(to:y,a) map(tofrom:x) device(0)
28 do i = 1, 64
29 !$omp task depend(inout:x(i))
30 x(i) = a*x(i)
31 !$omp end task
32
33 !$omp task depend(inout:x(i))
34 x(i) = x(i)+y(i)
35 !$omp end task
36 end do
37 !$omp end target
38
39 do i = 1, 64
40 if (x(i) /= 3) then
41 print*,x(i)
42 end if
43 end do
44
45 !$omp taskwait
46
47end program
Note: See TracBrowser for help on using the repository browser.