source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB086-static-data-member-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
RevLine 
[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!For the case of a variable which is not referenced within a construct:
9!static data member should be shared, unless it is within a threadprivate directive.
10!
11!Dependence pair: counter@27:9 vs. counter@27:19
12
13module DRB086
14 implicit none
15 public :: A, foo
16
17 integer, save :: counter
18 integer, save :: pcounter
19
20 type A
21 integer :: counter
22 integer :: pcounter
23 end type
24 !$omp threadprivate(pcounter)
25contains
26 subroutine foo()
27 counter = counter + 1
28 pcounter = pcounter + 1
29 end subroutine
30end module
31
32program DRB086_static_data_member_orig_yes
33 use omp_lib
34 use DRB086
35 implicit none
36
37 type(A) :: c
38 c = A(0,0)
39
40 !$omp parallel
41 call foo()
42 !$omp end parallel
43
44 print *,counter,pcounter
45end program
Note: See TracBrowser for help on using the repository browser.