source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB066-pointernoaliasing-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.4 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!Freshly allocated pointers do not alias to each other. No data race pairs.
9
10module DRB066
11 use omp_lib
12 implicit none
13contains
14 subroutine setup(N)
15 integer, value :: N
16 integer :: i
17 integer, parameter :: dp = kind(1.0d0)
18 real(dp),dimension(:), pointer :: m_pdv_sum, m_nvol
19 real(dp),dimension(:), allocatable, target :: tar1, tar2
20
21 allocate (m_pdv_sum(N))
22 allocate (m_nvol(N))
23 allocate (tar1(N))
24 allocate (tar2(N))
25
26 m_pdv_sum => tar1
27 m_nvol => tar2
28
29 !$omp parallel do schedule(static)
30 do i = 1, N
31 tar1(i) = 0.0
32 tar2(i) = i*2.5
33 end do
34 !$omp end parallel do
35
36 !print*,tar1(N),tar2(N)
37 if (associated(m_pdv_sum)) nullify(m_pdv_sum)
38 if (associated(m_nvol)) nullify(m_nvol)
39 deallocate(tar1,tar2)
40 end subroutine
41end module
42
43program DRB066_pointernoaliasing_orig_no
44 use omp_lib
45 use DRB066
46 implicit none
47
48 integer :: N
49 N = 1000
50
51 call setup(N)
52
53end program
Note: See TracBrowser for help on using the repository browser.