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