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.2 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 | !A file-scope variable used within a function called by a parallel region.
|
|---|
| 9 | !Use threadprivate to avoid data races. No data race pairs.
|
|---|
| 10 |
|
|---|
| 11 | module DRB085
|
|---|
| 12 | implicit none
|
|---|
| 13 | integer (kind=8) :: sum0, sum1
|
|---|
| 14 | !$omp threadprivate(sum0)
|
|---|
| 15 | contains
|
|---|
| 16 | subroutine foo(i)
|
|---|
| 17 | integer (kind=8) :: i
|
|---|
| 18 | sum0=sum0+i
|
|---|
| 19 | end subroutine
|
|---|
| 20 | end module
|
|---|
| 21 |
|
|---|
| 22 | program DRB085_threadprivate_orig_no
|
|---|
| 23 | use omp_lib
|
|---|
| 24 | use DRB085
|
|---|
| 25 | implicit none
|
|---|
| 26 |
|
|---|
| 27 | integer :: len
|
|---|
| 28 | integer (kind=8) :: i, sum
|
|---|
| 29 | len = 1000
|
|---|
| 30 | sum = 0
|
|---|
| 31 |
|
|---|
| 32 | !$omp parallel copyin(sum0)
|
|---|
| 33 | !$omp do
|
|---|
| 34 | do i = 1, len
|
|---|
| 35 | call foo(i)
|
|---|
| 36 | end do
|
|---|
| 37 | !$omp end do
|
|---|
| 38 | !$omp critical
|
|---|
| 39 | sum = sum+sum0
|
|---|
| 40 | !$omp end critical
|
|---|
| 41 | !$omp end parallel
|
|---|
| 42 |
|
|---|
| 43 | do i = 1, len
|
|---|
| 44 | sum1=sum1+i
|
|---|
| 45 | end do
|
|---|
| 46 |
|
|---|
| 47 | print*,'sum = ',sum,'sum1 =',sum1
|
|---|
| 48 | end program
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.