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.3 KB
|
| Rev | Line | |
|---|
| [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 | !use of omp target + map + array sections derived from pointers. No data race pairs.
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 | module DRB099
|
|---|
| 12 | implicit none
|
|---|
| 13 | contains
|
|---|
| 14 | REAL FUNCTION foo(a,b,N)
|
|---|
| 15 | use omp_lib
|
|---|
| 16 | implicit none
|
|---|
| 17 | INTEGER :: N, i
|
|---|
| 18 | integer, parameter :: dp = kind(1.0d0)
|
|---|
| 19 | real(dp), dimension(:), allocatable :: a,b
|
|---|
| 20 |
|
|---|
| 21 | !$omp target map(to:a(1:N)) map(from:b(1:N))
|
|---|
| 22 | !$omp parallel do
|
|---|
| 23 | do i = 1, N
|
|---|
| 24 | b(i) = a(i)*real(i,dp)
|
|---|
| 25 | end do
|
|---|
| 26 | !$omp end parallel do
|
|---|
| 27 | !$omp end target
|
|---|
| 28 |
|
|---|
| 29 | RETURN
|
|---|
| 30 | END FUNCTION foo
|
|---|
| 31 | end module
|
|---|
| 32 |
|
|---|
| 33 | program DRB099_targetparallelfor2_orig_no
|
|---|
| 34 | use omp_lib
|
|---|
| 35 | use DRB099
|
|---|
| 36 | implicit none
|
|---|
| 37 |
|
|---|
| 38 | integer :: i, len
|
|---|
| 39 | integer, parameter :: dp = kind(1.0d0)
|
|---|
| 40 | real(dp), dimension(:), allocatable :: a,b
|
|---|
| 41 | real :: x
|
|---|
| 42 |
|
|---|
| 43 | len = 1000
|
|---|
| 44 |
|
|---|
| 45 | allocate(a(len))
|
|---|
| 46 | allocate(b(len))
|
|---|
| 47 |
|
|---|
| 48 | do i = 1, len
|
|---|
| 49 | a(i) = (real(i,dp))/2.0
|
|---|
| 50 | b(i) = 0.0
|
|---|
| 51 | end do
|
|---|
| 52 |
|
|---|
| 53 | x=foo(a,b,len)
|
|---|
| 54 | print*,'b(50) =',b(50)
|
|---|
| 55 |
|
|---|
| 56 | deallocate(a,b)
|
|---|
| 57 | end program
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.