source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB160-nobarrier-orig-gpu-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.5 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!Vector addition followed by multiplication involving the same var should have a barrier in between.
9!omp distribute directive does not have implicit barrier. This will cause data race.
10!Data Race Pair: b[i]@36:23 and b[i]@42:13
11
12module DRB160
13 integer :: a, i, j, k, val
14 integer :: b(8), c(8), temp(8)
15end module
16
17program DRB160_nobarrier_orig_gpu_yes
18 use omp_lib
19 use DRB160
20 implicit none
21
22 do i = 1, 8
23 b(i) = 0
24 c(i) = 2
25 temp(i) = 0
26 end do
27
28 a = 2
29 val = 0
30
31 !$omp target map(tofrom:b) map(to:c,temp,a) device(0)
32 !$omp teams
33 do i = 1, 100
34 !$omp distribute
35 do j = 1, 8
36 temp(j) = b(j)+c(j)
37 end do
38 !$omp end distribute
39
40 !$omp distribute
41 do j = 8, 1, k-1
42 b(j) = temp(j)*a
43 end do
44 !$omp end distribute
45 end do
46 !$omp end teams
47 !$omp end target
48
49 do i = 1, 100
50 val = val+2
51 val = val*2
52 end do
53
54 do i = 1, 8
55 if (val /= b(i)) then
56 print*,b(i),val
57 end if
58 end do
59
60end program
Note: See TracBrowser for help on using the repository browser.