source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks-fortran/DRB074-flush-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!This benchmark is extracted from flush_nolist.1c of OpenMP Application
9!Programming Interface Examples Version 4.5.0 .
10!We added one critical section to make it a test with only one pair of data races.
11!The data race will not generate wrong result though. So the assertion always passes.
12!Data race pair: i@37:13 vs. i@38:15
13
14module DRB074
15 use omp_lib
16 implicit none
17contains
18 subroutine f1(q)
19 integer :: q
20 !$omp critical
21 q = 1
22 !$omp end critical
23 !$omp flush
24 end subroutine
25end module
26
27program DRB074_flush_orig_yes
28 use omp_lib
29 use DRB074
30 implicit none
31
32 integer :: i, sum
33 i = 0
34 sum = 0
35
36 !$omp parallel reduction(+:sum) num_threads(10)
37 call f1(i)
38 sum = sum+i
39 !$omp end parallel
40
41 if (sum /= 10) then
42 print*,'sum =',sum
43 end if
44end program
Note: See TracBrowser for help on using the repository browser.