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 | !micro-bench equivalent to the restrict keyword in C-99 in F95. No data race pairs.
|
|---|
| 9 |
|
|---|
| 10 | module DRB068
|
|---|
| 11 | use omp_lib
|
|---|
| 12 | implicit none
|
|---|
| 13 | contains
|
|---|
| 14 | subroutine foo(n, a, b, c, d)
|
|---|
| 15 | integer, value :: n
|
|---|
| 16 | integer :: i
|
|---|
| 17 | integer, dimension(:), pointer, intent(out) :: a, b, c, d
|
|---|
| 18 |
|
|---|
| 19 | allocate (a(n))
|
|---|
| 20 | allocate (b(n))
|
|---|
| 21 | allocate (c(n))
|
|---|
| 22 | allocate (d(n))
|
|---|
| 23 |
|
|---|
| 24 | do i = 1, n
|
|---|
| 25 | b(i) = i
|
|---|
| 26 | c(i) = i
|
|---|
| 27 | end do
|
|---|
| 28 |
|
|---|
| 29 | !$omp parallel do
|
|---|
| 30 | do i = 1, n
|
|---|
| 31 | a(i) = b(i)+c(i)
|
|---|
| 32 | end do
|
|---|
| 33 | !$omp end parallel do
|
|---|
| 34 |
|
|---|
| 35 | if (a(500) /= 1000) then
|
|---|
| 36 | print*,a(500)
|
|---|
| 37 | end if
|
|---|
| 38 |
|
|---|
| 39 | nullify(a,b,c,d)
|
|---|
| 40 | end subroutine
|
|---|
| 41 | end module
|
|---|
| 42 |
|
|---|
| 43 | program DRB068_restrictpointer2_orig_no
|
|---|
| 44 | use omp_lib
|
|---|
| 45 | use DRB068
|
|---|
| 46 | implicit none
|
|---|
| 47 |
|
|---|
| 48 | integer :: n = 1000
|
|---|
| 49 | integer, dimension(:), pointer :: a=>null(), b=>null(), c=>null(), d=>null()
|
|---|
| 50 |
|
|---|
| 51 | allocate (a(n))
|
|---|
| 52 | allocate (b(n))
|
|---|
| 53 | allocate (c(n))
|
|---|
| 54 | allocate (d(n))
|
|---|
| 55 |
|
|---|
| 56 | call foo(n,a,b,c,d)
|
|---|
| 57 |
|
|---|
| 58 | if(associated(a))nullify(a)
|
|---|
| 59 | if(associated(b))nullify(b)
|
|---|
| 60 | if(associated(c))nullify(c)
|
|---|
| 61 | if(associated(d))nullify(d)
|
|---|
| 62 |
|
|---|
| 63 | end program
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.