source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB127-tasking-threadprivate1-orig-no.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.3 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!!This example is referred from OpenMP Application Programming Interface 5.0, example tasking.7.c
9!!A task switch may occur at a task scheduling point. A single thread may execute both of the
10!!task regions that modify tp. The parts of these task regions in which tp is modified may be
11!!executed in any order so the resulting value of var can be either 1 or 2.
12!!There is a Race pair var@24:13 and var@24:13 but no data race.
13
14module DRB127
15 integer :: tp, var
16 !$omp threadprivate(tp)
17contains
18 subroutine foo
19 !$omp task
20 !$omp task
21 tp = 1
22 !$omp task
23 !$omp end task
24 var = tp ! value of var can be 1 or 2
25 !$omp end task
26 tp = 2
27 !$omp end task
28 end subroutine
29end module
30
31program DRB127_tasking_threadprivate1_orig_no
32 use omp_lib
33 use DRB127
34 implicit none
35
36 call foo()
37
38end program
Note: See TracBrowser for help on using the repository browser.