source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB067-restrictpointer1-orig-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.6 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!Array initialization using assignments. No data race pairs.
9
10module DRB067
11 use omp_lib
12 implicit none
13contains
14 subroutine foo(newSxx, newSyy, len)
15 integer, value :: len
16 integer :: i
17 integer, parameter :: dp = kind(1.0d0)
18 real(dp),dimension(:), pointer :: newSxx, newSyy
19 real(dp),dimension(len), target :: tar1, tar2
20
21 allocate (newSxx(len))
22 allocate (newSyy(len))
23
24 newSxx => tar1
25 newSyy => tar2
26
27 !$omp parallel do private (i) firstprivate (len)
28 do i = 1, len
29 tar1(i) = 0.0
30 tar2(i) = 0.0
31 end do
32 !$omp end parallel do
33
34 print*,tar1(len),tar2(len)
35
36 if(associated(newSxx))nullify(newSxx)
37 if(associated(newSyy))nullify(newSyy)
38
39 end subroutine
40end module
41program DRB067_restrictpointer1_orig_no
42 use omp_lib
43 use DRB067
44 implicit none
45
46 integer :: len = 1000
47 integer, parameter :: dp = kind(1.0d0)
48 real(dp),dimension(:), pointer :: newSxx, newSyy
49
50 allocate (newSxx(len))
51 allocate (newSyy(len))
52
53 call foo(newSxx, newSyy, len)
54
55 if(associated(newSxx))nullify(newSxx)
56 if(associated(newSyy))nullify(newSyy)
57end program
Note: See TracBrowser for help on using the repository browser.