source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB092-threadprivatemissing2-orig-yes.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.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!No threadprivate is used to avoid data races.
10!This is the case for a variable referenced within a construct.
11!
12!Data race pairs sum0@34:13 vs. sum0@34:20
13! sum0@34:13 vs. sum0@34:13
14
15
16module DRB092
17 implicit none
18 integer :: sum0, sum1
19end module
20
21program DRB092_threadprivatemissing2_orig_yes
22 use omp_lib
23 use DRB092
24 implicit none
25
26 integer :: i, sum
27 sum = 0
28 sum0 = 0
29 sum1 = 0
30
31 !$omp parallel
32 !$omp do
33 do i = 1, 1001
34 sum0 = sum0+i
35 end do
36 !$omp end do
37 !$omp critical
38 sum = sum+sum0
39 !$omp end critical
40 !$omp end parallel
41
42 do i = 1, 1001
43 sum1=sum1+i
44 end do
45
46 print*,'sum =',sum,'sum1 =',sum1
47
48end program
Note: See TracBrowser for help on using the repository browser.