source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB026-targetparallelfor-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.0 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!Race condition due to anti-dependence within a loop offloaded to accelerators.
9!Data race pair: a[i]@29 vs. a[i+1]@29
10
11program DRB026_targetparallelfor_orig_yes
12 use omp_lib
13 implicit none
14
15 integer :: i, len
16 integer, dimension(:), allocatable :: a
17
18 len = 1000
19
20 allocate (a(len))
21
22 do i = 1, len
23 a(i) = i
24 end do
25
26 !$omp target map(a)
27 !$omp parallel do
28 do i = 1, len-1
29 a(i) = a(i+1) + 1
30 end do
31 !$omp end parallel do
32 !$omp end target
33
34 do i = 1, len
35 write(6,*) 'Values for i and a(i) are:', i, a(i)
36 end do
37
38 deallocate(a)
39end program
Note: See TracBrowser for help on using the repository browser.