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